tabs vs spaces

This commit is contained in:
Daniel Lundin 2022-01-09 22:42:43 +01:00
parent 6943f77d30
commit ffad55c60a

View file

@ -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", "", "<Plug>kommentary_line_default", {}) -- C-/
vim.api.nvim_set_keymap("v", "", "<Plug>kommentary_visual_default", {}) -- C-/
'b3nj5m1n/kommentary',
config = function()
require('kommentary.config').use_extended_mappings()
vim.api.nvim_set_keymap("n", "", "<Plug>kommentary_line_default", {}) -- C-/
vim.api.nvim_set_keymap("v", "", "<Plug>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 = {
['<C-p>'] = cmp.mapping(cmp.mapping.select_prev_item(), { 'i', 'c' }),
['<C-n>'] = cmp.mapping(cmp.mapping.select_next_item(), { 'i', 'c' }),
["<C-d>"] = cmp.mapping.scroll_docs(-4),
["<C-u>"] = cmp.mapping.scroll_docs(4),
['<C-e>'] = cmp.mapping({
i = cmp.mapping.abort(),
c = cmp.mapping.close(),
}),
['<CR>'] = cmp.mapping(cmp.mapping.confirm({ select = false }), { 'i', 'c' }),
['<C-y>'] = cmp.mapping(cmp.mapping.confirm({ select = false }), { 'i', 'c' }),
['<C-Space>'] = cmp.mapping(cmp.mapping.complete(), { 'i', 'c' }),
["<Tab>"] = 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" }),
["<S-Tab>"] = 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 = {
['<C-p>'] = cmp.mapping(cmp.mapping.select_prev_item(), { 'i', 'c' }),
['<C-n>'] = cmp.mapping(cmp.mapping.select_next_item(), { 'i', 'c' }),
["<C-d>"] = cmp.mapping.scroll_docs(-4),
["<C-u>"] = cmp.mapping.scroll_docs(4),
['<C-e>'] = cmp.mapping({
i = cmp.mapping.abort(),
c = cmp.mapping.close(),
}),
['<CR>'] = cmp.mapping(cmp.mapping.confirm({ select = false }), { 'i', 'c' }),
['<C-y>'] = cmp.mapping(cmp.mapping.confirm({ select = false }), { 'i', 'c' }),
['<C-Space>'] = cmp.mapping(cmp.mapping.complete(), { 'i', 'c' }),
["<Tab>"] = 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" }),
["<S-Tab>"] = 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 <Leader>c :lua require('go.comment').gen()<cr>")
vim.cmd("autocmd BufWritePre *.go :silent! lua require('go.format').gofmt()")
vim.cmd('autocmd BufWritePre (InsertLeave?) <buffer> 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 <Leader>c :lua require('go.comment').gen()<cr>")
vim.cmd("autocmd BufWritePre *.go :silent! lua require('go.format').gofmt()")
vim.cmd('autocmd BufWritePre (InsertLeave?) <buffer> 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)