From 26575fa66e32a0bed85cb5ed2ac207fc38692936 Mon Sep 17 00:00:00 2001 From: iofq Date: Fri, 16 Aug 2024 02:09:15 -0500 Subject: [PATCH] tonight's rice --- flake.lock | 19 +++++++++++++++++- flake.nix | 4 ++++ nix/neovim-overlay.nix | 16 ++++++++++++--- nvim/after/plugin/color.lua | 20 +++++++++++-------- nvim/plugin/colors.lua | 8 -------- nvim/plugin/keymaps.lua | 1 + nvim/plugin/lsp.lua | 40 +++++++++++++++++++++++++++++++++++++ nvim/plugin/misc.lua | 9 ++++++++- nvim/plugin/neogit.lua | 7 ++++++- 9 files changed, 102 insertions(+), 22 deletions(-) diff --git a/flake.lock b/flake.lock index 505a9ab..49d6df2 100644 --- a/flake.lock +++ b/flake.lock @@ -103,7 +103,24 @@ "inputs": { "flake-utils": "flake-utils", "gen-luarc": "gen-luarc", - "nixpkgs": "nixpkgs_2" + "nixpkgs": "nixpkgs_2", + "snipe-nvim": "snipe-nvim" + } + }, + "snipe-nvim": { + "flake": false, + "locked": { + "lastModified": 1722790509, + "narHash": "sha256-DhJ2ss0p64mpaVo9rri72pEoaWbOOL05klM9AydnqJk=", + "owner": "leath-dub", + "repo": "snipe.nvim", + "rev": "854a47c970413405361487c13e2b1e9aa9a3696e", + "type": "github" + }, + "original": { + "owner": "leath-dub", + "repo": "snipe.nvim", + "type": "github" } }, "systems": { diff --git a/flake.nix b/flake.nix index a76b1fa..864835f 100644 --- a/flake.nix +++ b/flake.nix @@ -5,6 +5,10 @@ nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable"; flake-utils.url = "github:numtide/flake-utils"; gen-luarc.url = "github:mrcjkb/nix-gen-luarc-json"; + snipe-nvim = { + url = "github:leath-dub/snipe.nvim"; + flake = false; + }; }; outputs = inputs @ { diff --git a/nix/neovim-overlay.nix b/nix/neovim-overlay.nix index 701f427..ffc41ed 100644 --- a/nix/neovim-overlay.nix +++ b/nix/neovim-overlay.nix @@ -5,6 +5,13 @@ with final.pkgs.lib; let pkgs-wrapNeovim = inputs.nixpkgs.legacyPackages.${pkgs.system}; + mkNvimPlugin = src: pname: + pkgs.vimUtils.buildVimPlugin { + inherit pname src; + version = src.lastModifiedDate; + }; + snipe-nvim = mkNvimPlugin inputs.snipe-nvim "snipe-nvim"; + mkNeovim = pkgs.callPackage ./mkNeovim.nix { inherit pkgs-wrapNeovim; }; all-plugins = with pkgs.vimPlugins; [ @@ -16,8 +23,6 @@ with final.pkgs.lib; let cmp-treesitter cmp_luasnip diffview-nvim - dressing-nvim - everforest eyeliner-nvim friendly-snippets gitsigns-nvim @@ -27,6 +32,7 @@ with final.pkgs.lib; let mini-nvim neogen neogit + none-ls-nvim nightfox-nvim nvim-cmp nvim-lspconfig @@ -62,8 +68,8 @@ with final.pkgs.lib; let ])) nvim-web-devicons oil-nvim - rose-pine scope-nvim + snipe-nvim telescope-fzf-native-nvim telescope-nvim toggleterm-nvim @@ -74,9 +80,13 @@ with final.pkgs.lib; let extraPackages = with pkgs; [ ripgrep + yamllint + puppet-lint gopls pyright nil + phpactor + golangci-lint ]; in { nvim-pkg = mkNeovim { diff --git a/nvim/after/plugin/color.lua b/nvim/after/plugin/color.lua index 82447b9..c5f3a8b 100644 --- a/nvim/after/plugin/color.lua +++ b/nvim/after/plugin/color.lua @@ -1,7 +1,9 @@ -vim.keymap.set('n', 'x', '"rd', { remap = true, silent = true }) vim.cmd('colorscheme terafox') -vim.api.nvim_set_hl(0, 'TabLineSel', { ctermbg = none, underline = true }) -vim.api.nvim_set_hl(0, 'TabLine', { ctermbg = none, underline = false }) +vim.api.nvim_set_hl(0, 'GitSignsAdd', { fg = "green", bold = true }) +vim.api.nvim_set_hl(0, 'GitSignsDelete', { fg = "red", bold = true}) +vim.api.nvim_set_hl(0, 'GitSignsChange', { fg = "green", bold = true}) +vim.api.nvim_set_hl(0, 'EyelinerPrimary', { underline = true }) +vim.api.nvim_set_hl(0, 'EyelinerSecondary', { underline = true }) vim.keymap.set('n', 'aa', 'AerialToggle!', { desc = 'Toggle Aerial' }) vim.keymap.set('n', 'nb', vim.cmd.DiffviewOpen, { noremap = true, desc = '[g]it [d]iffview open' }) @@ -12,9 +14,6 @@ vim.keymap.set( { noremap = true, desc = 'Trouble diagnostics' } ) -vim.api.nvim_set_hl(0, 'EyelinerPrimary', { underline = true }) -vim.api.nvim_set_hl(0, 'EyelinerSecondary', { underline = true }) - local ts = require('telescope') ts.load_extension('aerial') vim.keymap.set( @@ -23,5 +22,10 @@ vim.keymap.set( ts.extensions.aerial.aerial, { noremap = true, silent = true, desc = 'Fuzzy find treesitter objects' } ) -require("telescope").load_extension("scope") -vim.keymap.set('n', '', 'Telescope scope buffers', { noremap = true, silent = true, desc = 'Pick buffers (scope.nvim)' }) +ts.load_extension("scope") +vim.keymap.set( + 'n', + 'fb', + 'Telescope scope buffers', + { noremap = true, silent = true, desc = 'Pick buffers (scope.nvim)' } +) diff --git a/nvim/plugin/colors.lua b/nvim/plugin/colors.lua index d76a039..3986737 100644 --- a/nvim/plugin/colors.lua +++ b/nvim/plugin/colors.lua @@ -3,14 +3,6 @@ if vim.g.did_load_colors_plugin then end vim.g.did_load_colors_plugin = true -require('rose-pine').setup { - variant = 'moon', - styles = { - bold = false, - italic = false, - transparency = true, - }, -} require('nightfox').setup { options = { transparent = true, -- Disable setting background diff --git a/nvim/plugin/keymaps.lua b/nvim/plugin/keymaps.lua index ea6cd6f..6e4bcf9 100644 --- a/nvim/plugin/keymaps.lua +++ b/nvim/plugin/keymaps.lua @@ -10,3 +10,4 @@ vim.keymap.set('n', '', 'zz') vim.keymap.set('n', '', 'zz') vim.keymap.set('n', '', 'zz') vim.keymap.set({ 'v', 'i' }, 'wq', 'l', { noremap = true, silent = true }) +vim.keymap.set('n', 'x', '"rd', { remap = true, silent = true }) diff --git a/nvim/plugin/lsp.lua b/nvim/plugin/lsp.lua index 765da6b..0fa5daa 100644 --- a/nvim/plugin/lsp.lua +++ b/nvim/plugin/lsp.lua @@ -8,6 +8,28 @@ local lspconfig = require('lspconfig') local capabilities = require('cmp_nvim_lsp').default_capabilities() lspconfig.gopls.setup { + settings = { + gopls = { + gofumpt = true, + codelenses = { + gc_details = true, + test = true, + }, + analyses = { + unusedvariable = true, + shadow = true, + }, + hints = { + assignVariableTypes = true, + constantValues = true, + functionTypeParameters = true, + rangeVariableTypes = true, + }, + usePlaceholders = true, + staticcheck = true, + }, + }, + capabilities = capabilities, on_attach = function(_, bufnr) capabilities = capabilities vim.api.nvim_command('au BufWritePre lua vim.lsp.buf.format { async = false }') @@ -15,6 +37,7 @@ lspconfig.gopls.setup { } lspconfig.pyright.setup { capabilities = capabilities } lspconfig.nil_ls.setup { capabilities = capabilities } +lspconfig.phpactor.setup { capabilities = capabilities } vim.keymap.set('n', '[d', vim.diagnostic.goto_prev, { desc = 'Prev diagnostic' }) vim.keymap.set('n', ']d', vim.diagnostic.goto_next, { desc = 'Next diagnostic' }) @@ -82,6 +105,14 @@ vim.api.nvim_create_autocmd('LspAttach', { vim.lsp.codelens.run, { buffer = ev.buf, noremap = true, silent = true, desc = 'LSP codelens' } ) + vim.keymap.set( + 'n', + 'dh', + function() + vim.lsp.inlay_hint.enable(not vim.lsp.inlay_hint.is_enabled()) + end, + { buffer = ev.buf, noremap = true, silent = true, desc = 'LSP hints toggle' } + ) vim.keymap.set('n', 'df', function() vim.lsp.buf.format { async = true } end, { buffer = ev.buf, noremap = true, silent = true, desc = 'LSP format' }) @@ -102,3 +133,12 @@ vim.api.nvim_create_autocmd('LspAttach', { end end, }) + +local none = require('null-ls') +none.setup({ + sources = { + none.builtins.diagnostics.golangci_lint, + none.builtins.diagnostics.puppet_lint, + none.builtins.diagnostics.yamllint, + }, +}) diff --git a/nvim/plugin/misc.lua b/nvim/plugin/misc.lua index 420ca4e..47ae014 100644 --- a/nvim/plugin/misc.lua +++ b/nvim/plugin/misc.lua @@ -21,7 +21,6 @@ require('which-key').setup { } require('trouble').setup {} require('eyeliner').setup {} -require('dressing').setup {} require('markview').setup() require('scope').setup {} require('neoclip').setup { default_register = '+' } @@ -31,3 +30,11 @@ vim.keymap.set( 'Telescope neoclip', { noremap = true, silent = true, desc = 'Pick clipboard history' } ) +local snipe = require("snipe") +snipe.setup({ + ui = { + position = "center", + }, + sort = "last", +}) +vim.keymap.set('n', '', snipe.open_buffer_menu, { noremap = true, silent = true, desc = 'Pick buffers (snipe.nvim)' }) diff --git a/nvim/plugin/neogit.lua b/nvim/plugin/neogit.lua index 27e8bf2..795c8e6 100644 --- a/nvim/plugin/neogit.lua +++ b/nvim/plugin/neogit.lua @@ -2,7 +2,12 @@ if vim.g.did_load_neogit_plugin then return end vim.g.did_load_neogit_plugin = true - +require("diffview").setup({ + enhanced_diff_hl = true, + default_args = { + DiffviewOpen = {"--imply-local"}, + }, +}) local neogit = require('neogit') neogit.setup { disable_builtin_notifications = true,