diff --git a/config/nvim/lua/file-tree.lua b/config/nvim/lua/file-tree.lua index 3283b91..fccc3a8 100644 --- a/config/nvim/lua/file-tree.lua +++ b/config/nvim/lua/file-tree.lua @@ -2,24 +2,12 @@ require("nvim-tree").setup({ open_on_setup = true, hijack_cursor = true, update_cwd = true, - update_focused_file = { - enable = true - }, - view = { - width = 30, - side = "left", - auto_resize = true - }, - filters = { - custom = { ".git" } - } + update_focused_file = { enable = true }, + view = { width = 30, side = "left", auto_resize = true }, + filters = { custom = { ".git" } } }) vim.g.nvim_tree_add_trailing = 1 vim.g.nvim_tree_indent_markers = 1 -vim.g.nvim_tree_show_icons = { - git = 0, - folders = 0, - files = 0, - folder_arrows = 0 -} + +vim.g.nvim_tree_show_icons = { git = 0, folders = 0, files = 0, folder_arrows = 0 } diff --git a/config/nvim/lua/general.lua b/config/nvim/lua/general.lua index 1aff96b..7918345 100644 --- a/config/nvim/lua/general.lua +++ b/config/nvim/lua/general.lua @@ -32,6 +32,6 @@ vim.api.nvim_exec([[ ]], false) -- Automatically formatting buffer on save -vim.api.nvim_command("autocmd BufWritePre * lua vim.lsp.buf.formatting_sync()") +vim.api.nvim_command("autocmd BufWritePre * lua vim.lsp.buf.formatting_sync(nil, 100)") vim.cmd('command! ToggleBackground lua require("utils").toggleBackground()') diff --git a/config/nvim/lua/lsp.lua b/config/nvim/lua/lsp.lua index 1c3b4db..d3c82c4 100644 --- a/config/nvim/lua/lsp.lua +++ b/config/nvim/lua/lsp.lua @@ -45,50 +45,64 @@ cmp.setup({ [''] = cmp.mapping.select_prev_item({ behavior = cmp.SelectBehavior.Select }), [''] = cmp.mapping.confirm({ behavior = cmp.SelectBehavior.Insert }) }, - sources = { - { name = "nvim_lsp" }, - { name = "luasnip" }, - { name = "nvim_lua" }, - { name = "path" }, - { name = "buffer", keyword_length = 5 } - }, - completion = { - completeopt = "menu,menuone,noselect,noinsert" - }, + sources = { { name = "nvim_lsp" }, { name = "luasnip" }, { name = "nvim_lua" }, { name = "path" }, { name = "buffer", keyword_length = 5 } }, + completion = { completeopt = "menu,menuone,noselect,noinsert" }, formatting = { format = function(entry, vim_item) vim_item.kind = string.format('%s %s', kind_icons[vim_item.kind], vim_item.kind) - vim_item.menu = ({ - buffer = "[Buffer]", - nvim_lsp = "[LSP]", - luasnip = "[Snippet]", - nvim_lua = "[Lua]", - path = "[File]" - })[entry.source.name] + vim_item.menu = ({ buffer = "[Buffer]", nvim_lsp = "[LSP]", luasnip = "[Snippet]", nvim_lua = "[Lua]", path = "[File]" })[entry.source.name] return vim_item end }, - experimental = { - ghost_text = true - }, - documentation = { - border = { "╭", "─", "╮", "│", "╯", "─", "╰", "│" }, - }, - sorting = { - comparators = cmp.config.compare.recently_used - } + experimental = { ghost_text = true }, + documentation = { border = { "╭", "─", "╮", "│", "╯", "─", "╰", "│" } }, + sorting = { comparators = cmp.config.compare.recently_used } }) local capabilities = require("cmp_nvim_lsp").update_capabilities(vim.lsp.protocol.make_client_capabilities()) lsp_installer.on_server_ready(function(server) - local opts = { - capabilities = capabilities - } + local opts = { capabilities = capabilities } - require("lsp_signature").setup({ - bind = true, - }) + if server.name == "sumneko_lua" then + opts = { + capabilities = capabilities, + settings = { + Lua = { + runtime = { version = "LuaJIT", path = vim.split(package.path, ";") }, + diagnostics = { globals = { "vim" } }, + workspace = { + library = { + [vim.fn.expand("$VIMRUNTIME/lua")] = true, + [vim.fn.expand("$VIMRUNTIME/lua/vim/lsp")] = true, + [vim.fn.expand("$HOME/.local/share/nvim/site/pack/packer/start")] = true + } + } + } + } + } + end + + if server.name == "efm" then + opts = { + capabilities = capabilities, + init_options = { documentFormatting = true }, + filetypes = { "lua" }, + settings = { + rootMarkers = { ".git/" }, + languages = { + lua = { + { + formatCommand = "lua-format -i --no-keep-simple-function-one-line --no-break-after-operator --column-limit=150 --break-after-table-lb --tab-width 2 --indent-width 2 --spaces-inside-table-braces", + formatStdin = true + } + } + } + } + } + end + + require("lsp_signature").setup({ bind = true }) server:setup(opts) end) diff --git a/config/nvim/lua/plugins-setup.lua b/config/nvim/lua/plugins-setup.lua index c02cc69..f4ddd17 100644 --- a/config/nvim/lua/plugins-setup.lua +++ b/config/nvim/lua/plugins-setup.lua @@ -11,11 +11,7 @@ require("colorizer").setup() -- Git require("gitsigns").setup({ current_line_blame = true, - current_line_blame_opts = { - virt_text = true, - virt_text_pos = "eol", - delay = 500 - }, + current_line_blame_opts = { virt_text = true, virt_text_pos = "eol", delay = 500 }, keymaps = { noremap = true, ["n gs"] = 'lua require("gitsigns").stage_hunk()', @@ -24,9 +20,6 @@ require("gitsigns").setup({ } }) -require("iswap").setup({ - keys = "1234567890", - autoswap = true -}) +require("iswap").setup({ keys = "1234567890", autoswap = true }) require("focus").setup() diff --git a/config/nvim/lua/plugins.lua b/config/nvim/lua/plugins.lua index 7dbaa8c..c20a1dc 100644 --- a/config/nvim/lua/plugins.lua +++ b/config/nvim/lua/plugins.lua @@ -10,12 +10,18 @@ return require("packer").startup(function(use) use({ "windwp/nvim-ts-autotag" }) use({ "JoosepAlviste/nvim-ts-context-commentstring" }) use({ "nvim-treesitter/playground" }) - use({ "folke/twilight.nvim", config = function() - require("twilight").setup({}) - end }) - use({ "folke/zen-mode.nvim", config = function() - require("zen-mode").setup({}) - end }) + use({ + "folke/twilight.nvim", + config = function() + require("twilight").setup({}) + end + }) + use({ + "folke/zen-mode.nvim", + config = function() + require("zen-mode").setup({}) + end + }) -- Make commenting code great use({ "tpope/vim-commentary" }) @@ -32,14 +38,12 @@ return require("packer").startup(function(use) -- LSP use({ "neovim/nvim-lspconfig", "williamboman/nvim-lsp-installer", "onsails/lspkind-nvim" }) - use({ "hrsh7th/nvim-cmp", requires = { - "hrsh7th/cmp-nvim-lsp", - "hrsh7th/cmp-buffer", - "hrsh7th/cmp-path", - "hrsh7th/cmp-cmdline", - "hrsh7th/cmp-nvim-lua", - "saadparwaiz1/cmp_luasnip" - }}) + use({ + "hrsh7th/nvim-cmp", + requires = { + "hrsh7th/cmp-nvim-lsp", "hrsh7th/cmp-buffer", "hrsh7th/cmp-path", "hrsh7th/cmp-cmdline", "hrsh7th/cmp-nvim-lua", "saadparwaiz1/cmp_luasnip" + } + }) -- Snippets use({ "L3MON4D3/LuaSnip" }) @@ -71,19 +75,16 @@ return require("packer").startup(function(use) -- Show indent lines use({ "lukas-reineke/indent-blankline.nvim", - config = function () + config = function() vim.cmd("let g:indent_blankline_filetype_exclude = ['help']") - require("indent_blankline").setup({ - char = "|", - buftype_exclude = { "terminal" }, - }) + require("indent_blankline").setup({ char = "|", buftype_exclude = { "terminal" } }) end }) -- Fast movement use({ "ggandor/lightspeed.nvim", - config = function () + config = function() require("lightspeed").setup() end }) diff --git a/config/nvim/lua/snippets.lua b/config/nvim/lua/snippets.lua index 2431d01..83f224b 100644 --- a/config/nvim/lua/snippets.lua +++ b/config/nvim/lua/snippets.lua @@ -4,7 +4,7 @@ local ls = require("luasnip") ls.config.set_config({ history = true, -- Update more often, :h events for more info. - updateevents = "TextChanged,TextChangedI", + updateevents = "TextChanged,TextChangedI" }) require("luasnip/loaders/from_vscode").lazy_load() diff --git a/config/nvim/lua/telescope-config.lua b/config/nvim/lua/telescope-config.lua index e7563ff..06c627c 100644 --- a/config/nvim/lua/telescope-config.lua +++ b/config/nvim/lua/telescope-config.lua @@ -1,6 +1,2 @@ -require("telescope").setup({ - defaults = { - sorting_strategy = "ascending", - file_ignore_patterns = { ".git", "node_modules" } - } -}) + +require("telescope").setup({ defaults = { sorting_strategy = "ascending", file_ignore_patterns = { ".git", "node_modules" } } }) diff --git a/config/nvim/lua/treesitter.lua b/config/nvim/lua/treesitter.lua index a916bae..a125dbc 100644 --- a/config/nvim/lua/treesitter.lua +++ b/config/nvim/lua/treesitter.lua @@ -1,16 +1,6 @@ require("nvim-treesitter.configs").setup({ - highlight = { - enable = true - }, - rainbow = { - enable = true, - extended_mode = true, - disable = { "html" } - }, - autotag = { - enable = true - }, - context_commentstring = { - enable = true - } + highlight = { enable = true }, + rainbow = { enable = true, extended_mode = true, disable = { "html" } }, + autotag = { enable = true }, + context_commentstring = { enable = true } }) diff --git a/config/nvim/lua/utils.lua b/config/nvim/lua/utils.lua index 652968a..a275432 100644 --- a/config/nvim/lua/utils.lua +++ b/config/nvim/lua/utils.lua @@ -1,6 +1,6 @@ local M = {} -M.toggleBackground = function () +M.toggleBackground = function() if vim.opt.background:get() == "dark" then vim.opt.background = "light" else