From ffad55c60a2ec2068d8bdbd071ebac3ad2795878 Mon Sep 17 00:00:00 2001 From: Daniel Lundin Date: Sun, 9 Jan 2022 22:42:43 +0100 Subject: [PATCH] tabs vs spaces --- .config/nvim/lua/plugins.lua | 318 +++++++++++++++++------------------ 1 file changed, 158 insertions(+), 160 deletions(-) diff --git a/.config/nvim/lua/plugins.lua b/.config/nvim/lua/plugins.lua index c684168..f3d7eac 100644 --- a/.config/nvim/lua/plugins.lua +++ b/.config/nvim/lua/plugins.lua @@ -3,158 +3,156 @@ return require('packer').startup(function() use 'pierreglaser/folding-nvim' use 'tjdevries/colorbuddy.vim' use 'wbthomason/packer.nvim' - use 'ray-x/lsp_signature.nvim' - use 'jose-elias-alvarez/nvim-lsp-ts-utils' - use 'rafamadriz/friendly-snippets' + use 'ray-x/lsp_signature.nvim' + use 'jose-elias-alvarez/nvim-lsp-ts-utils' + use 'rafamadriz/friendly-snippets' use { - 'b3nj5m1n/kommentary', - config = function() - require('kommentary.config').use_extended_mappings() - vim.api.nvim_set_keymap("n", "", "kommentary_line_default", {}) -- C-/ - vim.api.nvim_set_keymap("v", "", "kommentary_visual_default", {}) -- C-/ + 'b3nj5m1n/kommentary', + config = function() + require('kommentary.config').use_extended_mappings() + vim.api.nvim_set_keymap("n", "", "kommentary_line_default", {}) -- C-/ + vim.api.nvim_set_keymap("v", "", "kommentary_visual_default", {}) -- C-/ - require('kommentary.config').configure_language("default", { - prefer_single_line_comments = true, - }) - end + require('kommentary.config').configure_language("default", { + prefer_single_line_comments = true, + }) + end } - use { - 'L3MON4D3/LuaSnip', - config = function() - require("luasnip/loaders/from_vscode").lazy_load() - end - } + use { + 'L3MON4D3/LuaSnip', + config = function() + require("luasnip/loaders/from_vscode").lazy_load() + end + } use { - 'hrsh7th/nvim-cmp', - requires = { - 'andersevenrud/cmp-tmux', - 'hrsh7th/cmp-nvim-lsp', - 'hrsh7th/cmp-buffer', - 'hrsh7th/cmp-path', - 'hrsh7th/cmp-cmdline', - 'L3MON4D3/LuaSnip', - 'saadparwaiz1/cmp_luasnip', - }, - config = function() - local cmp = require'cmp' - local luasnip = require'luasnip' + 'hrsh7th/nvim-cmp', + requires = { + 'andersevenrud/cmp-tmux', + 'hrsh7th/cmp-nvim-lsp', + 'hrsh7th/cmp-buffer', + 'hrsh7th/cmp-path', + 'hrsh7th/cmp-cmdline', + 'L3MON4D3/LuaSnip', + 'saadparwaiz1/cmp_luasnip', + }, + config = function() + local cmp = require'cmp' + local luasnip = require'luasnip' - local has_words_before = function() - local line, col = unpack(vim.api.nvim_win_get_cursor(0)) - return col ~= 0 and vim.api.nvim_buf_get_lines(0, line - 1, line, true)[1]:sub(col, col):match('%s') == nil - end + local has_words_before = function() + local line, col = unpack(vim.api.nvim_win_get_cursor(0)) + return col ~= 0 and vim.api.nvim_buf_get_lines(0, line - 1, line, true)[1]:sub(col, col):match('%s') == nil + end - cmp.setup({ + cmp.setup({ - formatting = { - format = require('lspkind').cmp_format({ - with_text = true, - menu = { - buffer = "[Buffer]", - tmux = "[Tmux]", - luasnip = "[LuaSnip]", - nvim_lsp = "[LSP]", - nvim_lua = "[Lua]", - path = "[Path]", - }, - }), - }, + formatting = { + format = require('lspkind').cmp_format({ + with_text = true, + menu = { + buffer = "[Buffer]", + tmux = "[Tmux]", + luasnip = "[LuaSnip]", + nvim_lsp = "[LSP]", + nvim_lua = "[Lua]", + path = "[Path]", + }, + }), + }, - documentation = { - border = 'rounded' - }, + documentation = { + border = 'rounded' + }, + snippet = { + expand = function(args) + luasnip.lsp_expand(args.body) + end, + }, - snippet = { - expand = function(args) - luasnip.lsp_expand(args.body) - end, - }, + mapping = { + [''] = cmp.mapping(cmp.mapping.select_prev_item(), { 'i', 'c' }), + [''] = cmp.mapping(cmp.mapping.select_next_item(), { 'i', 'c' }), + [""] = cmp.mapping.scroll_docs(-4), + [""] = cmp.mapping.scroll_docs(4), + [''] = cmp.mapping({ + i = cmp.mapping.abort(), + c = cmp.mapping.close(), + }), + [''] = cmp.mapping(cmp.mapping.confirm({ select = false }), { 'i', 'c' }), + [''] = cmp.mapping(cmp.mapping.confirm({ select = false }), { 'i', 'c' }), + [''] = cmp.mapping(cmp.mapping.complete(), { 'i', 'c' }), + [""] = cmp.mapping(function(fallback) + if cmp.visible() then + cmp.select_next_item() + elseif luasnip.expand_or_locally_jumpable() then + luasnip.expand_or_jump() + elseif has_words_before() then + cmp.complete() + else + fallback() + end + end, { "i", "s" }), + [""] = cmp.mapping(function(fallback) + if cmp.visible() then + cmp.select_prev_item() + elseif luasnip.jumpable(-1) then + luasnip.jump(-1) + else + fallback() + end + end, { "i", "s" }), + }, + sources = cmp.config.sources({ + { + name = 'buffer', + priority = 1, - mapping = { - [''] = cmp.mapping(cmp.mapping.select_prev_item(), { 'i', 'c' }), - [''] = cmp.mapping(cmp.mapping.select_next_item(), { 'i', 'c' }), - [""] = cmp.mapping.scroll_docs(-4), - [""] = cmp.mapping.scroll_docs(4), - [''] = cmp.mapping({ - i = cmp.mapping.abort(), - c = cmp.mapping.close(), - }), - [''] = cmp.mapping(cmp.mapping.confirm({ select = false }), { 'i', 'c' }), - [''] = cmp.mapping(cmp.mapping.confirm({ select = false }), { 'i', 'c' }), - [''] = cmp.mapping(cmp.mapping.complete(), { 'i', 'c' }), - [""] = cmp.mapping(function(fallback) - if cmp.visible() then - cmp.select_next_item() - elseif luasnip.expand_or_locally_jumpable() then - luasnip.expand_or_jump() - elseif has_words_before() then - cmp.complete() - else - fallback() - end - end, { "i", "s" }), - [""] = cmp.mapping(function(fallback) - if cmp.visible() then - cmp.select_prev_item() - elseif luasnip.jumpable(-1) then - luasnip.jump(-1) - else - fallback() - end - end, { "i", "s" }), - }, + }, + { + name = 'luasnip', + priority = 4, + }, + { + name = 'tmux', + priority = 2, + option = { + all_panes = true, + trigger_characters = {}, + } + }, + { + name = 'nvim_lsp', + priority = 3, + }, + }) + }) - sources = cmp.config.sources({ - { - name = 'buffer', - priority = 1, - - }, - { - name = 'luasnip', - priority = 4, - }, - { - name = 'tmux', - priority = 2, - option = { - all_panes = true, - trigger_characters = {}, - } - }, - { - name = 'nvim_lsp', - priority = 3, - }, - }) - }) - - end - } + end + } use { - 'lewis6991/gitsigns.nvim', - requires = { - 'nvim-lua/plenary.nvim' - }, - config = function() - require('gitsigns').setup { - numhl = true, - signs = { - add = {hl = 'GitSignsAdd' , text = '▌', numhl='GitSignsAddNr' , linehl='GitSignsAddLn'}, - change = {hl = 'GitSignsChange', text = '▌', numhl='GitSignsChangeNr', linehl='GitSignsChangeLn'}, - delete = {hl = 'GitSignsDelete', text = '▖', numhl='GitSignsDeleteNr', linehl='GitSignsDeleteLn'}, - topdelete = {hl = 'GitSignsDelete', text = '▘', numhl='GitSignsDeleteNr', linehl='GitSignsDeleteLn'}, - changedelete = {hl = 'GitSignsChange', text = '~', numhl='GitSignsChangeNr', linehl='GitSignsChangeLn'}, - }, - } - end + 'lewis6991/gitsigns.nvim', + requires = { + 'nvim-lua/plenary.nvim' + }, + config = function() + require('gitsigns').setup { + numhl = true, + signs = { + add = {hl = 'GitSignsAdd' , text = '▌', numhl='GitSignsAddNr' , linehl='GitSignsAddLn'}, + change = {hl = 'GitSignsChange', text = '▌', numhl='GitSignsChangeNr', linehl='GitSignsChangeLn'}, + delete = {hl = 'GitSignsDelete', text = '▖', numhl='GitSignsDeleteNr', linehl='GitSignsDeleteLn'}, + topdelete = {hl = 'GitSignsDelete', text = '▘', numhl='GitSignsDeleteNr', linehl='GitSignsDeleteLn'}, + changedelete = {hl = 'GitSignsChange', text = '~', numhl='GitSignsChangeNr', linehl='GitSignsChangeLn'}, + }, + } + end } use { @@ -238,24 +236,24 @@ return require('packer').startup(function() end } - use { - "ray-x/go.nvim", - config = function() - require('go').setup({ - comment_placeholder = '' - }) - vim.cmd("autocmd FileType go nmap c :lua require('go.comment').gen()") - vim.cmd("autocmd BufWritePre *.go :silent! lua require('go.format').gofmt()") - vim.cmd('autocmd BufWritePre (InsertLeave?) lua vim.lsp.buf.formatting_sync(nil,500)') - end - } + use { + "ray-x/go.nvim", + config = function() + require('go').setup({ + comment_placeholder = '' + }) + vim.cmd("autocmd FileType go nmap c :lua require('go.comment').gen()") + vim.cmd("autocmd BufWritePre *.go :silent! lua require('go.format').gofmt()") + vim.cmd('autocmd BufWritePre (InsertLeave?) lua vim.lsp.buf.formatting_sync(nil,500)') + end + } use { - "onsails/lspkind-nvim", - config = function() - require('lspkind').init({ - }) - end + "onsails/lspkind-nvim", + config = function() + require('lspkind').init({ + }) + end } use { @@ -266,15 +264,15 @@ return require('packer').startup(function() end } - -- use { - -- "cuducos/yaml.nvim", - -- ft = {"yaml"}, - -- requires = { - -- "nvim-treesitter/nvim-treesitter", - -- -- "nvim-telescope/telescope.nvim" -- optional - -- }, - -- config = function () - -- require("yaml_nvim").init() - -- end - -- } + -- use { + -- "cuducos/yaml.nvim", + -- ft = {"yaml"}, + -- requires = { + -- "nvim-treesitter/nvim-treesitter", + -- -- "nvim-telescope/telescope.nvim" -- optional + -- }, + -- config = function () + -- require("yaml_nvim").init() + -- end + -- } end)