Make snippets work
This commit is contained in:
parent
2f3d55d578
commit
f0a4e0da61
|
@ -1,6 +1,7 @@
|
|||
require('packer').startup(function()
|
||||
require('packer').startup(function(use)
|
||||
use 'ConradIrwin/vim-bracketed-paste'
|
||||
use 'cappyzawa/trim.nvim'
|
||||
use "rafamadriz/friendly-snippets"
|
||||
use 'christoomey/vim-tmux-navigator'
|
||||
use 'cohama/lexima.vim'
|
||||
use 'editorconfig/editorconfig-vim'
|
||||
|
@ -9,6 +10,7 @@ require('packer').startup(function()
|
|||
use 'hrsh7th/cmp-cmdline'
|
||||
use 'hrsh7th/cmp-nvim-lsp'
|
||||
use 'hrsh7th/cmp-path'
|
||||
use 'hrsh7th/vim-vsnip-integ'
|
||||
use 'hrsh7th/cmp-vsnip'
|
||||
use 'hrsh7th/nvim-cmp'
|
||||
use 'hrsh7th/vim-vsnip'
|
||||
|
@ -29,13 +31,21 @@ require('packer').startup(function()
|
|||
use {'nvim-telescope/telescope-fzf-native.nvim', run = 'cmake -S. -Bbuild -DCMAKE_BUILD_TYPE=Release && cmake --build build --config Release && cmake --install build --prefix build'}
|
||||
use {'nvim-telescope/telescope.nvim', requires = {{'nvim-lua/plenary.nvim'}}}
|
||||
use {'nvim-treesitter/nvim-treesitter', run = ':TSUpdate'}
|
||||
use {'glacambre/firenvim', run = function() vim.fn['firenvim#install'](0) end}
|
||||
end)
|
||||
|
||||
require('settings')
|
||||
require('mappings')
|
||||
require('lsp_config')
|
||||
require('telescope-config')
|
||||
require('trim').setup({disable = {"markdown", "vimwiki"}})
|
||||
require('trim').setup({
|
||||
disable = {"markdown", "vimwiki"},
|
||||
patterns = {
|
||||
[[%s/\s\+$//e]], -- remove unwanted spaces
|
||||
[[%s/\($\n\s*\)\+\%$//]], -- trim last line
|
||||
[[%s/\%^\n\+//]], -- trim first line
|
||||
},
|
||||
})
|
||||
|
||||
vim.cmd("colorscheme hybrid_material")
|
||||
vim.api.nvim_create_autocmd("FileType", { pattern = "make", command = [[set tabstop=8 shiftwidth=8 softtabstop=0 noexpandtab]] })
|
||||
|
|
|
@ -1,6 +1,10 @@
|
|||
-- Setup nvim-cmp.lsp
|
||||
local cmp = require'cmp'
|
||||
|
||||
local feedkey = function(key, mode)
|
||||
vim.api.nvim_feedkeys(vim.api.nvim_replace_termcodes(key, true, true, true), mode, true)
|
||||
end
|
||||
|
||||
cmp.setup({
|
||||
snippet = {
|
||||
-- REQUIRED - you must specify a snippet engine
|
||||
|
@ -16,26 +20,22 @@ cmp.setup({
|
|||
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.
|
||||
["<Tab>"] = cmp.mapping(function(fallback)
|
||||
if cmp.visible() then
|
||||
if vim.fn["vsnip#jumpable"](1) == 1 then
|
||||
feedkey("<Plug>(vsnip-jump-next)", "")
|
||||
elseif cmp.visible() then
|
||||
cmp.select_next_item()
|
||||
elseif vim.fn["vsnip#available"](1) == 1 then
|
||||
feedkey("<Plug>(vsnip-expand-or-jump)", "")
|
||||
else
|
||||
fallback() -- The fallback function sends a already mapped key. In this case, it's probably `<Tab>`.
|
||||
end
|
||||
end, { "i", "s" }),
|
||||
|
||||
['<S-Tab>'] = cmp.mapping(function()
|
||||
if cmp.visible() then
|
||||
cmp.select_prev_item()
|
||||
elseif vim.fn["vsnip#jumpable"](-1) == 1 then
|
||||
feedkey("<Plug>(vsnip-jump-prev)", "")
|
||||
if vim.fn["vsnip#jumpable"](1) == 1 then
|
||||
feedkey("<Plug>(vsnip-jump-next)", "")
|
||||
elseif cmp.visible() then
|
||||
cmp.select_next_item()
|
||||
end
|
||||
end, { "i", "s"}),
|
||||
}),
|
||||
|
@ -127,9 +127,32 @@ require('lspconfig').cssls.setup {
|
|||
capabilities = capabilities
|
||||
}
|
||||
|
||||
require'lspconfig'.sumneko_lua.setup {
|
||||
settings = {
|
||||
Lua = {
|
||||
runtime = {
|
||||
-- Tell the language server which version of Lua you're using (most likely LuaJIT in the case of Neovim)
|
||||
version = 'LuaJIT',
|
||||
},
|
||||
diagnostics = {
|
||||
-- Get the language server to recognize the `vim` global
|
||||
globals = {'vim'},
|
||||
},
|
||||
workspace = {
|
||||
-- Make the server aware of Neovim runtime files
|
||||
library = vim.api.nvim_get_runtime_file("", true),
|
||||
},
|
||||
-- Do not send telemetry data containing a randomized but unique identifier
|
||||
telemetry = {
|
||||
enable = false,
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
require('lspconfig').ltex.setup {
|
||||
capabilities = capabilities,
|
||||
on_attach = function(client, bufnr)
|
||||
on_attach = function(_, _)
|
||||
require("ltex_extra").setup{
|
||||
load_langs = {"nl-BE", "en-GB"},
|
||||
init_check = true,
|
||||
|
|
Loading…
Reference in New Issue