aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.config/nvim/lua/general.lua30
-rw-r--r--.config/nvim/lua/keybinds.lua97
-rw-r--r--.config/nvim/lua/plugins.lua83
3 files changed, 98 insertions, 112 deletions
diff --git a/.config/nvim/lua/general.lua b/.config/nvim/lua/general.lua
index cfe3c9c..27bf28e 100644
--- a/.config/nvim/lua/general.lua
+++ b/.config/nvim/lua/general.lua
@@ -12,6 +12,7 @@ vim.opt.colorcolumn = "120"
vim.opt.scrolloff = 5
vim.opt.spelllang = "en,nb"
vim.opt.cursorline = true
+vim.g.__plain = false
-- vim.opt.tabstop = 4
-- vim.opt.softtabstop = -1
@@ -19,22 +20,29 @@ vim.opt.cursorline = true
-- vim.opt.expandtab = true
-- vim.opt.autoindent = true
-vim.cmd [[autocmd FileType typescript setlocal shiftwidth=2 softtabstop=2 expandtab]]
+vim.cmd [[autocmd FileType typescript setlocal softtabstop=2 expandtab]]
vim.cmd [[autocmd FileType typescriptreact setlocal shiftwidth=2 softtabstop=2 expandtab]]
-vim.cmd [[autocmd FileType javascript setlocal shiftwidth=2 softtabstop=2 expandtab]]
+vim.cmd [[autocmd FileType javascript setlocal shiftwidth=2 softtabstop=2 expandtab]]
vim.cmd [[autocmd FileType javascriptreact setlocal shiftwidth=2 softtabstop=2 expandtab]]
-vim.cmd [[autocmd FileType css setlocal shiftwidth=2 softtabstop=2 expandtab]]
-vim.cmd [[autocmd FileType scss setlocal shiftwidth=4 softtabstop=4 expandtab]]
-vim.cmd [[autocmd FileType html setlocal shiftwidth=2 softtabstop=2 expandtab]]
-vim.cmd [[autocmd FileType json setlocal shiftwidth=2 softtabstop=2 expandtab]]
-vim.cmd [[autocmd FileType cs setlocal shiftwidth=4 softtabstop=4 expandtab]]
-vim.cmd [[autocmd FileType mail setlocal textwidth=72 colorcolumn=72 spell]]
-vim.cmd [[autocmd FileType markdown setlocal textwidth=72 colorcolumn=72 spell]]
-vim.cmd [[autocmd FileType gitcommit setlocal textwidth=72 colorcolumn=50,72 spell]]
-vim.cmd [[autocmd BufNew,BufNewFile,BufRead *.cshtml :set filetype=razor]]
+vim.cmd [[autocmd FileType css setlocal shiftwidth=2 softtabstop=2 expandtab]]
+vim.cmd [[autocmd FileType html setlocal shiftwidth=2 softtabstop=2 expandtab]]
+vim.cmd [[autocmd BufNew,BufNewFile,BufRead,BufEnter,TabEnter *.lua :lua require("utils").toggle_plain()]]
+vim.cmd [[autocmd FileType json setlocal shiftwidth=2 softtabstop=2 expandtab]]
+vim.cmd [[autocmd FileType cs setlocal shiftwidth=4 softtabstop=4 expandtab]]
+vim.cmd [[autocmd FileType mail setlocal textwidth=72 colorcolumn=72 spell]]
+vim.cmd [[autocmd FileType markdown setlocal textwidth=72 colorcolumn=72 spell]]
+vim.cmd [[autocmd FileType gitcommit setlocal textwidth=72 colorcolumn=50,72 spell]]
vim.cmd [[filetype indent off]]
+vim.filetype.add({
+ extension = { cshtml = "razor" };
+ pattern = {
+ -- void linux templates
+ ["template"] = "bash";
+ };
+})
+
-- Comment the following lines to disable whitespace characters
vim.opt.list = true
vim.opt.listchars:append("space:⋅")
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>" });
diff --git a/.config/nvim/lua/plugins.lua b/.config/nvim/lua/plugins.lua
index 76fb571..6013069 100644
--- a/.config/nvim/lua/plugins.lua
+++ b/.config/nvim/lua/plugins.lua
@@ -113,7 +113,7 @@ local function init_plugins()
local telescope = require("telescope")
local telescopeConfig = require("telescope.config")
local previewers = require("telescope.previewers")
- local lsp_lens = require('lsp-lens')
+ local lsp_lens = require("lsp-lens")
local _bad = { ".*%.cshtml" }
local bad_files = function(filepath)
@@ -390,50 +390,53 @@ local function init_plugins()
local SymbolKind = vim.lsp.protocol.SymbolKind
local all_symbols = {
- vim.lsp.protocol.SymbolKind.File,
- vim.lsp.protocol.SymbolKind.Module,
- vim.lsp.protocol.SymbolKind.Namespace,
- vim.lsp.protocol.SymbolKind.Package,
- vim.lsp.protocol.SymbolKind.Class,
- vim.lsp.protocol.SymbolKind.Method,
- vim.lsp.protocol.SymbolKind.Property,
- vim.lsp.protocol.SymbolKind.Field,
- vim.lsp.protocol.SymbolKind.Constructor,
- vim.lsp.protocol.SymbolKind.Enum,
- vim.lsp.protocol.SymbolKind.Interface,
- vim.lsp.protocol.SymbolKind.Function,
- vim.lsp.protocol.SymbolKind.Variable,
- vim.lsp.protocol.SymbolKind.Constant,
- vim.lsp.protocol.SymbolKind.String,
- vim.lsp.protocol.SymbolKind.Number,
- vim.lsp.protocol.SymbolKind.Boolean,
- vim.lsp.protocol.SymbolKind.Array,
- vim.lsp.protocol.SymbolKind.Object,
- vim.lsp.protocol.SymbolKind.Key,
- vim.lsp.protocol.SymbolKind.Null,
- vim.lsp.protocol.SymbolKind.EnumMember,
- vim.lsp.protocol.SymbolKind.Struct,
- vim.lsp.protocol.SymbolKind.Event,
- vim.lsp.protocol.SymbolKind.Operator,
- vim.lsp.protocol.SymbolKind.TypeParameter,
+ vim.lsp.protocol.SymbolKind.File;
+ vim.lsp.protocol.SymbolKind.Module;
+ vim.lsp.protocol.SymbolKind.Namespace;
+ vim.lsp.protocol.SymbolKind.Package;
+ vim.lsp.protocol.SymbolKind.Class;
+ vim.lsp.protocol.SymbolKind.Method;
+ vim.lsp.protocol.SymbolKind.Property;
+ vim.lsp.protocol.SymbolKind.Field;
+ vim.lsp.protocol.SymbolKind.Constructor;
+ vim.lsp.protocol.SymbolKind.Enum;
+ vim.lsp.protocol.SymbolKind.Interface;
+ vim.lsp.protocol.SymbolKind.Function;
+ vim.lsp.protocol.SymbolKind.Variable;
+ vim.lsp.protocol.SymbolKind.Constant;
+ vim.lsp.protocol.SymbolKind.String;
+ vim.lsp.protocol.SymbolKind.Number;
+ vim.lsp.protocol.SymbolKind.Boolean;
+ vim.lsp.protocol.SymbolKind.Array;
+ vim.lsp.protocol.SymbolKind.Object;
+ vim.lsp.protocol.SymbolKind.Key;
+ vim.lsp.protocol.SymbolKind.Null;
+ vim.lsp.protocol.SymbolKind.EnumMember;
+ vim.lsp.protocol.SymbolKind.Struct;
+ vim.lsp.protocol.SymbolKind.Event;
+ vim.lsp.protocol.SymbolKind.Operator;
+ vim.lsp.protocol.SymbolKind.TypeParameter;
}
lsp_lens.setup({
- enable = false,
- include_declaration = false, -- Reference include declaration
- sections = { -- Enable / Disable specific request, formatter example looks 'Format Requests'
- definition = true,
- references = true,
- implements = true,
- git_authors = false,
- },
- ignore_filetype = {
- "prisma",
- },
+ enable = false;
+ include_declaration = false; -- Reference include declaration
+ sections = { -- Enable / Disable specific request, formatter example looks 'Format Requests'
+ definition = true;
+ references = true;
+ implements = true;
+ git_authors = false;
+ };
+ ignore_filetype = { "prisma" };
-- Target Symbol Kinds to show lens information
- target_symbol_kinds = all_symbols, -- { SymbolKind.Function, SymbolKind.Method, SymbolKind.Interface, },
+ target_symbol_kinds = all_symbols; -- { SymbolKind.Function, SymbolKind.Method, SymbolKind.Interface, },
-- Symbol Kinds that may have target symbol kinds as children
- wrapper_symbol_kinds = { SymbolKind.Class, SymbolKind.Struct, SymbolKind.Enum, SymbolKind.Interface, },
+ wrapper_symbol_kinds = {
+ SymbolKind.Class;
+ SymbolKind.Struct;
+ SymbolKind.Enum;
+ SymbolKind.Interface;
+ };
})
end