switch to luasnip, added better snipplets
This commit is contained in:
28
lua/config/bindings.lua
Normal file
28
lua/config/bindings.lua
Normal file
@ -0,0 +1,28 @@
|
||||
--tab navigation
|
||||
vim.keymap.set("n", "<A-1>", "1gt")
|
||||
vim.keymap.set("n", "<A-2>", "2gt")
|
||||
vim.keymap.set("n", "<A-3>", "3gt")
|
||||
vim.keymap.set("n", "<A-4>", "4gt")
|
||||
vim.keymap.set("n", "<A-5>", "5gt")
|
||||
vim.keymap.set("n", "<A-6>", "6gt")
|
||||
vim.keymap.set("n", "<A-7>", "7gt")
|
||||
vim.keymap.set("n", "<A-8>", "8gt")
|
||||
vim.keymap.set("n", "<A-9>", "9gt")
|
||||
vim.keymap.set("n", "<A-0>", ":tablast<cr>")
|
||||
vim.keymap.set("n", "<C-t>", ":tab new<cr>")
|
||||
--move between splits with hjkl
|
||||
vim.keymap.set("n", "<A-l>", ":wincmd l<cr>")
|
||||
vim.keymap.set("n", "<A-k>", ":wincmd k<cr>")
|
||||
vim.keymap.set("n", "<A-j>", ":wincmd j<cr>")
|
||||
vim.keymap.set("n", "<A-h>", ":wincmd h<cr>")
|
||||
--misc
|
||||
vim.keymap.set("n", "<C-w>", ":q<cr>") --ctrl+w shortcut of :q
|
||||
vim.keymap.set("n", "<C-n>", ":NvimTreeToggle<cr>") --open file tree
|
||||
vim.keymap.set("n", "<A-cr>", ":tabnew +term<cr>") --create terminal in new tab
|
||||
vim.keymap.set("t", "<Esc>", "<C-\\><C-n>") --exit terminal mode with esc
|
||||
vim.keymap.set("n", "<A-ESC>", ":tabnew | terminal htop<cr>") --open htop in new tab
|
||||
vim.keymap.set("n", "<A-t>", ":tabnew | terminal termusic<cr>") --open termusic (a music player) in new tab
|
||||
vim.keymap.set("n", "<A-m>", ":tabnew | terminal gomuks<cr>") --open gomuks (a matrix client) in new tab
|
||||
vim.keymap.set("n", "<A-r>", ":tabnew | terminal ranger<cr>") --open ranger (a file manager) in new tab
|
||||
vim.keymap.set("n", "<A-V>", ":split new<cr>") --create a new split
|
||||
vim.keymap.set("n", "<A-v>", ":vs new<cr>") --create a vplit
|
82
lua/config/lsp-config.lua
Normal file
82
lua/config/lsp-config.lua
Normal file
@ -0,0 +1,82 @@
|
||||
-- Set up nvim-cmp.
|
||||
local cmp = require'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(),
|
||||
-- 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.select_next_item(),
|
||||
['<S-Tab>'] = cmp.mapping.select_prev_item(),
|
||||
}),
|
||||
sources = cmp.config.sources({
|
||||
{ name = 'nvim_lsp' },
|
||||
{ name = 'vsnip' }, -- For vsnip users.
|
||||
-- { name = 'luasnip' }, -- For luasnip users.
|
||||
-- { name = 'ultisnips' }, -- For ultisnips users.
|
||||
-- { name = 'snippy' }, -- For snippy users.
|
||||
}, {
|
||||
{ name = 'buffer' },
|
||||
})
|
||||
})
|
||||
|
||||
-- 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' }
|
||||
})
|
||||
})
|
||||
|
||||
|
||||
|
||||
|
||||
-- Set up lspconfig.
|
||||
local capabilities = require('cmp_nvim_lsp').default_capabilities()
|
||||
-- Replace <YOUR_LSP_SERVER> with each lsp server you've enabled.
|
||||
require('lspconfig')['clangd'].setup {
|
||||
capabilities = capabilities
|
||||
}
|
||||
require('lspconfig')['csharp_ls'].setup {
|
||||
capabilities = capabilities
|
||||
}
|
||||
require('lspconfig')['lua_ls'].setup {
|
||||
capabilities = capabilities
|
||||
}
|
||||
require('lspconfig')['bashls'].setup {
|
||||
capabilities = capabilities
|
||||
}
|
15
lua/config/winsep.lua
Normal file
15
lua/config/winsep.lua
Normal file
@ -0,0 +1,15 @@
|
||||
require("colorful-winsep").setup({
|
||||
-- highlight for Window separator
|
||||
-- timer refresh rate
|
||||
interval = 30,
|
||||
-- This plugin will not be activated for filetype in the following table.
|
||||
no_exec_files = { "packer", "TelescopePrompt", "mason", "CompetiTest", "NvimTree" },
|
||||
-- Symbols for separator lines, the order: horizontal, vertical, top left, top right, bottom left, bottom right.
|
||||
symbols = { "━", "┃", "┏", "┓", "┗", "┛" },
|
||||
close_event = function()
|
||||
-- Executed after closing the window separator
|
||||
end,
|
||||
create_event = function()
|
||||
-- Executed after creating the window separator
|
||||
end,
|
||||
})
|
Reference in New Issue
Block a user