From 33e8a6bc9b5ac6d428d1181ddb997fe9ed329c4d Mon Sep 17 00:00:00 2001 From: Noah Masur <7386960+nmasur@users.noreply.github.com> Date: Tue, 29 Nov 2022 09:35:39 -0700 Subject: [PATCH] refactor vim settings --- modules/neovim/plugins/lsp.nix | 24 ---------------- modules/neovim/plugins/misc.nix | 49 ++++++++++++++++++--------------- modules/neovim/plugins/tree.nix | 6 ++-- 3 files changed, 31 insertions(+), 48 deletions(-) diff --git a/modules/neovim/plugins/lsp.nix b/modules/neovim/plugins/lsp.nix index c626515..24d7808 100644 --- a/modules/neovim/plugins/lsp.nix +++ b/modules/neovim/plugins/lsp.nix @@ -26,30 +26,6 @@ vim.api.nvim_create_augroup = dsl.callWith [ "LspFormatting" { } ]; - # setup."null-ls" = { - # sources = [ - # (dsl.rawLua - # "require('null-ls').builtins.formatting.black.with({ command = ${pkgs.black}/bin/black })") - # (dsl.rawLua - # "require('null-ls').builtins.formatting.flake8.with({ command = ${pkgs.python310Packages.flake8}/bin/flake8 })") - # (dsl.rawLua - # "require('null-ls').builtins.formatting.fish_indent.with({ command = ${pkgs.fish}/bin/fish_indent })") - # (dsl.rawLua - # "require('null-ls').builtins.formatting.nixfmt.with({ command = ${pkgs.nixfmt}/bin/nixfmt })") - # (dsl.rawLua - # "require('null-ls').builtins.formatting.rustfmt.with({ command = ${pkgs.rustfmt}/bin/rustfmt })") - # (dsl.rawLua - # "require('null-ls').builtins.diagnostics.shellcheck.with({ command = ${pkgs.shellcheck}/bin/shellcheck })") - # (dsl.rawLua '' - # require('null-ls').builtins.formatting.shfmt.with( - # command = {${pkgs.shfmt}/bin/shfmt }, - # extra_args = { '-i', '4', '-ci' }, - # )'') - # (dsl.rawLua - # "require('null-ls').builtins.formatting.terraform_fmt.with({ command = ${pkgs.terraform}/bin/terraform })") - # ]; - # }; - lua = '' ${builtins.readFile ./lsp.lua} diff --git a/modules/neovim/plugins/misc.nix b/modules/neovim/plugins/misc.nix index 9ad3c89..7b56d1a 100644 --- a/modules/neovim/plugins/misc.nix +++ b/modules/neovim/plugins/misc.nix @@ -13,28 +13,33 @@ setup.Comment = { }; setup.colorizer = { }; - vim.o.termguicolors = true; # Set to truecolor - vim.o.hidden = true; # Don't unload buffers when leaving them - vim.wo.number = true; # Show line numbers - vim.wo.relativenumber = true; # Relative numbers instead of absolute - vim.o.list = true; # Reveal whitespace with dashes - vim.o.expandtab = true; # Tabs into spaces - vim.o.shiftwidth = 4; # Amount to shift with > key - vim.o.softtabstop = 4; # Amount to shift with key - vim.o.ignorecase = true; # Ignore case when searching - vim.o.smartcase = true; # Check case when using capitals in search - vim.o.infercase = true; # Don't match cases when completing suggestions - vim.o.incsearch = true; # Search while typing - vim.o.visualbell = true; # No sounds - vim.o.scrolljump = 1; # Number of lines to scroll - vim.o.scrolloff = 3; # Margin of lines to see while scrolling - vim.o.splitright = true; # Vertical splits on the right side - vim.o.splitbelow = true; # Horizontal splits on the bottom side - vim.o.pastetoggle = ""; # Use F3 to enter raw paste mode - vim.o.clipboard = "unnamedplus"; # Uses system clipboard for yanking - vim.o.updatetime = 300; # Faster diagnostics - vim.o.mouse = "nv"; # Mouse interaction / scrolling - vim.o.inccommand = "split"; # Live preview search and replace + vim.o = { + termguicolors = true; # Set to truecolor + hidden = true; # Don't unload buffers when leaving them + list = true; # Reveal whitespace with dashes + expandtab = true; # Tabs into spaces + shiftwidth = 4; # Amount to shift with > key + softtabstop = 4; # Amount to shift with key + ignorecase = true; # Ignore case when searching + smartcase = true; # Check case when using capitals in search + infercase = true; # Don't match cases when completing suggestions + incsearch = true; # Search while typing + visualbell = true; # No sounds + scrolljump = 1; # Number of lines to scroll + scrolloff = 3; # Margin of lines to see while scrolling + splitright = true; # Vertical splits on the right side + splitbelow = true; # Horizontal splits on the bottom side + pastetoggle = ""; # Use F3 to enter raw paste mode + clipboard = "unnamedplus"; # Uses system clipboard for yanking + updatetime = 300; # Faster diagnostics + mouse = "nv"; # Mouse interaction / scrolling + inccommand = "split"; # Live preview search and replace + }; + + vim.wo = { + number = true; # Show line numbers + relativenumber = true; # Relative numbers instead of absolute + }; # Better backup, swap and undo storage vim.o.backup = true; # Easier to recover and more secure diff --git a/modules/neovim/plugins/tree.nix b/modules/neovim/plugins/tree.nix index 0dc42ba..bffa3b4 100644 --- a/modules/neovim/plugins/tree.nix +++ b/modules/neovim/plugins/tree.nix @@ -4,8 +4,10 @@ # Disable netrw eagerly # https://github.com/kyazdani42/nvim-tree.lua/commit/fb8735e96cecf004fbefb086ce85371d003c5129 - vim.g.loaded = 1; - vim.g.loaded_netrwPlugin = 1; + vim.g = { + loaded = 1; + loaded_netrwPlugin = 1; + }; setup.nvim-tree = { disable_netrw = true;