new: Add back the fzf and cmp plugins to all machines
This commit is contained in:
parent
eb881cd298
commit
1b011fe67a
9 changed files with 196 additions and 1 deletions
|
@ -44,7 +44,7 @@ bootstrap_paq {
|
||||||
"hrsh7th/cmp-omni", -- For LaTeX completion
|
"hrsh7th/cmp-omni", -- For LaTeX completion
|
||||||
"hrsh7th/cmp-path",
|
"hrsh7th/cmp-path",
|
||||||
"hrsh7th/cmp-cmdline",
|
"hrsh7th/cmp-cmdline",
|
||||||
"SirVer/UltiSnips", -- For snippets
|
"SirVer/ultisnips", -- For snippets
|
||||||
-- Support programming terms
|
-- Support programming terms
|
||||||
{ "psliwka/vim-dirtytalk", build = ':let &rtp = &rtp | DirtytalkUpdate' },
|
{ "psliwka/vim-dirtytalk", build = ':let &rtp = &rtp | DirtytalkUpdate' },
|
||||||
-- vim-moonfly theme
|
-- vim-moonfly theme
|
||||||
|
|
|
@ -17,6 +17,10 @@ vim.keymap.set('n', '<leader>O', "O<Esc>j", { remap = false })
|
||||||
-- Use ,u for redo
|
-- Use ,u for redo
|
||||||
vim.keymap.set('n', '<leader>u', "<c-r>", { remap = false })
|
vim.keymap.set('n', '<leader>u', "<c-r>", { remap = false })
|
||||||
|
|
||||||
|
|
||||||
|
-- Find files using fzf by ,f
|
||||||
|
vim.keymap.set('n', '<leader>f', ":Files<cr>", { remap = false })
|
||||||
|
|
||||||
-- Move around buffers using ,j and ,k
|
-- Move around buffers using ,j and ,k
|
||||||
vim.keymap.set('n', '<leader>k', ":bnext<cr>", { remap = false })
|
vim.keymap.set('n', '<leader>k', ":bnext<cr>", { remap = false })
|
||||||
vim.keymap.set('n', '<leader>j', ":bprevious<cr>", { remap = false })
|
vim.keymap.set('n', '<leader>j', ":bprevious<cr>", { remap = false })
|
||||||
|
|
72
server/plugin/cmp.lua
Normal file
72
server/plugin/cmp.lua
Normal file
|
@ -0,0 +1,72 @@
|
||||||
|
local cmp = require('cmp')
|
||||||
|
local cmp_autopairs = require('nvim-autopairs.completion.cmp')
|
||||||
|
|
||||||
|
cmp.setup({
|
||||||
|
snippet = {
|
||||||
|
-- REQUIRED - you must specify a snippet engine
|
||||||
|
expand = function(args)
|
||||||
|
-- vim.fn["vsnip#anonymous"](args.body) -- For `vsnip` users.
|
||||||
|
-- require('luasnip').lsp_expand(args.body) -- For `luasnip` users.
|
||||||
|
-- require('snippy').expand_snippet(args.body) -- For `snippy` users.
|
||||||
|
-- vim.fn["UltiSnips#Anon"](args.body) -- For `ultisnips` users.
|
||||||
|
end,
|
||||||
|
},
|
||||||
|
window = {
|
||||||
|
completion = cmp.config.window.bordered(winhighlight),
|
||||||
|
documentation = cmp.config.window.bordered(winhighlight),
|
||||||
|
},
|
||||||
|
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 = "omni" },
|
||||||
|
-- { name = 'vsnip' }, -- For vsnip users.
|
||||||
|
-- { name = 'luasnip' }, -- For luasnip users.
|
||||||
|
{ name = 'ultisnips' }, -- For ultisnips users.
|
||||||
|
-- { name = 'snippy' }, -- For snippy users.
|
||||||
|
}, {{ name = 'buffer' }}
|
||||||
|
),
|
||||||
|
experimental = { ghost_text = true },
|
||||||
|
})
|
||||||
|
|
||||||
|
-- Set configuration for specific filetype.
|
||||||
|
cmp.setup.filetype('gitcommit', {
|
||||||
|
sources = cmp.config.sources({
|
||||||
|
{ name = 'git' }, -- You can specify the `git` source if [you were installed it](https://github.com/petertriho/cmp-git).
|
||||||
|
}, {
|
||||||
|
{ 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' }
|
||||||
|
})
|
||||||
|
})
|
||||||
|
|
||||||
|
-- Insert `(` after select function or method item
|
||||||
|
cmp.event:on(
|
||||||
|
'confirm_done',
|
||||||
|
cmp_autopairs.on_confirm_done({
|
||||||
|
filetypes = {
|
||||||
|
tex = false
|
||||||
|
}
|
||||||
|
})
|
||||||
|
)
|
13
server/plugin/lspconfig.lua
Normal file
13
server/plugin/lspconfig.lua
Normal file
|
@ -0,0 +1,13 @@
|
||||||
|
local lspconfig = require('lspconfig')
|
||||||
|
-- lspconfig.pyright.setup {}
|
||||||
|
-- lspconfig.tsserver.setup {}
|
||||||
|
-- lspconfig.rust_analyzer.setup {
|
||||||
|
-- -- Server-specific settings. See `:help lspconfig-setup`
|
||||||
|
-- settings = {
|
||||||
|
-- ['rust-analyzer'] = {
|
||||||
|
-- check = {
|
||||||
|
-- command = "clippy",
|
||||||
|
-- }
|
||||||
|
-- },
|
||||||
|
-- },
|
||||||
|
-- }
|
|
@ -33,6 +33,13 @@ bootstrap_paq {
|
||||||
"lambdalisue/suda.vim",
|
"lambdalisue/suda.vim",
|
||||||
-- Auto toggle for number mode when vim isn't focused
|
-- Auto toggle for number mode when vim isn't focused
|
||||||
"sitiom/nvim-numbertoggle",
|
"sitiom/nvim-numbertoggle",
|
||||||
|
-- LSP related plugins
|
||||||
|
"neovim/nvim-lspconfig",
|
||||||
|
"hrsh7th/nvim-cmp", -- For LSP completion
|
||||||
|
"hrsh7th/cmp-nvim-lsp",
|
||||||
|
"hrsh7th/cmp-cmdline",
|
||||||
|
"hrsh7th/cmp-buffer",
|
||||||
|
"hrsh7th/cmp-path",
|
||||||
-- Support programming terms
|
-- Support programming terms
|
||||||
{ "psliwka/vim-dirtytalk", build = ':let &rtp = &rtp | DirtytalkUpdate' },
|
{ "psliwka/vim-dirtytalk", build = ':let &rtp = &rtp | DirtytalkUpdate' },
|
||||||
-- vim-moonfly theme
|
-- vim-moonfly theme
|
||||||
|
@ -44,5 +51,7 @@ bootstrap_paq {
|
||||||
-- Syntax highlighting for Fish scripts
|
-- Syntax highlighting for Fish scripts
|
||||||
"khaveesh/vim-fish-syntax",
|
"khaveesh/vim-fish-syntax",
|
||||||
"kylechui/nvim-surround",
|
"kylechui/nvim-surround",
|
||||||
|
"junegunn/fzf",
|
||||||
|
"junegunn/fzf.vim",
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -16,6 +16,9 @@ vim.keymap.set('n', '<leader>O', "O<Esc>j", { remap = false })
|
||||||
-- Use ,u for redo
|
-- Use ,u for redo
|
||||||
vim.keymap.set('n', '<leader>u', "<c-r>", { remap = false })
|
vim.keymap.set('n', '<leader>u', "<c-r>", { remap = false })
|
||||||
|
|
||||||
|
-- Find files using fzf by ,f
|
||||||
|
vim.keymap.set('n', '<leader>f', ":Files<cr>", { remap = false })
|
||||||
|
|
||||||
-- Move around buffers using ,j and ,k
|
-- Move around buffers using ,j and ,k
|
||||||
vim.keymap.set('n', '<leader>k', ":bnext<cr>", { remap = false })
|
vim.keymap.set('n', '<leader>k', ":bnext<cr>", { remap = false })
|
||||||
vim.keymap.set('n', '<leader>j', ":bprevious<cr>", { remap = false })
|
vim.keymap.set('n', '<leader>j', ":bprevious<cr>", { remap = false })
|
||||||
|
|
72
vps/plugin/cmp.lua
Normal file
72
vps/plugin/cmp.lua
Normal file
|
@ -0,0 +1,72 @@
|
||||||
|
local cmp = require('cmp')
|
||||||
|
local cmp_autopairs = require('nvim-autopairs.completion.cmp')
|
||||||
|
|
||||||
|
cmp.setup({
|
||||||
|
snippet = {
|
||||||
|
-- REQUIRED - you must specify a snippet engine
|
||||||
|
expand = function(args)
|
||||||
|
-- vim.fn["vsnip#anonymous"](args.body) -- For `vsnip` users.
|
||||||
|
-- require('luasnip').lsp_expand(args.body) -- For `luasnip` users.
|
||||||
|
-- require('snippy').expand_snippet(args.body) -- For `snippy` users.
|
||||||
|
-- vim.fn["UltiSnips#Anon"](args.body) -- For `ultisnips` users.
|
||||||
|
end,
|
||||||
|
},
|
||||||
|
window = {
|
||||||
|
completion = cmp.config.window.bordered(winhighlight),
|
||||||
|
documentation = cmp.config.window.bordered(winhighlight),
|
||||||
|
},
|
||||||
|
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 = "omni" },
|
||||||
|
-- { name = 'vsnip' }, -- For vsnip users.
|
||||||
|
-- { name = 'luasnip' }, -- For luasnip users.
|
||||||
|
{ name = 'ultisnips' }, -- For ultisnips users.
|
||||||
|
-- { name = 'snippy' }, -- For snippy users.
|
||||||
|
}, {{ name = 'buffer' }}
|
||||||
|
),
|
||||||
|
experimental = { ghost_text = true },
|
||||||
|
})
|
||||||
|
|
||||||
|
-- Set configuration for specific filetype.
|
||||||
|
cmp.setup.filetype('gitcommit', {
|
||||||
|
sources = cmp.config.sources({
|
||||||
|
{ name = 'git' }, -- You can specify the `git` source if [you were installed it](https://github.com/petertriho/cmp-git).
|
||||||
|
}, {
|
||||||
|
{ 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' }
|
||||||
|
})
|
||||||
|
})
|
||||||
|
|
||||||
|
-- Insert `(` after select function or method item
|
||||||
|
cmp.event:on(
|
||||||
|
'confirm_done',
|
||||||
|
cmp_autopairs.on_confirm_done({
|
||||||
|
filetypes = {
|
||||||
|
tex = false
|
||||||
|
}
|
||||||
|
})
|
||||||
|
)
|
13
vps/plugin/lspconfig.lua
Normal file
13
vps/plugin/lspconfig.lua
Normal file
|
@ -0,0 +1,13 @@
|
||||||
|
local lspconfig = require('lspconfig')
|
||||||
|
-- lspconfig.pyright.setup {}
|
||||||
|
-- lspconfig.tsserver.setup {}
|
||||||
|
-- lspconfig.rust_analyzer.setup {
|
||||||
|
-- -- Server-specific settings. See `:help lspconfig-setup`
|
||||||
|
-- settings = {
|
||||||
|
-- ['rust-analyzer'] = {
|
||||||
|
-- check = {
|
||||||
|
-- command = "clippy",
|
||||||
|
-- }
|
||||||
|
-- },
|
||||||
|
-- },
|
||||||
|
-- }
|
|
@ -33,6 +33,13 @@ bootstrap_paq {
|
||||||
"lambdalisue/suda.vim",
|
"lambdalisue/suda.vim",
|
||||||
-- Auto toggle for number mode when vim isn't focused
|
-- Auto toggle for number mode when vim isn't focused
|
||||||
"sitiom/nvim-numbertoggle",
|
"sitiom/nvim-numbertoggle",
|
||||||
|
-- LSP related plugins
|
||||||
|
"neovim/nvim-lspconfig",
|
||||||
|
"hrsh7th/nvim-cmp", -- For LSP completion
|
||||||
|
"hrsh7th/cmp-nvim-lsp",
|
||||||
|
"hrsh7th/cmp-buffer",
|
||||||
|
"hrsh7th/cmp-path",
|
||||||
|
"hrsh7th/cmp-cmdline",
|
||||||
-- Support programming terms
|
-- Support programming terms
|
||||||
{ "psliwka/vim-dirtytalk", build = ':let &rtp = &rtp | DirtytalkUpdate' },
|
{ "psliwka/vim-dirtytalk", build = ':let &rtp = &rtp | DirtytalkUpdate' },
|
||||||
-- vim-moonfly theme
|
-- vim-moonfly theme
|
||||||
|
@ -44,5 +51,7 @@ bootstrap_paq {
|
||||||
-- Syntax highlighting for Fish scripts
|
-- Syntax highlighting for Fish scripts
|
||||||
"khaveesh/vim-fish-syntax",
|
"khaveesh/vim-fish-syntax",
|
||||||
"kylechui/nvim-surround",
|
"kylechui/nvim-surround",
|
||||||
|
"junegunn/fzf",
|
||||||
|
"junegunn/fzf.vim",
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue