Browse Source

nvim completions

master
Ivan Polyakov 2 years ago
parent
commit
a17bf71016
  1. 64
      .config/nvim/init.vim
  2. 18
      .config/nvim/lua/plugins.lua

64
.config/nvim/init.vim

@ -9,6 +9,8 @@ set cc=75 " show column ruler
set ts=4 set ts=4
set shiftwidth=4 set shiftwidth=4
set expandtab set expandtab
set scrolloff=2
set completeopt=menu,menuone,noselect
""" Colors """ Colors
syntax on syntax on
@ -63,33 +65,57 @@ let g:vimtex_syntax_conceal = {
\} \}
set conceallevel=2 set conceallevel=2
"" LSP
"" See: https://github.com/neovim/nvim-lspconfig/blob/master/doc/server_configurations.md
lua << EOF lua << EOF
-- LSP and completions --
-- Completions --
local cmp = require('cmp')
cmp.setup({
completion = { autocomplete = false },
snippet = {
expand = function (args)
require('snippy').expand_snippet(args.body)
end,
},
mapping = {
['<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 = 'snippy' }
})
})
-- LSP --
-- See: https://github.com/neovim/nvim-lspconfig/blob/master/doc/server_configurations.md
local lsp = require('lspconfig') local lsp = require('lspconfig')
local capabilities = require('cmp_nvim_lsp')
.update_capabilities(vim.lsp.protocol.make_client_capabilities())
lsp.clangd.setup { lsp.clangd.setup {
filetypes = { "c", "cpp", "cxx" } filetypes = { 'c', 'cpp', 'cxx' },
capabilities = capabilities
} }
lsp.eslint.setup{} lsp.eslint.setup {
capabilities = capabilities
}
lsp.sumneko_lua.setup { lsp.sumneko_lua.setup {
settings = { settings = {
Lua = { Lua = {
runtime = { runtime = { version = 'LuaJIT' },
version = 'LuaJIT', diagnostics = { globals = { 'vim' } },
}, workspace = {
diagnostics = { library = vim.api.nvim_get_runtime_file('', true),
globals = {'vim'}, },
}, telemetry = { enable = false },
workspace = { },
library = vim.api.nvim_get_runtime_file("", true),
},
telemetry = {
enable = false,
},
}, },
}, capabilities = capabilities,
} }
EOF EOF

18
.config/nvim/lua/plugins.lua

@ -1,31 +1,39 @@
return require('packer').startup(function() return require('packer').startup(function()
use 'wbthomason/packer.nvim' use 'wbthomason/packer.nvim'
-- Look and feel --
use 'shaunsingh/nord.nvim' use 'shaunsingh/nord.nvim'
use { use {
'nvim-lualine/lualine.nvim', 'nvim-lualine/lualine.nvim',
requires = { 'kyazdani42/nvim-web-devicons', opt = true } requires = { 'kyazdani42/nvim-web-devicons', opt = true }
} }
use 'preservim/nerdtree' use 'preservim/nerdtree'
use 'dcampos/nvim-snippy'
-- Snippets --
use 'dcampos/nvim-snippy'
use 'honza/vim-snippets' use 'honza/vim-snippets'
-- Languages --
use { use {
'lervag/vimtex', 'lervag/vimtex',
tag = 'v2.9', tag = 'v2.9',
ft = 'tex' ft = 'tex'
} }
use { use {
'digitaltoad/vim-pug', 'digitaltoad/vim-pug',
ft = {'pug', 'vue'} ft = {'pug', 'vue'}
} }
-- LSP and completions --
use 'neovim/nvim-lspconfig' use 'neovim/nvim-lspconfig'
use 'hrsh7th/nvim-cmp'
use 'hrsh7th/cmp-nvim-lsp'
use 'dcampos/cmp-snippy' -- Completions for snippets
use 'MunifTanjim/nui.nvim' -- Another tools --
use 'MunifTanjim/nui.nvim' -- UI framework
end) end)

Loading…
Cancel
Save