summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--idea/.ideavimrc10
-rw-r--r--nvim/init.lua43
2 files changed, 40 insertions, 13 deletions
diff --git a/idea/.ideavimrc b/idea/.ideavimrc
index 3e2506b..e01d24b 100644
--- a/idea/.ideavimrc
+++ b/idea/.ideavimrc
@@ -28,11 +28,7 @@ set ideajoin
nnoremap <C-j> xi<CR><Esc>f\
-" i want to try this
-nnoremap ; :
-nnoremap : ;
-vnoremap ; :
-vnoremap : ;
+nmap <leader>w :w
" Focus sth (e.g. Focus Search)
nmap <leader>f; <Action>(ActivateTerminalToolWindow)
@@ -47,8 +43,8 @@ nmap <leader>fx <Action>(HideAllWindows)
" lsp ig?
nmap <leader>lr <Action>(RenameElement)
nmap <leader>lf <Action>(ReformatCode)
-nmap <C-]> <Action>(GotoNextError)
-nmap <C-[> <Action>(GotoPreviousError)
+nmap ]d <Action>(GotoNextError)
+nmap [d <Action>(GotoPreviousError)
nmap gh <Action>(ShowErrorDescription)
" system clipboard
diff --git a/nvim/init.lua b/nvim/init.lua
index 7cfed8f..961d484 100644
--- a/nvim/init.lua
+++ b/nvim/init.lua
@@ -72,7 +72,6 @@ end)
vim.keymap.set("n", "<leader>tt", function()
-- idk it works
- ---@diagnostic disable-next-line: undefined-field
if vim.opt.expandtab:get() then
vim.opt.expandtab = false
else
@@ -196,7 +195,12 @@ require("lazy").setup({
map("gd", require("telescope.builtin").lsp_definitions, "[G]oto [D]efinition")
map("gr", require("telescope.builtin").lsp_references, "[G]oto [R]eferences")
map("gi", require("telescope.builtin").lsp_implementations, "[G]oto [I]mplementation")
- map("gt", require('telescope.builtin').lsp_type_definitions, "Type [D]efinition")
+ map("gt", require("telescope.builtin").lsp_type_definitions, "Type [D]efinition")
+ map("gh", vim.diagnostic.open_float, "[G]oto [H]ighlight Error (idk)")
+
+ map("[d", vim.diagnostic.goto_next, "Next [D]iagnostic")
+ map("]d", vim.diagnostic.goto_prev, "Prev [D]iagnostic")
+
map("<leader>lr", vim.lsp.buf.rename, "[L]SP [R]ename")
map("<leader><CR>", vim.lsp.buf.code_action, "Code Action")
map("K", vim.lsp.buf.hover, "Hover Documentation")
@@ -241,24 +245,51 @@ require("lazy").setup({
{ "hrsh7th/cmp-nvim-lsp" },
{
"hrsh7th/nvim-cmp",
- dependencies = { "quangnguyen30192/cmp-nvim-tags" },
+ dependencies = { "quangnguyen30192/cmp-nvim-tags", "L3MON4D3/LuaSnip", "saadparwaiz1/cmp_luasnip" },
config = function()
- require("cmp").setup({
+ local cmp = require("cmp")
+ local luasnip = require("luasnip")
+ cmp.setup({
+ snippet = {
+ expand = function(args)
+ luasnip.lsp_expand(args.body)
+ end,
+ },
sources = {
{ name = "nvim_lsp" },
+ { name = "luasnip" },
{ name = "tags" },
},
+ mapping = cmp.mapping.preset.insert({
+ ["<C-n>"] = cmp.mapping.select_next_item(),
+ ["<C-p>"] = cmp.mapping.select_prev_item(),
+ ["<C-y>"] = cmp.mapping.confirm({ select = true }),
+ }),
+ ["<C-l>"] = cmp.mapping(function()
+ if luasnip.expand_or_locally_jumpable() then
+ luasnip.expand_or_jump()
+ end
+ end, { "i", "s" }),
+ ["<C-h>"] = cmp.mapping(function()
+ if luasnip.locally_jumpable(-1) then
+ luasnip.jump(-1)
+ end
+ end, { "i", "s" }),
})
end
},
{
+ "L3MON4D3/LuaSnip",
+ version = "v2.*",
+ },
+ {
"ThePrimeagen/harpoon",
branch = "harpoon2",
dependencies = { "nvim-lua/plenary.nvim" },
config = function()
local harpoon = require("harpoon")
- harpoon:setup()
+ harpoon:setup({})
vim.keymap.set("n", "<leader>a", function() harpoon:list():append() end)
vim.keymap.set("n", "<leader>s", function() harpoon.ui:toggle_quick_menu(harpoon:list()) end)
@@ -273,5 +304,5 @@ require("lazy").setup({
vim.keymap.set("n", "<leader>8", function() harpoon:list():select(8) end)
vim.keymap.set("n", "<leader>9", function() harpoon:list():select(9) end)
end,
- }
+ },
})