aboutsummaryrefslogtreecommitdiff
path: root/.config/nvim/lua/keybinds.lua
diff options
context:
space:
mode:
Diffstat (limited to '.config/nvim/lua/keybinds.lua')
-rw-r--r--.config/nvim/lua/keybinds.lua97
1 files changed, 36 insertions, 61 deletions
diff --git a/.config/nvim/lua/keybinds.lua b/.config/nvim/lua/keybinds.lua
index 5669398..bc36772 100644
--- a/.config/nvim/lua/keybinds.lua
+++ b/.config/nvim/lua/keybinds.lua
@@ -3,7 +3,7 @@ local wk = require("which-key")
local ufo = require("ufo")
local nt_api = require("nvim-tree.api")
local spider = require("spider")
-local lualine = require('lualine')
+local toggle_plain = require("utils").toggle_plain;
vim.g.mapleader = " "
@@ -22,7 +22,7 @@ vim.keymap.set("i", "<A-b>", "<C-Left>")
vim.keymap.set("n", "<Leader>n", nt_api.tree.toggle)
vim.keymap.set("n", "<Leader><CR>", vim.lsp.buf.code_action)
vim.keymap.set("n", "<Leader>K", vim.lsp.buf.hover)
-vim.keymap.set({ "n", "v" }, "<Leader>F", vim.lsp.buf.format)
+vim.keymap.set({ "n"; "v" }, "<Leader>F", vim.lsp.buf.format)
vim.keymap.set("n", "<Leader>d", vim.diagnostic.open_float)
vim.keymap.set("n", "<Leader>J", vim.lsp.buf.signature_help)
@@ -46,73 +46,48 @@ vim.keymap.set("n", "<Leader>r", vim.lsp.buf.rename)
vim.keymap.set("n", "<Leader>N", ":bnext<CR>")
vim.keymap.set("n", "<Leader>P", ":bprevious<CR>")
vim.keymap.set("n", "<Leader>L", function()
- vim.o.number = not (vim.o.number)
- vim.o.relativenumber = not (vim.o.relativenumber)
- vim.o.cursorline = not (vim.o.cursorline)
- vim.o.list = not (vim.o.list)
- vim.o.foldenable = not (vim.o.foldenable)
- if vim.o.foldcolumn == "1"
- then
- vim.o.foldcolumn = "0"
- else
- vim.o.foldcolumn = "1"
- end
- if vim.g.__plain
- then
- lualine.hide({ unhide = true })
- vim.o.laststatus = 2
- vim.diagnostic.enable()
- else
- lualine.hide()
- vim.o.laststatus = 0
- vim.diagnostic.disable()
- end
- vim.cmd [[ MarksToggleSigns ]]
- vim.cmd [[ IBLToggle ]]
- vim.cmd [[ BufferLineGroupToggle ungrouped ]]
- vim.cmd [[ TSContextToggle ]]
-
vim.g.__plain = not (vim.g.__plain)
+ toggle_plain()
end)
local spider_opts = { skipInsignificantPunctuation = true }
-vim.keymap.set({ "n", "o", "x" }, "<A-w>",
- function() spider.motion("w", spider_opts) end)
-vim.keymap.set({ "n", "o", "x" }, "<A-e>",
- function() spider.motion("e", spider_opts) end)
-vim.keymap.set({ "n", "o", "x" }, "<A-b>",
- function() spider.motion("b", spider_opts) end)
-vim.keymap.set({ "n", "o", "x" }, "<A-g><A-e>",
- function() spider.motion("ge", spider_opts) end)
+vim.keymap.set({ "n"; "o"; "x" }, "<A-w>",
+ function() spider.motion("w", spider_opts) end)
+vim.keymap.set({ "n"; "o"; "x" }, "<A-e>",
+ function() spider.motion("e", spider_opts) end)
+vim.keymap.set({ "n"; "o"; "x" }, "<A-b>",
+ function() spider.motion("b", spider_opts) end)
+vim.keymap.set({ "n"; "o"; "x" }, "<A-g><A-e>",
+ function() spider.motion("ge", spider_opts) end)
vim.keymap.set({ "t" }, "<ESC>", "<C-\\><C-n>")
vim.opt.whichwrap = "<,>,h,l,[,]"
wk.register({
- ["<CR>"] = "Quick Action",
- ["K"] = "Hover",
- ["D"] = "Definition",
- ["S"] = "Symbols",
- ["F"] = "Format",
- ["f"] = "Find files",
- ["<TAB>"] = "Show buffers",
- [","] = "Show errors",
- ["["] = "Open folds",
- ["]"] = "Close folds",
- ["r"] = "Rename",
- ["n"] = "Show file tree",
- ["m"] = "Toggle Minimap",
- ["b"] = "Blame line",
- ["h"] = "Preview hunk",
- ["d"] = "Show diagnostics",
- ["t"] = "Open terminal",
- ["s"] = "Save file",
- ["q"] = "Quit",
- ["R"] = "Show References",
- ["J"] = "Signature help",
- ["U"] = "Undo tree",
- ["N"] = "Next tab",
- ["P"] = "Previous tab",
- ["L"] = "Toggle plain mode",
+ ["<CR>"] = "Quick Action";
+ ["K"] = "Hover";
+ ["D"] = "Definition";
+ ["S"] = "Symbols";
+ ["F"] = "Format";
+ ["f"] = "Find files";
+ ["<TAB>"] = "Show buffers";
+ [","] = "Show errors";
+ ["["] = "Open folds";
+ ["]"] = "Close folds";
+ ["r"] = "Rename";
+ ["n"] = "Show file tree";
+ ["m"] = "Toggle Minimap";
+ ["b"] = "Blame line";
+ ["h"] = "Preview hunk";
+ ["d"] = "Show diagnostics";
+ ["t"] = "Open terminal";
+ ["s"] = "Save file";
+ ["q"] = "Quit";
+ ["R"] = "Show References";
+ ["J"] = "Signature help";
+ ["U"] = "Undo tree";
+ ["N"] = "Next tab";
+ ["P"] = "Previous tab";
+ ["L"] = "Toggle plain mode";
}, { prefix = "<leader>" });