local status_ok, which_key = pcall(require, "which-key") if not status_ok then return end local setup = { plugins = { marks = false, -- shows a list of your marks on ' and ` registers = true, -- shows your registers on " in NORMAL or in INSERT mode spelling = { enabled = true, -- enabling this will show WhichKey when pressing z= to select spelling suggestions suggestions = 10, -- how many suggestions should be shown in the list? }, -- the presets plugin, adds help for a bunch of default keybindings in Neovim -- No actual key bindings are created presets = { operators = false, -- adds help for operators like d, y, ... and registers them for motion / text object completion motions = false, -- adds help for motions text_objects = false, -- help for text objects triggered after entering an operator windows = false, -- default bindings on nav = false, -- misc bindings to work with windows z = false, -- bindings for folds, spelling and others prefixed with z g = false, -- bindings for prefixed with g }, }, -- add operators that will trigger motion and text object completion -- to enable native operators, set the preset / operators plugin above -- operators = { gc = "Comments" }, key_labels = { -- override the label used to display some keys. It doesn't effect WK in any other way. -- For example: -- [""] = "SPC", -- [""] = "RET", -- [""] = "TAB", }, icons = { breadcrumb = "»", -- symbol used in the command line area that shows your active key combo separator = "➜", -- symbol used between a key and it's label group = "+", -- symbol prepended to a group }, popup_mappings = { scroll_down = "", -- binding to scroll down inside the popup scroll_up = "", -- binding to scroll up inside the popup }, window = { border = "rounded", -- none, single, double, shadow position = "bottom", -- bottom, top margin = { 1, 0, 1, 0 }, -- extra window margin [top, right, bottom, left] padding = { 2, 2, 2, 2 }, -- extra window padding [top, right, bottom, left] winblend = 0, }, layout = { height = { min = 4, max = 25 }, -- min and max height of the columns width = { min = 20, max = 50 }, -- min and max width of the columns spacing = 3, -- spacing between columns align = "left", -- align columns left, center or right }, ignore_missing = true, -- enable this to hide mappings for which you didn't specify a label hidden = { "", "", "", "", "call", "lua", "^:", "^ " }, -- hide mapping boilerplate show_help = true, -- show help message on the command line when the popup is visible triggers = "auto", -- automatically setup triggers -- triggers = {""} -- or specify a list manually triggers_blacklist = { -- list of mode / prefixes that should never be hooked by WhichKey -- this is mostly relevant for key maps that start with a native binding -- most people should not need to change this i = { "j", "k" }, v = { "j", "k" }, }, } local opts = { mode = "n", -- NORMAL mode prefix = "", buffer = nil, -- Global mappings. Specify a buffer number for buffer local mappings silent = true, -- use `silent` when creating keymaps noremap = true, -- use `noremap` when creating keymaps nowait = true, -- use `nowait` when creating keymaps } -- hjknoyz -- GENERAL MAPPINGS local builtin = require("telescope.builtin") local mappings = { c = { name = "Commands", e = { "wqa!", "exit vim"}, }, l = { name = "LaTeX", b = { "VimtexCompile" , "build" }, c = { "VimtexCountWords!" , "count" }, v = { "VimtexView" , "view" }, }, p = { name = "Project", v = {"Ex" , "explorer"}, f = {builtin.find_files , "find-file"}, g = {builtin.git_files , "find-git-file"}, }, --["b"] = { "VimtexCompile" , "build" }, --["c"] = { "VimtexCountWords!" , "count" }, --["d"] = { "bdelete!" , "delete buffer" }, --["e"] = { "NvimTreeToggle" , "explorer" }, --["i"] = { "VimtexTocOpen" , "index" }, --["q"] = { "wqa!" , "quit" }, --["r"] = { "" , "reorder" }, ---- ["r"] = { "lua require('autolist').force_recalculate()" , "reorder list" }, --["u"] = { "UndotreeToggle" , "undo" }, --["v"] = { "VimtexView" , "view" }, --["w"] = { "wa!" , "write" }, --["x"] = { "" , "checkmark" }, ---- ["x"] = { "lua require('autolist').invert_entry()" , "checkmark" }, --a = { -- name = "ACTIONS", -- a = { "lua PdfAnnots()", "annotate"}, -- b = { "terminal bibexport -o %:p:r.bib %:p:r.aux", "bib export"}, -- c = { "VimtexClean" , "clean aux" }, -- g = { "e ~/.config/nvim/templates/Glossary.tex", "edit glossary"}, -- h = { "lua _HTOP_TOGGLE()", "htop" }, -- i = { "IlluminateToggle" , "illuminate" }, -- l = { "lua vim.g.cmptoggle = not vim.g.cmptoggle", "LSP"}, -- p = { 'lua require("nabla").popup()', "preview symbols"}, -- r = { "VimtexErrors" , "report errors" }, -- s = { "e ~/.config/nvim/snippets/tex.snippets", "edit snippets"}, -- u = { "cd %:p:h" , "update cwd" }, -- -- w = { "TermExec cmd='pandoc %:p -o %:p:r.docx'" , "word"}, -- v = { "(vimtex-context-menu)" , "vimtex menu" }, --}, --f = { -- name = "FIND", -- b = { -- "lua require('telescope.builtin').buffers(require('telescope.themes').get_dropdown{previewer = false})", -- "buffers", -- }, -- c = { "Telescope bibtex" , "citations" }, -- f = { "Telescope live_grep theme=ivy", "project" }, -- g = { "Telescope git_branches", "branches" }, -- h = { "Telescope help_tags", "help" }, -- k = { "Telescope keymaps", "keymaps" }, -- -- m = { "Telescope man_pages", "man pages" }, -- r = { "Telescope registers", "registers" }, -- t = { "Telescope colorscheme", "theme" }, -- y = { "YankyRingHistory" , "yanks" }, -- -- c = { "Telescope commands", "commands" }, -- -- r = { "Telescope oldfiles", "recent" }, --}, --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" }, -- s = { "lua require 'gitsigns'.stage_hunk()", "stage hunk" }, -- u = { -- "lua require 'gitsigns'.undo_stage_hunk()", "unstage 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" }, --}, --m = { -- name = "MANAGE SESSIONS", -- s = { "SessionManager save_current_session", "save" }, -- d = { "SessionManager delete_session", "delete" }, -- l = { "SessionManager load_session", "load" }, --}, --p = { -- name = "PANDOC", -- w = { "TermExec cmd='pandoc %:p -o %:p:r.docx'" , "word"}, -- m = { "TermExec cmd='pandoc %:p -o %:p:r.md'" , "markdown"}, -- h = { "TermExec cmd='pandoc %:p -o %:p:r.html'" , "html"}, -- l = { "TermExec cmd='pandoc %:p -o %:p:r.tex'" , "latex"}, -- p = { "TermExec cmd='pandoc %:p -o %:p:r.pdf'" , "pdf"}, -- -- x = { "echo "run: unoconv -f pdf path-to.docx"" , "word to pdf"}, --}, --s = { -- name = "SURROUND", -- s = { "(nvim-surround-normal)", "surround" }, -- d = { "(nvim-surround-delete)", "delete" }, -- c = { "(nvim-surround-change)", "change" }, --}, --t = { -- name = "TEMPLATES", -- c = { "PackerCompile", "Compile" }, -- p = { -- "read ~/.config/nvim/templates/PhilPaper.tex", -- "PhilPaper.tex", -- }, -- l = { -- "read ~/.config/nvim/templates/Letter.tex", -- "Letter.tex", -- }, -- g = { -- "read ~/.config/nvim/templates/Glossary.tex", -- "Glossary.tex", -- }, -- h = { -- "read ~/.config/nvim/templates/HandOut.tex", -- "HandOut.tex", -- }, -- b = { -- "read ~/.config/nvim/templates/PhilBeamer.tex", -- "PhilBeamer.tex", -- }, -- s = { -- "read ~/.config/nvim/templates/SubFile.tex", -- "SubFile.tex", -- }, -- r = { -- "read ~/.config/nvim/templates/Root.tex", -- "Root.tex", -- }, -- m = { -- "read ~/.config/nvim/templates/MultipleAnswer.tex", -- "MultipleAnswer.tex", -- }, --}, } which_key.setup(setup) which_key.register(mappings, opts)