nvim: luasnip, ...
This commit is contained in:
parent
e6b3ac25dd
commit
a0ffbd58b3
9 changed files with 61 additions and 32 deletions
|
@ -15,11 +15,11 @@ vim.g.mapleader = ' '
|
|||
vim.g.maplocalleader = ' '
|
||||
vim.g.loaded_netrwPlugin = true
|
||||
|
||||
require('configs.options').setup()
|
||||
require('lazy').setup('configs.packages', {
|
||||
install = { colorscheme = { 'gruvbox' }, },
|
||||
-- rtp = { disabled_plugins = { 'netrwPlugin' } },
|
||||
})
|
||||
|
||||
require('configs.options').setup()
|
||||
require('configs.misc').setup()
|
||||
require('configs.keys').setup()
|
||||
|
|
|
@ -37,11 +37,19 @@ vim.api.nvim_create_autocmd('TermOpen', {
|
|||
--}}}
|
||||
|
||||
-- Buffer {{{
|
||||
vim.cmd([[
|
||||
augroup forceRecheck
|
||||
au FocusGained,BufEnter * :silent! !
|
||||
augroup END
|
||||
]])
|
||||
vim.api.nvim_create_autocmd({ "FocusGained", "TermClose", "TermLeave" }, { command = "checktime" })
|
||||
|
||||
-- go to last loc when opening a buffer
|
||||
vim.api.nvim_create_autocmd("BufReadPost", {
|
||||
callback = function()
|
||||
local mark = vim.api.nvim_buf_get_mark(0, '"')
|
||||
local lcount = vim.api.nvim_buf_line_count(0)
|
||||
if mark[1] > 0 and mark[1] <= lcount then
|
||||
pcall(vim.api.nvim_win_set_cursor, 0, mark)
|
||||
end
|
||||
end,
|
||||
})
|
||||
|
||||
-- }}}
|
||||
|
||||
-- qf {{{
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
return {
|
||||
'lewis6991/gitsigns.nvim',
|
||||
dependencies = { 'nvim-lua/plenary.nvim' },
|
||||
config = {
|
||||
opts = {
|
||||
on_attach = function(bufnr)
|
||||
local gs = package.loaded.gitsigns
|
||||
|
||||
|
|
|
@ -5,7 +5,8 @@ local M = {
|
|||
'b0o/schemastore.nvim',
|
||||
'SmiteshP/nvim-navic',
|
||||
{ 'j-hui/fidget.nvim', config = true },
|
||||
{ 'ray-x/lsp_signature.nvim' },
|
||||
'ray-x/lsp_signature.nvim',
|
||||
'hrsh7th/nvim-cmp',
|
||||
},
|
||||
keys = {
|
||||
{ '<Space>li', '<Cmd>LspInfo<CR>', desc = 'Lsp info' },
|
||||
|
@ -172,9 +173,10 @@ function M.config()
|
|||
}
|
||||
|
||||
require 'lspconfig'.omnisharp.setup {
|
||||
cmd = { '/usr/bin/omnisharp', '--languageserver', '--hostPID', tostring(pid) },
|
||||
-- on_attach = M.on_attach,
|
||||
cmd = { '/usr/bin/omnisharp' },
|
||||
capabilities = capabilities,
|
||||
enable_roslyn_analyzers = true,
|
||||
|
||||
}
|
||||
|
||||
require 'lspconfig'.powershell_es.setup {
|
||||
|
|
|
@ -1,8 +1,9 @@
|
|||
local M = {
|
||||
'hoob3rt/lualine.nvim',
|
||||
event = 'VeryLazy',
|
||||
dependencies = {
|
||||
'kyazdani42/nvim-web-devicons'
|
||||
}
|
||||
},
|
||||
}
|
||||
|
||||
function M.config()
|
||||
|
|
22
dot_config/nvim/lua/configs/packages/luasnip.lua
Normal file
22
dot_config/nvim/lua/configs/packages/luasnip.lua
Normal file
|
@ -0,0 +1,22 @@
|
|||
return {
|
||||
'L3MON4D3/LuaSnip',
|
||||
config = function() require('luasnip.loaders.from_vscode').lazy_load() end,
|
||||
dependencies = {
|
||||
'rafamadriz/friendly-snippets'
|
||||
},
|
||||
keys = {
|
||||
{
|
||||
'<tab>',
|
||||
function()
|
||||
return require('luasnip').jumpable(1) and '<Plug>luasnip-jump-next' or '<tab>'
|
||||
end,
|
||||
expr = true, remap = 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' } },
|
||||
-- { '<C-E>',
|
||||
-- function() return require('luasnip').choice_active() and '<Plug>luasnip-next-choice' or '<C-E>' end,
|
||||
-- mode = 'i', remap = true, expr = true,
|
||||
-- },
|
||||
},
|
||||
}
|
|
@ -10,18 +10,6 @@ return {
|
|||
config = true,
|
||||
},
|
||||
|
||||
{
|
||||
'hrsh7th/vim-vsnip',
|
||||
config = function()
|
||||
vim.api.nvim_exec([[
|
||||
imap <expr> <Tab> vsnip#jumpable(1) ? '<Plug>(vsnip-jump-next)' : '<Tab>'
|
||||
smap <expr> <Tab> vsnip#jumpable(1) ? '<Plug>(vsnip-jump-next)' : '<Tab>'
|
||||
imap <expr> <S-Tab> vsnip#jumpable(-1) ? '<Plug>(vsnip-jump-prev)' : '<S-Tab>'
|
||||
smap <expr> <S-Tab> vsnip#jumpable(-1) ? '<Plug>(vsnip-jump-prev)' : '<S-Tab>'
|
||||
]], false)
|
||||
end
|
||||
},
|
||||
|
||||
'editorconfig/editorconfig-vim',
|
||||
|
||||
{
|
||||
|
|
|
@ -12,6 +12,7 @@ function M.config()
|
|||
sources = {
|
||||
nls.builtins.formatting.xmllint,
|
||||
nls.builtins.formatting.jq,
|
||||
nls.builtins.formatting.clang_format,
|
||||
nls.builtins.diagnostics.sqlfluff,
|
||||
nls.builtins.diagnostics.phpstan.with({
|
||||
cwd = function(params)
|
||||
|
|
|
@ -5,13 +5,14 @@ local M = {
|
|||
'hrsh7th/cmp-nvim-lsp',
|
||||
'hrsh7th/cmp-buffer',
|
||||
'hrsh7th/cmp-path',
|
||||
'hrsh7th/cmp-vsnip',
|
||||
'onsails/lspkind.nvim',
|
||||
'saadparwaiz1/cmp_luasnip',
|
||||
},
|
||||
}
|
||||
|
||||
function M.config()
|
||||
function M.opts()
|
||||
local cmp = require 'cmp'
|
||||
local kind_func = require('lspkind').cmp_format({})
|
||||
|
||||
cmp.setup({
|
||||
-- documentation = true,
|
||||
|
@ -20,25 +21,31 @@ function M.config()
|
|||
{ name = 'nvim_lua' },
|
||||
{ name = 'buffer' },
|
||||
{ name = 'path' },
|
||||
{ name = 'vsnip' },
|
||||
{ name = 'luasnip' },
|
||||
-- { name = 'nvim_lsp_signature_help' },
|
||||
},
|
||||
formatting = {
|
||||
format = require('lspkind').cmp_format({
|
||||
-- mode = 'symbol',
|
||||
}),
|
||||
format = function(entry, vim_item)
|
||||
local modif = kind_func(entry, vim_item)
|
||||
-- folders don't exist on UNIX!
|
||||
modif.kind = string.gsub(modif.kind, 'Folder', 'Directory')
|
||||
return modif
|
||||
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 = false })
|
||||
}),
|
||||
snippet = {
|
||||
expand = function(args)
|
||||
-- For `vsnip` user.
|
||||
vim.fn['vsnip#anonymous'](args.body) -- For `vsnip` user.
|
||||
require('luasnip').lsp_expand(args.body)
|
||||
end
|
||||
}
|
||||
})
|
||||
|
|
Loading…
Add table
Reference in a new issue