commit all, also which-key defs added

This commit is contained in:
Zynh0722 2023-05-12 03:58:14 -07:00
parent 54ea5e727e
commit 0c5ace51d4
9 changed files with 76 additions and 60 deletions

2
after/ftplugin/netrw.lua Normal file
View file

@ -0,0 +1,2 @@
-- vim.keymap.set('n', "<C-o>", vim.cmd("mfmx"), { buffer = true })
-- attempt to open in external file explorer I think

View file

@ -1,2 +1,2 @@
vim.keymap.set("n", "<leader>gs", vim.cmd.Git)
vim.keymap.set("n", "<leader>fo", function() vim.cmd('Git pull') end)
vim.keymap.set("n", "<leader>gs", vim.cmd.Git, { desc = "Open Git Fugitive" })
vim.keymap.set("n", "<leader>fo", function() vim.cmd('Git pull') end, { desc = "Git pull" })

View file

@ -1,10 +1,10 @@
local mark = require("harpoon.mark")
local ui = require("harpoon.ui")
vim.keymap.set("n", "<leader>a", mark.add_file)
vim.keymap.set("n", "<C-e>", ui.toggle_quick_menu)
vim.keymap.set("n", "<leader>a", mark.add_file, { desc = "Harpoon add file" })
vim.keymap.set("n", "<C-e>", ui.toggle_quick_menu, { desc = "Harpoon quick menu" })
vim.keymap.set("n", "<C-q>", function() ui.nav_file(1) end)
vim.keymap.set("n", "<C-t>", function() ui.nav_file(2) end)
vim.keymap.set("n", "<C-n>", function() ui.nav_file(3) end)
vim.keymap.set("n", "<C-s>", function() ui.nav_file(4) end)
vim.keymap.set("n", "<C-q>", function() ui.nav_file(1) end, { desc = "Harpoon File 1" })
vim.keymap.set("n", "<C-t>", function() ui.nav_file(2) end, { desc = "Harpoon File 2" })
vim.keymap.set("n", "<C-n>", function() ui.nav_file(3) end, { desc = "Harpoon File 3" })
vim.keymap.set("n", "<C-s>", function() ui.nav_file(4) end, { desc = "Harpoon File 4" })

View file

@ -32,32 +32,32 @@ lsp.set_preferences({
lsp.on_attach(function(_, bufnr)
local opts = { buffer = bufnr, remap = false }
vim.keymap.set("n", "gd", function() vim.lsp.buf.definition() end, opts)
vim.keymap.set("n", "K", function() vim.lsp.buf.hover() end, opts)
vim.keymap.set("n", "<leader>vws", function() vim.lsp.buf.workspace_symbol() end, opts)
vim.keymap.set("n", "<leader>vd", function() vim.diagnostic.open_float() end, opts)
vim.keymap.set("n", "[d", function() vim.diagnostic.goto_next() end, opts)
vim.keymap.set("n", "]d", function() vim.diagnostic.goto_prev() end, opts)
vim.keymap.set("n", "<leader>vca", function() vim.lsp.buf.code_action() end, opts)
vim.keymap.set("n", "<leader>vrr", function() vim.lsp.buf.references() end, opts)
vim.keymap.set("n", "<leader>vrn", function() vim.lsp.buf.rename() end, opts)
vim.keymap.set("i", "<C-h>", function() vim.lsp.buf.signature_help() end, opts)
vim.keymap.set("n", "<leader>fd", function() vim.lsp.buf.format() end, opts)
vim.keymap.set("n", "gd", function() vim.lsp.buf.definition() end, opts, { desc = "Definition" })
vim.keymap.set("n", "K", function() vim.lsp.buf.hover() end, opts, { desc = "Hover" })
vim.keymap.set("n", "<leader>vws", function() vim.lsp.buf.workspace_symbol() end, opts, { desc = "Workspace Symbol" })
vim.keymap.set("n", "<leader>vd", function() vim.diagnostic.open_float() end, opts, { desc = "Open Info Float" })
vim.keymap.set("n", "[d", function() vim.diagnostic.goto_next() end, opts, { desc = "Go to next" })
vim.keymap.set("n", "]d", function() vim.diagnostic.goto_prev() end, opts, { desc = "Go to previous" })
vim.keymap.set("n", "<leader>vca", function() vim.lsp.buf.code_action() end, opts, { desc = "Code Actions" })
vim.keymap.set("n", "<leader>vrr", function() vim.lsp.buf.references() end, opts, { desc = "References" })
vim.keymap.set("n", "<leader>vrn", function() vim.lsp.buf.rename() end, opts, { desc = "Rename Symbol" })
vim.keymap.set("i", "<C-h>", function() vim.lsp.buf.signature_help() end, opts, { desc = "Signature Help" })
vim.keymap.set("n", "<leader>fd", function() vim.lsp.buf.format() end, opts, { desc = "Format Document" })
end)
lsp.skip_server_setup({"rust_analyzer"})
lsp_bindings = {
def = "gd",
hover = "K",
workspace_symbol = "<leader>vws",
goto_next = "[d",
goto_prev = "]d",
code_action = "<leader>vca",
references = "<leader>vrr",
rename = "<leader>vrr",
sig_help = "<C-h>",
format = "<leader>fd",
}
-- lsp_bindings = {
-- def = "gd",
-- hover = "K",
-- workspace_symbol = "<leader>vws",
-- goto_next = "[d",
-- goto_prev = "]d",
-- code_action = "<leader>vca",
-- references = "<leader>vrr",
-- rename = "<leader>vrr",
-- sig_help = "<C-h>",
-- format = "<leader>fd",
-- }
lsp.setup()

View file

@ -4,9 +4,9 @@ rt.setup({
server = {
on_attach = function(_, bufnr)
-- Hover actions
vim.keymap.set("n", "K", rt.hover_actions.hover_actions, { buffer = bufnr })
vim.keymap.set("n", "K", rt.hover_actions.hover_actions, { buffer = bufnr, desc = "Open Hover Actions" })
-- Code action groups
vim.keymap.set("n", "<Leader>ca", rt.code_action_group.code_action_group, { buffer = bufnr })
vim.keymap.set("n", "<Leader>ca", rt.code_action_group.code_action_group, { buffer = bufnr, desc = "Code Actions" })
local opts = { buffer = bufnr, remap = false }
@ -14,14 +14,14 @@ rt.setup({
-- vim.keymap.set("n", "gd", function() vim.lsp.buf.definition() end, opts)
-- vim.keymap.set("n", "K", function() vim.lsp.buf.hover() end, opts)
-- vim.keymap.set("n", "<leader>vws", function() vim.lsp.buf.workspace_symbol() end, opts)
vim.keymap.set("n", "<leader>vd", function() vim.diagnostic.open_float() end, opts)
vim.keymap.set("n", "<leader>vd", function() vim.diagnostic.open_float() end, opts, { desc = "Open Info Float" })
-- vim.keymap.set("n", "[d", function() vim.diagnostic.goto_next() end, opts)
-- vim.keymap.set("n", "]d", function() vim.diagnostic.goto_prev() end, opts)
-- vim.keymap.set("n", "<leader>vca", function() vim.lsp.buf.code_action() end, opts)
-- vim.keymap.set("n", "<leader>vrr", function() vim.lsp.buf.references() end, opts)
vim.keymap.set("n", "<leader>vrn", function() vim.lsp.buf.rename() end, opts)
vim.keymap.set("n", "<leader>vrn", function() vim.lsp.buf.rename() end, opts, { desc = "Rename Symbol" })
-- vim.keymap.set("i", "<C-h>", function() vim.lsp.buf.signature_help() end, opts)
vim.keymap.set("n", "<leader>fd", function() vim.lsp.buf.format() end, opts)
vim.keymap.set("n", "<leader>fd", function() vim.lsp.buf.format() end, opts, { desc = "Format Document" })
end,
},
tools = {

View file

@ -1,9 +1,9 @@
local builtin = require('telescope.builtin')
vim.keymap.set('n', '<leader>pf', builtin.find_files, {})
vim.keymap.set('n', '<C-p>', builtin.git_files, {})
vim.keymap.set('n', '<leader>pf', builtin.find_files, { desc = "Telescope Find Files" })
vim.keymap.set('n', '<C-p>', builtin.git_files, { desc = "Telescope Git Files (same as Find Files with ripgrep" })
vim.keymap.set('n', '<leader>ps', function ()
builtin.grep_string({ search = vim.fn.input("Grep > ") });
end)
end, { desc = "Telescope Grep String" })
-- Enable telescope fzf native, if installed
pcall(require('telescope').load_extension, 'fzf')

View file

@ -1 +1 @@
vim.keymap.set("n", "<leader>u", vim.cmd.UndotreeToggle)
vim.keymap.set("n", "<leader>u", vim.cmd.UndotreeToggle, { desc = "Open undotree" })

View file

@ -0,0 +1,13 @@
;; extends
(jsx_attribute
((property_identifier) @name (#eq? @name "className"))
(string ((string_fragment) @conceal (#set! conceal "󰇘"))))
; (jsx_attribute
; ((property_identifier)(#eq? property_identifier "className"))
; (string (string_fragment) @conceal (#set! conceal "󰇘")))
; (#set! @conceal "conceal" "󰇘")
; (jsx_attribute) @conceal (#set! conceal "c")

View file

@ -1,40 +1,40 @@
vim.g.mapleader = " "
vim.keymap.set("n", "<leader>pv", vim.cmd.Ex)
vim.keymap.set("n", "<leader>pv", vim.cmd.Ex, { desc = "Open netrw (:Ex)" })
-- Move selected text
vim.keymap.set("v", "J", ":m '>+1<CR>gv=gv")
vim.keymap.set("v", "K", ":m '<-2<CR>gv=gv")
vim.keymap.set("v", "J", ":m '>+1<CR>gv=gv", { desc = "Move Selected Text Down" })
vim.keymap.set("v", "K", ":m '<-2<CR>gv=gv", { desc = "Move Selected Text Up" })
-- make J better by keeping cursor in place
vim.keymap.set("n", "J", "mzJ`z")
vim.keymap.set("n", "J", "mzJ`z", { desc = "Join line below" })
-- Center half page jumps
vim.keymap.set("n", "<C-d>", "<C-d>zz")
vim.keymap.set("n", "<C-u>", "<C-u>zz")
vim.keymap.set("n", "<C-d>", "<C-d>zz", { desc = "Half page jump down" })
vim.keymap.set("n", "<C-u>", "<C-u>zz", { desc = "Half page jump up" })
-- Center search
vim.keymap.set("n", "n", "nzzzv")
vim.keymap.set("n", "N", "Nzzzv")
-- vim.keymap.set("n", "n", "nzzzv")
-- vim.keymap.set("n", "N", "Nzzzv")
vim.keymap.set("x", "<leader>p", "\"_dP")
vim.keymap.set("x", "<leader>p", "\"_dP", { desc = "Paste from system clipboard" })
-- system clipboard copying
vim.keymap.set("n", "<leader>y", "\"+y")
vim.keymap.set("v", "<leader>y", "\"+y")
vim.keymap.set("n", "<leader>Y", "\"+Y")
vim.keymap.set("n", "<leader>y", "\"+y", { desc = "Copy to system clipboard" })
vim.keymap.set("v", "<leader>y", "\"+y", { desc = "Copy to system clipboard" })
vim.keymap.set("n", "<leader>Y", "\"+Y", { desc = "Copy to system clipboard" })
-- null register deleting
vim.keymap.set("n", "<leader>d", "\"_d")
vim.keymap.set("v", "<leader>d", "\"_d")
vim.keymap.set("n", "<leader>d", "\"_d", { desc = "Delete to null register" })
vim.keymap.set("v", "<leader>d", "\"_d", { desc = "Delete to null register" })
-- #todo investigate this
vim.keymap.set("n", "Q", "<nop>")
-- replace current word
vim.keymap.set("n", "<leader>r", [[:%s/\<<C-r><C-w>\>/<C-r><C-w>/gI<Left><Left><Left>]])
vim.keymap.set("n", "<leader>r", [[:%s/\<<C-r><C-w>\>/<C-r><C-w>/gI<Left><Left><Left>]], { desc = "Regex replace current word" })
-- make current file executable
vim.keymap.set("n", "<leader>x", "<cmd>!chmod +x %<CR>", { silent = true })
vim.keymap.set("n", "<leader>x", "<cmd>!chmod +x %<CR>", { silent = true, desc = "Make current file executable" })
vim.keymap.set("n", "<C-h>", "<C-w>h")
vim.keymap.set("n", "<C-j>", "<C-w>j")
@ -51,7 +51,8 @@ vim.keymap.set("t", "<C-j>", "<C-w>j")
vim.keymap.set("t", "<C-k>", "<C-w>k")
vim.keymap.set("t", "<C-l>", "<C-w>l")
vim.keymap.set("n", "<C-Enter>", function()
vim.cmd.vsplit()
vim.cmd.terminal()
end)
-- Woe is ye who does not use tmux
-- vim.keymap.set("n", "<C-Enter>", function()
-- vim.cmd.vsplit()
-- vim.cmd.terminal()
-- end)