diff options
author | Adam <adam.moloney.stuck@gmail.com> | 2022-05-03 00:02:49 +0200 |
---|---|---|
committer | adamstuck <adam.moloney.stuck@gmail.com> | 2022-05-03 00:43:39 +0200 |
commit | 827805437eb232dd5605e06b448205c8a00496cd (patch) | |
tree | e9cc1de3fa95fbbfafaa81ff73f65ae87777e4bf /.config/nvim/lua/setup | |
parent | 1afa3a885a6d6356ff0417af5fe602d8e97b97f0 (diff) |
nvim: bufferline, nvim-tree, lsp, telescope, lualine
Diffstat (limited to '.config/nvim/lua/setup')
-rw-r--r-- | .config/nvim/lua/setup/bufferline.lua | 11 | ||||
-rw-r--r-- | .config/nvim/lua/setup/indent-blankline.lua | 3 | ||||
-rw-r--r-- | .config/nvim/lua/setup/lspconfig.lua | 30 | ||||
-rw-r--r-- | .config/nvim/lua/setup/lualine.lua | 1 | ||||
-rw-r--r-- | .config/nvim/lua/setup/nvim-lsp-installer.lua | 31 | ||||
-rw-r--r-- | .config/nvim/lua/setup/nvim-tree.lua | 26 | ||||
-rw-r--r-- | .config/nvim/lua/setup/telescope.lua | 27 |
7 files changed, 96 insertions, 33 deletions
diff --git a/.config/nvim/lua/setup/bufferline.lua b/.config/nvim/lua/setup/bufferline.lua new file mode 100644 index 0000000..3dc0c71 --- /dev/null +++ b/.config/nvim/lua/setup/bufferline.lua @@ -0,0 +1,11 @@ +require("bufferline").setup { + options = { + offsets = { { + filetype = "NvimTree", + padding = 1, + } }, + diagnostics = "nvim_lsp", + tab_size = 20, + show_close_icon = false, + }, +} diff --git a/.config/nvim/lua/setup/indent-blankline.lua b/.config/nvim/lua/setup/indent-blankline.lua index 4a3c1e9..8e68947 100644 --- a/.config/nvim/lua/setup/indent-blankline.lua +++ b/.config/nvim/lua/setup/indent-blankline.lua @@ -12,7 +12,8 @@ require("indent_blankline").setup { "TelescopePrompt", "TelescopeResults", "lsp-installer", + "NvimTree", "", }, - buftype_exclude = { "terminal" }, + buftype_exclude = { "terminal", "NvimTree" }, } diff --git a/.config/nvim/lua/setup/lspconfig.lua b/.config/nvim/lua/setup/lspconfig.lua new file mode 100644 index 0000000..47fd84a --- /dev/null +++ b/.config/nvim/lua/setup/lspconfig.lua @@ -0,0 +1,30 @@ +require("nvim-lsp-installer").setup {} +local lspconfig = require("lspconfig") + +local function on_attach() + vim.cmd('doautocmd User lspAttached') + vim.cmd('augroup Format') + vim.cmd('autocmd! * <buffer>') + vim.cmd('autocmd BufWritePre <buffer> lua vim.lsp.buf.formatting_sync()') + vim.cmd('augroup END') +end + +lspconfig.sumneko_lua.setup { + on_attach = on_attach, + settings = { + Lua = { + diagnostics = { + globals = { 'vim' } + } + } + } +} +lspconfig.rust_analyzer.setup { + on_attach = on_attach, +} + +local signs = { Error = " ", Warn = " ", Hint = " ", Info = " " } +for type, icon in pairs(signs) do + local hl = "DiagnosticSign" .. type + vim.fn.sign_define(hl, { text = icon, texthl = hl, numhl = hl }) +end diff --git a/.config/nvim/lua/setup/lualine.lua b/.config/nvim/lua/setup/lualine.lua index 6304aa1..4d08844 100644 --- a/.config/nvim/lua/setup/lualine.lua +++ b/.config/nvim/lua/setup/lualine.lua @@ -5,6 +5,7 @@ require'lualine'.setup { component_separators = {left = '', right = ''}, section_separators = {left = '', right = ''}, disabled_filetypes = {'startify', 'terminal', 'netrw', 'NvimTree', 'packer'}, + globalstatus = true, }, sections = { lualine_a = {'mode'}, diff --git a/.config/nvim/lua/setup/nvim-lsp-installer.lua b/.config/nvim/lua/setup/nvim-lsp-installer.lua deleted file mode 100644 index edcc24d..0000000 --- a/.config/nvim/lua/setup/nvim-lsp-installer.lua +++ /dev/null @@ -1,31 +0,0 @@ -local lsp_installer = require("nvim-lsp-installer") - --- Register a handler that will be called for each installed server when it's ready (i.e. when installation is finished --- or if the server is already installed). -lsp_installer.on_server_ready(function(server) - local opts = { - on_attach = function() - vim.cmd('doautocmd User lspAttached') - vim.cmd('augroup Format') - vim.cmd('autocmd! * <buffer>') - vim.cmd('autocmd BufWritePre <buffer> lua vim.lsp.buf.formatting_sync()') - vim.cmd('augroup END') - end, - } - - local signs = { Error = " ", Warn = " ", Hint = " ", Info = " " } - for type, icon in pairs(signs) do - local hl = "DiagnosticSign" .. type - vim.fn.sign_define(hl, { text = icon, texthl = hl, numhl = hl }) - end - - -- (optional) Customize the options passed to the server - -- if server.name == "tsserver" then - -- opts.root_dir = function() ... end - -- end - - -- This setup() function will take the provided server configuration and decorate it with the necessary properties - -- before passing it onwards to lspconfig. - -- Refer to https://github.com/neovim/nvim-lspconfig/blob/master/doc/server_configurations.md - server:setup(opts) -end) diff --git a/.config/nvim/lua/setup/nvim-tree.lua b/.config/nvim/lua/setup/nvim-tree.lua new file mode 100644 index 0000000..2903fb0 --- /dev/null +++ b/.config/nvim/lua/setup/nvim-tree.lua @@ -0,0 +1,26 @@ +vim.cmd('highlight NvimTreeIndentMarker guifg=#3b414c gui=nocombine') + +require 'nvim-tree'.setup { + hijack_cursor = true, + renderer = { + icons = { + webdev_colors = true, + }, + indent_markers = { + enable = true, + }, + }, + view = { + side = "left", + hide_root_folder = true, + }, + git = { + enable = false, + ignore = false, + }, + actions = { + open_file = { + resize_window = true, + }, + }, +} diff --git a/.config/nvim/lua/setup/telescope.lua b/.config/nvim/lua/setup/telescope.lua index a9dfeb3..da7a3ed 100644 --- a/.config/nvim/lua/setup/telescope.lua +++ b/.config/nvim/lua/setup/telescope.lua @@ -1,7 +1,32 @@ require("telescope").setup { defaults = { - path_display = { + path_display = { truncate = 3, }, + prompt_prefix = " ", + selection_caret = " ", + entry_prefix = " ", + -- initial_mode = "insert", + -- selection_strategy = "reset", + -- sorting_strategy = "ascending", + -- layout_strategy = "horizontal", + -- layout_config = { + -- horizontal = { + -- prompt_position = "top", + -- preview_width = 0.55, + -- results_width = 0.8, + -- }, + -- vertical = { + -- mirror = false, + -- }, + -- width = 0.87, + -- height = 0.80, + -- preview_cutoff = 120, + -- }, + file_ignore_patterns = { "node_modules" }, + winblend = 0, + border = {}, + borderchars = { '─', '│', '─', '│', '┌', '┐', '┘', '└' }, + color_devicons = true, }, } |