Browse Source

nvim completions

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

54
.config/nvim/init.vim

@ -9,6 +9,8 @@ set cc=75 " show column ruler @@ -9,6 +9,8 @@ set cc=75 " show column ruler
set ts=4
set shiftwidth=4
set expandtab
set scrolloff=2
set completeopt=menu,menuone,noselect
""" Colors
syntax on
@ -63,33 +65,57 @@ let g:vimtex_syntax_conceal = { @@ -63,33 +65,57 @@ let g:vimtex_syntax_conceal = {
\}
set conceallevel=2
"" LSP
"" See: https://github.com/neovim/nvim-lspconfig/blob/master/doc/server_configurations.md
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 capabilities = require('cmp_nvim_lsp')
.update_capabilities(vim.lsp.protocol.make_client_capabilities())
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 {
settings = {
Lua = {
runtime = {
version = 'LuaJIT',
},
diagnostics = {
globals = {'vim'},
},
runtime = { version = 'LuaJIT' },
diagnostics = { globals = { 'vim' } },
workspace = {
library = vim.api.nvim_get_runtime_file("", true),
},
telemetry = {
enable = false,
library = vim.api.nvim_get_runtime_file('', true),
},
telemetry = { enable = false },
},
},
capabilities = capabilities,
}
EOF

18
.config/nvim/lua/plugins.lua

@ -1,31 +1,39 @@ @@ -1,31 +1,39 @@
return require('packer').startup(function()
use 'wbthomason/packer.nvim'
-- Look and feel --
use 'shaunsingh/nord.nvim'
use {
'nvim-lualine/lualine.nvim',
requires = { 'kyazdani42/nvim-web-devicons', opt = true }
}
use 'preservim/nerdtree'
use 'dcampos/nvim-snippy'
-- Snippets --
use 'dcampos/nvim-snippy'
use 'honza/vim-snippets'
-- Languages --
use {
'lervag/vimtex',
tag = 'v2.9',
ft = 'tex'
}
use {
'digitaltoad/vim-pug',
ft = {'pug', 'vue'}
}
-- LSP and completions --
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)

Loading…
Cancel
Save