diff options
| author | Mohammad Reza Karimi <m.r.karimi.j@gmail.com> | 2026-01-21 19:06:11 -0500 |
|---|---|---|
| committer | Mohammad Reza Karimi <m.r.karimi.j@gmail.com> | 2026-01-21 19:06:11 -0500 |
| commit | 6dd62b4cc8b2142135632483bfb55501645d55b8 (patch) | |
| tree | c4cf4b8a2bf34cc578ba83ca81d38363ac55e236 /plugin/11_keymaps.lua | |
| parent | aa5717f00fd14430c80939a68d7107c26de6e554 (diff) | |
big updates
Diffstat (limited to 'plugin/11_keymaps.lua')
| -rw-r--r-- | plugin/11_keymaps.lua | 46 |
1 files changed, 35 insertions, 11 deletions
diff --git a/plugin/11_keymaps.lua b/plugin/11_keymaps.lua index 9dcd4f4..9758fb3 100644 --- a/plugin/11_keymaps.lua +++ b/plugin/11_keymaps.lua @@ -1,3 +1,6 @@ +-- vim: foldmethod=marker + +-- stylua: ignore start local map = function(mode, lhs, rhs, desc) vim.keymap.set(mode, lhs, rhs, { desc = desc }) end local nmap = function(lhs, rhs, desc) map("n", lhs, rhs, desc) end local mapleader = function(mode, suffix, rhs, desc) map(mode, "<Leader>" .. suffix, rhs, desc) end @@ -21,38 +24,59 @@ vim.keymap.set({ "n", "x" }, "k", [[v:count == 0 ? 'gk' : 'k']], { expr = true, nmap("gK", "K", "use the keywordprg instead of hover") -map('t', '<C-[>', [[<C-\><C-N>]], "go to normal mode from terminal mode") -map('t', '<Esc>', '<Esc>', "map <Esc> to literal ESC in terminal mode") +map("t", "<C-[>", [[<C-\><C-N>]], "go to normal mode from terminal mode") +map("t", "<Esc>", "<Esc>", "map <Esc> to literal ESC in terminal mode") + +-- stylua: ignore end --- lua exec +-- lua exec {{{ nmapleader("x", function() - local line = "lua " .. vim.api.nvim_get_current_line() - vim.api.nvim_command(line) - vim.api.nvim_input("<Down>") + local line = "lua " .. vim.api.nvim_get_current_line() + vim.api.nvim_command(line) + vim.api.nvim_input("<Down>") end, "execute lua line and go to next line") + mapleader("x", "x", ":lua<CR>") nmap("<Leader><Leader>x", "<Cmd>luafile %<CR>") +-- }}} --- lsp and format +-- lsp and format {{{ nmapleader("e", "<Cmd>lua vim.diagnostic.open_float()<CR>") nmap("gd", "<Cmd>lua vim.lsp.buf.definition()<CR>") nmap("<C-f>", "<Cmd>lua require'conform'.format{async=true}<CR>") +-- }}} --- fzf +-- fzf {{{ +-- stylua: ignore start nmap("<C-p>", "<Cmd>FzfLua files<CR>", "fzf: find files") nmap("<C-t>", "<Cmd>FzfLua resume<CR>", "fzf: resume") nmap("<C-\\>", "<Cmd>FzfLua buffers<CR>", "fzf: buffers") nmap("<C-/>", "<Cmd>FzfLua oldfiles<CR>", "fzf: oldfiles") -nmapleader("fg", "<Cmd>FzfLua live_grep_native<CR>", "fzf: grep") -nmapleader("fc", '<Cmd>FzfLua files prompt="Nvim Config>\\ " cwd=~/.config/nvim<CR>', "fzf: search config") -nmapleader("fp", '<Cmd>lua FzfLua.files({cwd=vim.fn.stdpath("data").."/site/pack/core/opt/"})<CR>', "fzf: search plugins") +nmapleader("fg", "<Cmd>FzfLua live_grep<CR>", "fzf: grep") +nmapleader("fc", "<Cmd>FzfLua files cwd=~/.config/nvim<CR>", "fzf: search config") +nmapleader("fp", "<Cmd>FzfLua files cwd=~/.local/share/nvim/site/pack/core/opt<CR>", "fzf: search plugins") nmapleader("fh", "<Cmd>FzfLua helptags<CR>", "fzf: help tags") nmapleader("fk", "<Cmd>FzfLua keymaps<CR>", "fzf: keymaps") +-- stylua: ignore end +-- }}} + +-- fzf misc {{{ map("n", "z=", "<Cmd>FzfLua spell_suggest<CR>", "fzf: suggest spelling") +vim.keymap.set("i", "<C-x><C-f>", function() + vim.cmd([[packadd fzf-lua]]) + require("fzf-lua").complete_file({ + cmd = "rg --files", + winopts = { preview = { hidden = true } }, + }) +end, { silent = true, desc = "fzf: complete file" }) +-- }}} + -- git nmapleader("gs", "<Cmd>Git<CR>", "git status") -- qf +-- stylua: ignore start nmapleader("q", function() require("quicker").toggle() end, "Toggle quickfix list") +-- stylua: ignore end |
