;; Which-key provides a pop-up meny for some key mappings. (module config.which-key {autoload {util util}}) (def- setup { :plugins { :marks true :registers true :spelling { :enabled true :suggestions 20} :presets { :operators false :motions false :text_objects false :windows true :nav true :z true :g true}} :icons { :breadcrumb "»" :separator "" :group "+"} :popup_mappings { :scroll_down "" :scroll_up ""} :window { :border "rounded" :position "bottom" :margin [ 1 0 1 0 ] :padding [ 2 2 2 2 ] :winblend 0} :layout { :height { :min 4 :max 25 } :width { :min 20 :max 50 } :spacing 3 :align "left"} :ignore_missing true :hidden [ "" "" "" "" "call" "lua" "^:" "^ " ] :show_help true :triggers "auto" :triggers_blacklist { :i [ "j" "k" ] :v [ "j" "k" ]}}) (def- opts { :mode "n" :prefix "" :buffer nil :silent true :noremap true :nowait true}) (def- mappings { :k [ "lua require('Comment.api').toggle_current_linewise()" "Comment" ] :a [ "Alpha" "Alpha" ] :b [ "lua require('telescope.builtin').buffers(require('telescope.themes').get_dropdown{previewer false})" "Buffers" ] :e [ "NvimTreeToggle" "Explorer" ] :c [ "Bdelete!" "Close Buffer" ] :n [ "nohlsearch" "No Highlight" ] :f [ "lua require('telescope.builtin').find_files(require('telescope.themes').get_dropdown{previewer false})" "Find files" ] :F [ "Telescope file_browser" "Browse files" ] :t [ "Telescope live_grep theme=ivy" "Find Text" ] :P [ "Telescope projects" "Projects" ] :z [ "ZenMode" "Zen Mode" ] :v [ "vsplit" "Vertical Split" ] :h [ "split" "Horizontal Split" ] :p { :name "Packer" :c [ "PackerCompile" "Compile" ] :i [ "PackerInstall" "Install" ] :s [ "PackerSync" "Sync" ] :S [ "PackerStatus" "Status" ] :u [ "PackerUpdate" "Update" ]} :g { :name "Git" :g [ "lua _LAZYGIT_TOGGLE()" "Lazygit" ] :j [ "lua require 'gitsigns'.next_hunk()" "Next Hunk" ] :k [ "lua require 'gitsigns'.prev_hunk()" "Prev Hunk" ] :l [ "lua require 'gitsigns'.blame_line()" "Blame" ] :p [ "lua require 'gitsigns'.preview_hunk()" "Preview Hunk" ] :r [ "lua require 'gitsigns'.reset_hunk()" "Reset Hunk" ] :R [ "lua require 'gitsigns'.reset_buffer()" "Reset Buffer" ] :s [ "lua require 'gitsigns'.stage_hunk()" "Stage Hunk" ] :u [ "lua require 'gitsigns'.undo_stage_hunk()" "Undo Stage Hunk" ] :o [ "Telescope git_status" "Open changed file" ] :b [ "Telescope git_branches" "Checkout branch" ] :c [ "Telescope git_commits" "Checkout commit" ] :d [ "Gitsigns diffthis HEAD" "Diff" ]} :l { :name "LSP" :a [ "lua vim.lsp.buf.code_action()" "Code Action" ] :d [ "Telescope lsp_document_diagnostics" "Document Diagnostics" ] :w [ "Telescope lsp_workspace_diagnostics" "Workspace Diagnostics" ] :f [ "lua vim.lsp.buf.formatting()" "Format" ] :i [ "LspInfo" "Info" ] :I [ "LspInstallInfo" "Installer Info" ] :j [ "lua vim.lsp.diagnostic.goto_next()" "Next Diagnostic" ] :k [ "lua vim.lsp.diagnostic.goto_prev()" "Prev Diagnostic" ] :l [ "lua vim.lsp.codelens.run()" "CodeLens Action" ] :q [ "lua vim.lsp.diagnostic.set_loclist()" "Quickfix" ] :r [ "lua vim.lsp.buf.rename()" "Rename" ] :s [ "Telescope lsp_document_symbols" "Document Symbols" ] :S [ "Telescope lsp_dynamic_workspace_symbols" "Workspace Symbols" ]} :s { :name "Search" :b [ "Telescope git_branches" "Checkout branch" ] :c [ "Telescope colorscheme" "Colorscheme" ] :h [ "Telescope help_tags" "Find Help" ] :M [ "Telescope man_pages" "Man Pages" ] :r [ "Telescope oldfiles" "Open Recent File" ] :R [ "Telescope registers" "Registers" ] :k [ "Telescope keymaps" "Keymaps" ] :C [ "Telescope commands" "Commands" ]} :o { :name "Orgmode" :a [ "lua require('orgmode').action('agenda.prompt')" "Open agenda prompt" ] :c [ "lua require('orgmode').action('capture.prompt')" "Open capture prompt" ]} :r { :name "Replace" :r [ "lua require('spectre').open()" "Replace" ] :w [ "lua require('spectre').open_visual({select_word=true})" "Replace Word" ] :f [ "lua require('spectre').open_file_search()" "Replace Buffer" ] } :T { :name "Treesitter" :p [ "TSPlaygroundToggle" "Playground" ]}}) (def- vopts { :mode "v" :prefix "" :buffer nil :silent true :noremap true :nowait true}) (def- vmappings { :k [ 'lua require("Comment.api").toggle_linewise_op(vim.fn.visualmode())' "Comment" ]}) (let [which-key (util.load-plugin :nvim-which-key.config)] (do (which-key.setup setup) (when.register mappings opts) (when.register vmappings vopts)))