diff options
Diffstat (limited to '')
| -rw-r--r-- | .config/Code/User/keybindings.json | 29 | ||||
| -rw-r--r-- | .config/nvim/init.lua | 46 |
2 files changed, 54 insertions, 21 deletions
diff --git a/.config/Code/User/keybindings.json b/.config/Code/User/keybindings.json index 02eef97..2bad03e 100644 --- a/.config/Code/User/keybindings.json +++ b/.config/Code/User/keybindings.json @@ -40,27 +40,6 @@ "command": "workbench.action.splitEditorDown", "when": "vim.active && vim.mode == 'Normal'" }, - // splits navigation - { - "key": "alt+h", - "command": "workbench.action.focusLeftGroup", - "when": "vim.active && vim.mode == 'Normal'" - }, - { - "key": "alt+j", - "command": "workbench.action.focusBelowGroup", - "when": "vim.active && vim.mode == 'Normal'" - }, - { - "key": "alt+k", - "command": "workbench.action.focusAboveGroup", - "when": "vim.active && vim.mode == 'Normal'" - }, - { - "key": "alt+l", - "command": "workbench.action.focusRightGroup", - "when": "vim.active && vim.mode == 'Normal'" - }, // alternate close { "key": "alt+q", @@ -286,5 +265,13 @@ { "key": "shift+alt+]", "command": "workbench.action.nextPanelView" + }, + { + "key": "alt+j", + "command": "workbench.action.nextEditor" + }, + { + "key": "alt+k", + "command": "workbench.action.previousEditor" } ] diff --git a/.config/nvim/init.lua b/.config/nvim/init.lua index b6aadab..fccb903 100644 --- a/.config/nvim/init.lua +++ b/.config/nvim/init.lua @@ -15,9 +15,17 @@ vim.cmd [[ Plug 'williamboman/mason-lspconfig.nvim' Plug 'WhoIsSethDaniel/mason-tool-installer.nvim' Plug 'j-hui/fidget.nvim' + Plug 'hrsh7th/nvim-cmp' + Plug 'hrsh7th/cmp-nvim-lsp' + Plug 'hrsh7th/cmp-buffer' + Plug 'hrsh7th/cmp-path' + Plug 'github/copilot.vim' call plug#end() ]] +vim.g.NERDTreeShowHidden = 1 +vim.g.pear_tree_ft_disabled = { "TelescopePrompt", "TelescopeResults" } + -- options local opts = { autochdir = true, @@ -102,6 +110,7 @@ keymap("n", "N", "Nzzzv", { noremap = true }) keymap("n", "<S-A-b>h", ":NERDTreeToggle<CR>", { noremap = true }) keymap("n", "<S-A-b><S-A-h>", ":NERDTreeToggle<CR>", { noremap = true }) keymap("n", "<A-n>", ":NERDTreeToggle<CR>", { noremap = true }) +keymap("n", "<S-A-n>", ":NERDTree<CR>", { noremap = true }) keymap("n", "<S-A-j>", "<C-W>w", { noremap = true }) keymap("n", "<S-A-k>", "<C-W>W", { noremap = true }) keymap({"n", "t"}, "<S-A-b>j", function() toggle_terminal() end, { noremap = true }) @@ -129,6 +138,9 @@ keymap("n", "<A-;>", ":tabmove -<CR>", { noremap = true }) keymap("n", "<A-'>", ":tabmove +<CR>", { noremap = true }) keymap("n", "<leader>ft", ":set filetype=", { noremap = true }) +-- copilot +keymap("i", "<C-l>", 'copilot#Accept("<CR>")', { expr = true, silent = true, replace_keycodes = false }) + -- ui and colors vim.cmd("colorscheme tender") @@ -333,3 +345,37 @@ for server_name, server_config in pairs(servers) do vim.lsp.config(server_name, server_config) vim.lsp.enable(server_name) end + +-- completion +vim.opt.completeopt = { "menu", "menuone", "noinsert" } + +local ok_cmp, cmp = pcall(require, "cmp") +if ok_cmp then + cmp.setup({ + mapping = cmp.mapping.preset.insert({ + ["<Tab>"] = cmp.mapping(function(fallback) + if cmp.visible() then + cmp.select_next_item() + else + fallback() + end + end, { "i", "s" }), + ["<S-Tab>"] = cmp.mapping(function(fallback) + if cmp.visible() then + cmp.select_prev_item() + else + fallback() + end + end, { "i", "s" }), + ["<C-Space>"] = cmp.mapping.complete(), + ["<C-e>"] = cmp.mapping.abort(), + ["<CR>"] = cmp.mapping.confirm({ select = true }), + }), + sources = cmp.config.sources({ + { name = "nvim_lsp" }, + }, { + { name = "buffer" }, + { name = "path" }, + }), + }) +end |
