-- [nfnl] Compiled from fnl/dots/keybinds.fnl by https://github.com/Olical/nfnl, do not edit. local _local_1_ = require("dots.prelude") local autoload = _local_1_["autoload"] local a = _local_1_["a"] local str = _local_1_["str"] local utils = _local_1_["utils"] local wk = autoload("which-key") local glance = autoload("glance") local crates = autoload("crates") local dap = autoload("dap") local dapui = autoload("dapui") vim.g.AutoPairsShortcutBackInsert = "" utils.keymap("n", "K", "") utils.keymap("v", "K", "") utils.keymap("i", "\8", "") utils.keymap("i", "", "") utils.keymap("i", "", "") utils.keymap("n", "zt", "zt") utils.keymap("n", "zb", "zb") utils.keymap("n", "c", "call nerdcommenter#Comment(\"m\", \"Toggle\")", {}) utils.keymap("v", "c", "call nerdcommenter#Comment(\"x\", \"Toggle\")", {}) utils.keymap("n", "", "lua vim.lsp.buf.definition()") utils.keymap("n", "", "lua vim.lsp.buf.hover()") utils.keymap({"n", "v"}, "c", "\"+y") utils.keymap("n", "", "RustMoveItemDownj") utils.keymap("n", "", "RustMoveItemUpk") utils.keymap("n", "", "HopChar2") local function open_selection_zotero() local _, _0, sel = utils["get-selection"]() return vim.cmd(("silent !xdg-open zotero://select/items/@" .. str.join(sel))) end local function key_map(obj) local tbl_21_auto = {} local i_22_auto = 0 for key, val in pairs(obj) do local val_23_auto = utils.prepend(key, val) if (nil ~= val_23_auto) then i_22_auto = (i_22_auto + 1) tbl_21_auto[i_22_auto] = val_23_auto else end end return tbl_21_auto end local function m(bind, desc) return {bind, desc = desc} end local function cmd(s, desc) return utils.prepend(("" .. s .. ""), {desc = desc}) end local function sel_cmd(s, desc) return utils.prepend(("'<,'>" .. s .. ""), {desc = desc}) end local function rebind(s, desc) return m(s, desc) end local function format() local function _3_(_241) return _241.server_capabilities.documentFormattingProvider end if a.some(_3_, vim.lsp.get_active_clients()) then return vim.lsp.buf.format({async = true}) else return vim.cmd("Neoformat") end end local function open_rename() return vim.api.nvim_feedkeys((":IncRename " .. vim.fn.expand("")), "n", "") end local function toggle_lsp_lines() vim.diagnostic.config({virtual_lines = not vim.diagnostic.config().virtual_lines}) return vim.diagnostic.config({virtual_text = not vim.diagnostic.config().virtual_lines}) end local function toggle_lsp_lines_current() return vim.diagnostic.config({virtual_lines = {only_current_line = true}}) end wk.setup({}) local function _5_() vim.o.spell = not vim.o.spell return nil end local function _6_() return vim.diagnostic.open_float({scope = "cursor"}) end local function _7_() return vim.diagnostic.open_float({}) end local function _8_() return glance.open("definitions") end local function _9_() return glance.open("references") end local function _10_() return glance.open("type_definitions") end local function _11_() return glance.open("implementations") end wk.add(key_map({["c"] = {group = "+Crates"}, ["e"] = {group = "+emmet"}, ["["] = cmd("HopWord", "Hop to a word"), ["h"] = cmd("bprevious", "previous buffer"), ["l"] = cmd("bnext", "next buffer"), ["o"] = cmd("Telescope live_grep", "Grep files"), ["P"] = cmd("Telescope frecency frecency default_text=:CWD:", "Frecency magic"), ["p"] = cmd("Telescope find_files", "Open file-browser"), [":"] = cmd("Telescope commands", "Search command with fzf"), ["s"] = cmd("w", "Save file"), ["g"] = cmd("Neogit", "Git"), ["n"] = m(require("persistence").load, "Load last session"), ["d"] = {group = "+Debugging"}, ["db"] = m(dap.toggle_breakpoint, "toggle breakpoint"), ["du"] = m(dapui.toggle, "toggle dapui"), ["dc"] = m(dap.step_into, "continue"), ["dr"] = m(dap.repl.open, "open repl"), ["ds"] = {group = "+Step"}, ["dso"] = m(dap.step_over, "over"), ["dsu"] = m(dap.step_out, "out"), ["dsi"] = m(dap.step_into, "into"), ["m"] = {group = "+Code actions"}, ["m;"] = m(_5_, "Toggle spell checking"), ["md"] = m(vim.lsp.buf.hover, "Show documentation"), ["mo"] = cmd("SymbolsOutline", "Outline"), ["mS"] = cmd("Telescope lsp_document_symbols", "Symbols in document"), ["ms"] = cmd("Telescope lsp_dynamic_workspace_symbols", "Symbols in workspace"), ["mT"] = m(vim.lsp.buf.signature_help, "Show signature help"), ["mn"] = m(open_rename, "Rename"), ["mv"] = cmd("CodeActionMenu", "Apply codeaction"), ["mA"] = m(_6_, "Cursor diagnostics"), ["ma"] = m(_7_, "Line diagnostics"), ["mh"] = cmd("RustToggleInlayHints", "Toggle inlay hints"), ["mr"] = cmd("Trouble lsp_references", "Show references"), ["mE"] = cmd("Trouble document_diagnostics", "List diagnostics"), ["me"] = cmd("Trouble workspace_diagnostics", "Show diagnostics"), ["mt"] = cmd("Trouble lsp_type_definitions", "Go to type-definition"), ["mi"] = cmd("Trouble lsp_implementations", "Show implementation"), ["mg"] = cmd("Trouble lsp_definitions", "Go to definition"), ["mw"] = m(toggle_lsp_lines, "Toggle LSP lines"), ["mW"] = m(toggle_lsp_lines_current, "Toggle LSP line"), ["mf"] = m(format, "format file"), ["m,"] = cmd("RustRunnables", "Run rust stuff"), ["mx"] = {group = "+Glance"}, ["mxd"] = m(_8_, "Definitions"), ["mxr"] = m(_9_, "References"), ["mxt"] = m(_10_, "Type definitions"), ["mxi"] = m(_11_, "Implementations"), ["mcj"] = m(crates.show_popup, "crates popup"), ["mcf"] = m(crates.show_features_popup, "crate features"), ["mcv"] = m(crates.show_versions_popup, "crate versions"), ["mcd"] = m(crates.show_dependencies_popup, "crate dependencies"), ["mch"] = m(crates.open_documentation, "crate documentation"), ["f"] = {group = "+folds"}, ["fo"] = cmd("foldopen", "open fold"), ["fn"] = cmd("foldclose", "close fold"), ["fj"] = rebind("zj", "jump to next fold"), ["fk"] = rebind("zk", "jump to previous fold"), ["v"] = {group = "+view-and-layout"}, ["vn"] = cmd("set relativenumber!", "toggle relative numbers"), ["vm"] = cmd("set nonumber! norelativenumber", "toggle numbers"), ["vg"] = cmd("ZenMode", "toggle zen mode"), ["vi"] = cmd("IndentGuidesToggle", "toggle indent guides"), ["vw"] = cmd("set wrap! linebreak!", "toggle linewrapping"), ["b"] = {group = "+buffers"}, ["bb"] = cmd(":Telescope buffers", "select open buffer"), ["bc"] = cmd(":Bdelete!", "close open buffer"), ["bw"] = cmd(":Bwipeout!", "wipeout open buffer")})) wk.add(key_map({[""] = {hidden = true}, gss = {desc = "init selection"}, z = {group = "folds"}, zc = m("foldclose", "close fold"), zo = m("foldopen", "open fold")})) wk.add(key_map({[""] = {hidden = true, mode = "i"}})) wk.add(utils.prepend(key_map({["s"] = sel_cmd("VSSplit", "keep selection visible in split"), ["z"] = m(open_selection_zotero, "open in zotero"), gs = {group = "+Selection"}, gsj = {desc = "increment selection"}, gsk = {desc = "decrement selection"}, gsl = {desc = "increment node"}, gsh = {desc = "decrement node"}}), {mode = "v"})) vim.o.timeoutlen = 200 return nil