commit all, also which-key defs added

main
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>gs", vim.cmd.Git, { desc = "Open Git Fugitive" })
vim.keymap.set("n", "<leader>fo", function() vim.cmd('Git pull') end) 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 mark = require("harpoon.mark")
local ui = require("harpoon.ui") local ui = require("harpoon.ui")
vim.keymap.set("n", "<leader>a", mark.add_file) vim.keymap.set("n", "<leader>a", mark.add_file, { desc = "Harpoon add file" })
vim.keymap.set("n", "<C-e>", ui.toggle_quick_menu) 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-q>", function() ui.nav_file(1) end, { desc = "Harpoon File 1" })
vim.keymap.set("n", "<C-t>", function() ui.nav_file(2) end) 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) 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) 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) lsp.on_attach(function(_, bufnr)
local opts = { buffer = bufnr, remap = false } local opts = { buffer = bufnr, remap = false }
vim.keymap.set("n", "gd", function() vim.lsp.buf.definition() 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) 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) 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) 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_next() end, opts, { desc = "Go to next" })
vim.keymap.set("n", "]d", function() vim.diagnostic.goto_prev() end, opts) 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) 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) 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) 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("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) vim.keymap.set("n", "<leader>fd", function() vim.lsp.buf.format() end, opts, { desc = "Format Document" })
end) end)
lsp.skip_server_setup({"rust_analyzer"}) lsp.skip_server_setup({"rust_analyzer"})
lsp_bindings = { -- lsp_bindings = {
def = "gd", -- def = "gd",
hover = "K", -- hover = "K",
workspace_symbol = "<leader>vws", -- workspace_symbol = "<leader>vws",
goto_next = "[d", -- goto_next = "[d",
goto_prev = "]d", -- goto_prev = "]d",
code_action = "<leader>vca", -- code_action = "<leader>vca",
references = "<leader>vrr", -- references = "<leader>vrr",
rename = "<leader>vrr", -- rename = "<leader>vrr",
sig_help = "<C-h>", -- sig_help = "<C-h>",
format = "<leader>fd", -- format = "<leader>fd",
} -- }
lsp.setup() lsp.setup()

View File

@ -4,9 +4,9 @@ rt.setup({
server = { server = {
on_attach = function(_, bufnr) on_attach = function(_, bufnr)
-- Hover actions -- 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 -- 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 } 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", "gd", function() vim.lsp.buf.definition() end, opts)
-- vim.keymap.set("n", "K", function() vim.lsp.buf.hover() 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>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_next() end, opts)
-- vim.keymap.set("n", "]d", function() vim.diagnostic.goto_prev() 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>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>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("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, end,
}, },
tools = { tools = {

View File

@ -1,9 +1,9 @@
local builtin = require('telescope.builtin') local builtin = require('telescope.builtin')
vim.keymap.set('n', '<leader>pf', builtin.find_files, {}) vim.keymap.set('n', '<leader>pf', builtin.find_files, { desc = "Telescope Find Files" })
vim.keymap.set('n', '<C-p>', builtin.git_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 () vim.keymap.set('n', '<leader>ps', function ()
builtin.grep_string({ search = vim.fn.input("Grep > ") }); builtin.grep_string({ search = vim.fn.input("Grep > ") });
end) end, { desc = "Telescope Grep String" })
-- Enable telescope fzf native, if installed -- Enable telescope fzf native, if installed
pcall(require('telescope').load_extension, 'fzf') 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.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 -- Move selected text
vim.keymap.set("v", "J", ":m '>+1<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") vim.keymap.set("v", "K", ":m '<-2<CR>gv=gv", { desc = "Move Selected Text Up" })
-- make J better by keeping cursor in place -- 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 -- Center half page jumps
vim.keymap.set("n", "<C-d>", "<C-d>zz") vim.keymap.set("n", "<C-d>", "<C-d>zz", { desc = "Half page jump down" })
vim.keymap.set("n", "<C-u>", "<C-u>zz") vim.keymap.set("n", "<C-u>", "<C-u>zz", { desc = "Half page jump up" })
-- Center search -- 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 -- system clipboard copying
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") vim.keymap.set("v", "<leader>y", "\"+y", { desc = "Copy to system clipboard" })
vim.keymap.set("n", "<leader>Y", "\"+Y") vim.keymap.set("n", "<leader>Y", "\"+Y", { desc = "Copy to system clipboard" })
-- null register deleting -- null register deleting
vim.keymap.set("n", "<leader>d", "\"_d") vim.keymap.set("n", "<leader>d", "\"_d", { desc = "Delete to null register" })
vim.keymap.set("v", "<leader>d", "\"_d") vim.keymap.set("v", "<leader>d", "\"_d", { desc = "Delete to null register" })
-- #todo investigate this -- #todo investigate this
vim.keymap.set("n", "Q", "<nop>") vim.keymap.set("n", "Q", "<nop>")
-- replace current word -- 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 -- 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-h>", "<C-w>h")
vim.keymap.set("n", "<C-j>", "<C-w>j") 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-k>", "<C-w>k")
vim.keymap.set("t", "<C-l>", "<C-w>l") vim.keymap.set("t", "<C-l>", "<C-w>l")
vim.keymap.set("n", "<C-Enter>", function() -- Woe is ye who does not use tmux
vim.cmd.vsplit() -- vim.keymap.set("n", "<C-Enter>", function()
vim.cmd.terminal() -- vim.cmd.vsplit()
end) -- vim.cmd.terminal()
-- end)