aboutsummaryrefslogtreecommitdiff
path: root/.config
diff options
context:
space:
mode:
authorLuca Matei Pintilie <luca@lucamatei.com>2024-04-11 19:30:53 +0000
committerLuca Matei Pintilie <luca@lucamatei.com>2024-04-11 19:30:53 +0000
commit1955917e7cc4d21890695dbe259e77df25cb717a (patch)
tree5cbaa1927ac47e965a2c400272fa8bca36e19aca /.config
parentc2235052484d928ae6770471bbb2d3407ad00ac5 (diff)
downloaddotfiles-1955917e7cc4d21890695dbe259e77df25cb717a.tar
dotfiles-1955917e7cc4d21890695dbe259e77df25cb717a.tar.gz
dotfiles-1955917e7cc4d21890695dbe259e77df25cb717a.tar.bz2
dotfiles-1955917e7cc4d21890695dbe259e77df25cb717a.tar.lz
dotfiles-1955917e7cc4d21890695dbe259e77df25cb717a.tar.xz
dotfiles-1955917e7cc4d21890695dbe259e77df25cb717a.tar.zst
dotfiles-1955917e7cc4d21890695dbe259e77df25cb717a.zip
nvim: Add plain mode
Diffstat (limited to '.config')
-rw-r--r--.config/nvim/lua/keybinds.lua97
1 files changed, 64 insertions, 33 deletions
diff --git a/.config/nvim/lua/keybinds.lua b/.config/nvim/lua/keybinds.lua
index 69b2b8c..5669398 100644
--- a/.config/nvim/lua/keybinds.lua
+++ b/.config/nvim/lua/keybinds.lua
@@ -3,6 +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')
vim.g.mapleader = " "
@@ -21,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)
@@ -44,44 +45,74 @@ vim.keymap.set("n", "<Leader>]", ufo.closeAllFolds)
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)
+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";
+ ["<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>" });