Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions neovim/init.lua
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
require("basics")
require("keymaps")
require("plugins")
require('lsp')
5 changes: 5 additions & 0 deletions neovim/lua/lsp.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
vim.lsp.config('*', {
capabilities = require('cmp_nvim_lsp').default_capabilities(),
})

vim.lsp.enable("gopls")
59 changes: 59 additions & 0 deletions neovim/lua/plugins.lua
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,16 @@ vim.call('plug#begin')

Plug("Shougo/vimproc.vim", { ["do"] = "make" })

-- LSP & completion
Plug("neovim/nvim-lspconfig")
Plug 'hrsh7th/cmp-nvim-lsp'
Plug 'hrsh7th/cmp-buffer'
Plug 'hrsh7th/cmp-path'
Plug 'hrsh7th/cmp-cmdline'
Plug 'hrsh7th/nvim-cmp'
Plug 'hrsh7th/cmp-vsnip'
Plug 'hrsh7th/vim-vsnip'

-- filer
Plug("vifm/vifm.vim")
Plug("scrooloose/nerdtree")
Expand Down Expand Up @@ -51,6 +61,55 @@ Plug("tyru/open-browser-github.vim")

vim.call("plug#end")

-- configs of nvim-cmp {{{
local cmp = require'cmp'

cmp.setup({
snippet = {
-- REQUIRED - you must specify a snippet engine
expand = function(args)
vim.fn["vsnip#anonymous"](args.body) -- For `vsnip` users.
end,
},
window = {
completion = cmp.config.window.bordered(),
documentation = cmp.config.window.bordered(),
},
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 }), -- Accept currently selected item. Set `select` to `false` to only confirm explicitly selected items.
}),
sources = cmp.config.sources({
{ name = 'nvim_lsp' },
{ name = 'vsnip' }, -- For vsnip users.
}, {
{ name = 'buffer' },
})
})

-- Use buffer source for `/` and `?` (if you enabled `native_menu`, this won't work anymore).
cmp.setup.cmdline({ '/', '?' }, {
mapping = cmp.mapping.preset.cmdline(),
sources = {
{ name = 'buffer' }
}
})

-- Use cmdline & path source for ':' (if you enabled `native_menu`, this won't work anymore).
cmp.setup.cmdline(':', {
mapping = cmp.mapping.preset.cmdline(),
sources = cmp.config.sources({
{ name = 'path' }
}, {
{ name = 'cmdline' }
}),
matching = { disallow_symbol_nonprefix_matching = false }
})
-- }}}

-- configs of nerdtree {{{
map({ "n", "v", "o" }, "<C-e>", "<cmd>NERDTreeToggle<CR>", { noremap = true })
map({ "n", "v", "o" }, "<C-t>", "<cmd>NERDTreeFind<CR>", { noremap = true })
Expand Down
Loading