Starts moving nvim config to lua
This commit is contained in:
parent
b039bf70fd
commit
954642753f
53 changed files with 548 additions and 541 deletions
107
nvim/.config/nvim/lua/plugins/cmp.lua
Normal file
107
nvim/.config/nvim/lua/plugins/cmp.lua
Normal file
|
@ -0,0 +1,107 @@
|
|||
return {{
|
||||
"neovim/nvim-lspconfig",
|
||||
dependencies={
|
||||
"hrsh7th/cmp-nvim-lsp",
|
||||
},
|
||||
config=function()
|
||||
local servers = { 'lua_ls', 'vimls', 'bashls', 'vale_ls' }
|
||||
local capabilities = require('cmp_nvim_lsp').default_capabilities()
|
||||
for _, lsp in ipairs(servers) do
|
||||
require('lspconfig')[lsp].setup {
|
||||
capabilities = capabilities,
|
||||
}
|
||||
end
|
||||
|
||||
|
||||
-- Use LspAttach autocommand to only map the following keys
|
||||
-- after the language server attaches to the current buffer
|
||||
vim.api.nvim_create_autocmd('LspAttach', {
|
||||
group = vim.api.nvim_create_augroup('UserLspConfig', {}),
|
||||
callback = function(ev)
|
||||
-- Enable completion triggered by <c-x><c-o>
|
||||
vim.bo[ev.buf].omnifunc = 'v:lua.vim.lsp.omnifunc'
|
||||
|
||||
-- Buffer local mappings.
|
||||
-- See `:help vim.lsp.*` for documentation on any of the below functions
|
||||
local opts = { buffer = ev.buf }
|
||||
vim.keymap.set('n', 'gD', vim.lsp.buf.declaration, opts)
|
||||
vim.keymap.set('n', 'gd', vim.lsp.buf.definition, opts)
|
||||
vim.keymap.set('n', 'K', vim.lsp.buf.hover, opts)
|
||||
vim.keymap.set('n', 'gi', vim.lsp.buf.implementation, opts)
|
||||
vim.keymap.set('n', '<C-k>', vim.lsp.buf.signature_help, opts)
|
||||
vim.keymap.set('n', '<space>wa', vim.lsp.buf.add_workspace_folder, opts)
|
||||
vim.keymap.set('n', '<space>wr', vim.lsp.buf.remove_workspace_folder, opts)
|
||||
vim.keymap.set('n', '<space>wl', function()
|
||||
print(vim.inspect(vim.lsp.buf.list_workspace_folders()))
|
||||
end, opts)
|
||||
vim.keymap.set('n', '<space>D', vim.lsp.buf.type_definition, opts)
|
||||
vim.keymap.set('n', '<space>rn', vim.lsp.buf.rename, opts)
|
||||
vim.keymap.set({ 'n', 'v' }, '<space>ca', vim.lsp.buf.code_action, opts)
|
||||
vim.keymap.set('n', 'gr', vim.lsp.buf.references, opts)
|
||||
--vim.keymap.set('n', '<space>f', function()
|
||||
-- vim.lsp.buf.format { async = true }
|
||||
--end, opts)
|
||||
end,
|
||||
})
|
||||
|
||||
end,
|
||||
--},{
|
||||
-- "L3MON4D3/LuaSnip",
|
||||
-- dependencies={
|
||||
-- "saadparwaiz1/cmp_luasnip",
|
||||
-- "rafamadriz/friendly-snippets"
|
||||
-- },
|
||||
-- config=function ()
|
||||
-- require("luasnip.loaders.from_vscode").lazy_load()
|
||||
-- end,
|
||||
-- keys = {
|
||||
-- { "<tab>", function ()
|
||||
-- return require("luasnip").jumpable(1) and "<Plug>luasnip-jump-next" or "<tab>"
|
||||
-- end, expr = true, silent = true, mode = "i"
|
||||
-- },
|
||||
-- { "<tab>", function() require("luasnip").jump(1) end, mode = "s" },
|
||||
-- { "<s-tab>", function() require("luasnip").jump(-1) end, mode = { "i", "s" } },
|
||||
-- }
|
||||
},{
|
||||
"hrsh7th/nvim-cmp",
|
||||
dependencies={
|
||||
"neovim/nvim-lspconfig",
|
||||
--"L3MON4D3/LuaSnip",
|
||||
"saadparwaiz1/cmp_luasnip",
|
||||
"hrsh7th/cmp-buffer",
|
||||
"hrsh7th/cmp-path",
|
||||
"hrsh7th/cmp-cmdline",
|
||||
},
|
||||
opts=function()
|
||||
local cmp = require("cmp")
|
||||
local capabilities = require('cmp_nvim_lsp').default_capabilities()
|
||||
|
||||
return {
|
||||
snippet = {
|
||||
-- REQUIRED - you must specify a snippet engine
|
||||
expand = function(args)
|
||||
--vim.fn["vsnip#anonymous"](args.body) -- For `vsnip` users.
|
||||
require('luasnip').lsp_expand(args.body) -- For `luasnip` users.
|
||||
-- require('snippy').expand_snippet(args.body) -- For `snippy` users.
|
||||
-- vim.fn["UltiSnips#Anon"](args.body) -- For `ultisnips` users.
|
||||
end,
|
||||
},
|
||||
mapping = cmp.mapping.preset.insert({
|
||||
['<C-b>'] = cmp.mapping.scroll_docs(-4),
|
||||
['<C-f>'] = cmp.mapping.scroll_docs(4),
|
||||
['<C-Space>'] = cmp.mapping.complete(),
|
||||
['<C-e>'] = cmp.mapping.abort(),
|
||||
['<CR>'] = cmp.mapping.confirm({ select = true }),
|
||||
}),
|
||||
sources = cmp.config.sources({
|
||||
{ name = "nvim_lsp" },
|
||||
{ name = "luasnip" },
|
||||
{ name = "path" },
|
||||
{ name = "buffer" }
|
||||
})
|
||||
}
|
||||
end
|
||||
}}
|
||||
|
||||
|
||||
|
25
nvim/.config/nvim/lua/plugins/fzf.lua
Normal file
25
nvim/.config/nvim/lua/plugins/fzf.lua
Normal file
|
@ -0,0 +1,25 @@
|
|||
return{ {
|
||||
"junegunn/fzf.vim",
|
||||
dependencies="junegunn/fzf",
|
||||
init = function( lazy )
|
||||
vim.g.fzf_command_prefix="Fzf"
|
||||
end,
|
||||
config = function( lazy, opts)
|
||||
vim.g.fzf_layout = {
|
||||
window = {
|
||||
width= 0.9,
|
||||
height=0.8
|
||||
}
|
||||
}
|
||||
|
||||
vim.keymap.set('n', '<leader>f', ':FzfFiles<cr>', {desc="Fuzzy find files"})
|
||||
vim.keymap.set('n', '<leader>b', ':FzfBuffers<cr>', {desc="Fuzzy find buffers"})
|
||||
vim.keymap.set('n', '<leader>h', ':FzfHelptags<cr>', {desc="Fuzzy find help tags"})
|
||||
vim.keymap.set('n', '<leader>/', ':FzfRg ', {desc="Fuzzy find RG"})
|
||||
vim.keymap.set('n', '\\/', ':FzfRg ^#<cr> ', {desc="Fuzzy find headings"})
|
||||
|
||||
end
|
||||
} }
|
||||
|
||||
|
||||
|
21
nvim/.config/nvim/lua/plugins/gruvbox.lua
Normal file
21
nvim/.config/nvim/lua/plugins/gruvbox.lua
Normal file
|
@ -0,0 +1,21 @@
|
|||
return {{
|
||||
"ellisonleao/gruvbox.nvim",
|
||||
lazy = false,
|
||||
priority=1000,
|
||||
opts={
|
||||
terminal_colors = true,
|
||||
italic = {
|
||||
strings = false,
|
||||
emphasis = false,
|
||||
comments = true,
|
||||
operators = false,
|
||||
folds = true,
|
||||
}
|
||||
}
|
||||
}}
|
||||
|
||||
-- Colourscheme settings
|
||||
-- vim.g.gruvbox_italic=1
|
||||
-- vim.g.gruvbox_hls_cursor="red"
|
||||
-- vim.opt.termguicolors=true
|
||||
--vim.cmd('colorscheme gruvbox')
|
3
nvim/.config/nvim/lua/plugins/init.lua
Normal file
3
nvim/.config/nvim/lua/plugins/init.lua
Normal file
|
@ -0,0 +1,3 @@
|
|||
return { {
|
||||
"tpope/vim-fugitive"
|
||||
} }
|
4
nvim/.config/nvim/lua/plugins/surround.lua
Normal file
4
nvim/.config/nvim/lua/plugins/surround.lua
Normal file
|
@ -0,0 +1,4 @@
|
|||
return {{
|
||||
"kylechui/nvim-surround",
|
||||
opts={}
|
||||
}}
|
14
nvim/.config/nvim/lua/plugins/treesitter.lua
Normal file
14
nvim/.config/nvim/lua/plugins/treesitter.lua
Normal file
|
@ -0,0 +1,14 @@
|
|||
return {{
|
||||
"nvim-treesitter/nvim-treesitter",
|
||||
build = ":TSUpdate",
|
||||
opts = {
|
||||
ensure_installed = "all",
|
||||
highlight = {
|
||||
enable = true
|
||||
},
|
||||
indent = {
|
||||
enable = true
|
||||
}
|
||||
}
|
||||
|
||||
}}
|
11
nvim/.config/nvim/lua/plugins/ultimate-autopair.lua
Normal file
11
nvim/.config/nvim/lua/plugins/ultimate-autopair.lua
Normal file
|
@ -0,0 +1,11 @@
|
|||
return {{
|
||||
'altermo/ultimate-autopair.nvim',
|
||||
event={'InsertEnter','CmdlineEnter'},
|
||||
branch='v0.6', --recomended as each new version will have breaking changes
|
||||
opts={
|
||||
tabout={
|
||||
enable=true
|
||||
}
|
||||
},
|
||||
}}
|
||||
|
Loading…
Add table
Add a link
Reference in a new issue