diff --git a/config/nvim/nifoc/formatting.fnl b/config/nvim/nifoc/formatting.fnl index d051f66..fb0b174 100644 --- a/config/nvim/nifoc/formatting.fnl +++ b/config/nvim/nifoc/formatting.fnl @@ -15,11 +15,13 @@ (fn mod.maybe-format-buffer [] (let [formatprg (vim.opt_local.formatprg:get) - formatprg-exe (-> formatprg (vim.split " " {:trimempty true}) (. 1))] + formatprg-exe (-> formatprg (vim.split " " {:trimempty true}) (. 1)) + neoformat (.. "Neoformat " formatprg-exe)] (if (= b.nifoc_lsp_formatter_enabled 1) (vim.lsp.buf.formatting_sync nil 1000) (not= formatprg-exe nil) - (cmd (.. "undojoin | Neoformat " formatprg-exe))))) + (cmd (.. "try | undojoin | " neoformat " | catch /E790/ | " neoformat + " | endtry"))))) mod) diff --git a/config/nvim/nifoc/keymap.fnl b/config/nvim/nifoc/keymap.fnl index 71218df..f0a3d96 100644 --- a/config/nvim/nifoc/keymap.fnl +++ b/config/nvim/nifoc/keymap.fnl @@ -1,6 +1,5 @@ (let [mod {} keymap vim.keymap - legendary (require :legendary) substitute (require :substitute) telescope (require :telescope) telescope-builtin (require :telescope.builtin) @@ -11,7 +10,8 @@ telescope-dropdown (telescope-themes.get_dropdown) npairs (require :nvim-autopairs) gitsigns (require :gitsigns) - repl (require :nifoc.repl)] + repl (require :nifoc.repl) + formatting (require :nifoc.formatting)] (fn map-entry [key cmd opts] (vim.tbl_extend :keep {1 key 2 cmd} opts)) @@ -19,89 +19,63 @@ (keymap.set :n : : {:noremap true}) (set vim.g.mapleader " ") (set vim.opt.timeoutlen 500) - (legendary.bind_keymaps [(map-entry :o - telescope-nifoc.project-files - {:description "Find Files"}) - (map-entry :s - #(telescope-builtin.live_grep telescope-ivy) - {:description "Live Grep"}) - (map-entry :fn :enew - {:description "New File"}) - (map-entry :ut :UndotreeToggle - {:description "Toggle Undotree"}) - (map-entry :c repl.toggle-shell - {:description "Toggle Shell"}) - (map-entry :cs - #(telescope-toggleterm.open telescope-dropdown) - {:description "Select Terminal"}) - (map-entry :r repl.toggle-repl - {:description "Toggle REPL"}) - ;; Buffer - (map-entry :bl - #(telescope-builtin.buffers telescope-dropdown) - {:description "List Buffers"}) - (map-entry :bn - :BufferLineCycleNext - {:description "Next Buffer"}) - (map-entry :bp - :BufferLineCyclePrev - {:description "Previous Buffer"}) - (map-entry :bf - #(telescope-builtin.current_buffer_fuzzy_find telescope-dropdown) - {:description "Find In Buffer"}) - (map-entry :bt - #(telescope-builtin.treesitter telescope-dropdown) - {:description "Find Via Treesitter"}) - ;; Project - (map-entry :pt :TodoTelescope - {:description "TODO Comments"}) - ;; VCS - (map-entry :vs - #(telescope-builtin.git_status telescope-ivy) - {:description "VCS Status"}) - (map-entry :vb - #(telescope-builtin.git_branches telescope-dropdown) - {:description "List VCS Branches"}) - (map-entry :vl gitsigns.blame_line - {:description "Blame Line"}) - (map-entry :vn :Neogit - {:description "Open Neogit"}) - (map-entry :vc "Neogit commit" - {:description "Neogit Commit"}) - (map-entry :vp "Neogit pull" - {:description "Neogit Pull"}) - (map-entry :vP "Neogit push" - {:description "Neogit Push"}) - ;; Legendary - (map-entry :lk #(legendary.find :keymaps) - {:description "Legendary Keymaps"}) - (map-entry :lc #(legendary.find :commands) - {:description "Legendary Commands"}) - (map-entry :la #(legendary.find :autocmds) - {:description "Legendary Autocmds"}) - ;; Debug - (map-entry :dli :LspInfo - {:description "LSP Info"}) - (map-entry :dlr :LspRestart - {:description "LSP Restart"}) - (map-entry :dt - :TSPlaygroundToggle - {:description "Toggle Treetsitter Playground"}) - (map-entry :dn - telescope.extensions.notify.notify - {:description "Display Notifications"})]) + ;; Leader Mappings + (keymap.set :n :o telescope-nifoc.project-files + {:desc "Find Files"}) + (keymap.set :n :s #(telescope-builtin.live_grep telescope-ivy) + {:desc "Live Grep"}) + (keymap.set :n :fn :enew {:desc "New File"}) + (keymap.set :n :ut :UndotreeToggle + {:desc "Toggle Undotree"}) + (keymap.set :n :c repl.toggle-shell {:desc "Toggle Shell"}) + (keymap.set :n :cs #(telescope-toggleterm.open telescope-dropdown) + {:desc "Select Terminal"}) + (keymap.set :n :r repl.toggle-repl {:desc "Toggle REPL"}) + (keymap.set :n :bl #(telescope-builtin.buffers telescope-dropdown) + {:desc "List Buffers"}) + (keymap.set :n :bn :BufferLineCycleNext + {:desc "Next Buffer"}) + (keymap.set :n :bp :BufferLineCyclePrev + {:desc "Previous Buffer"}) + (keymap.set :n :bf + #(telescope-builtin.current_buffer_fuzzy_find telescope-dropdown) + {:desc "Find In Buffer"}) + (keymap.set :n :bt + #(telescope-builtin.treesitter telescope-dropdown) + {:desc "Find via Treesitter"}) + (keymap.set :n :pt :TodoTelescope {:desc "TODO Comments"}) + (keymap.set :n :vs #(telescope-builtin.git_status telescope-ivy) + {:desc "VCS Status"}) + (keymap.set :n :vb + #(telescope-builtin.git_branches telescope-dropdown) + {:desc "List VCS Branches"}) + (keymap.set :n :vl gitsigns.blame_line {:desc "Blame Line"}) + (keymap.set :n :vn :Neogit {:desc "Open Neogit"}) + (keymap.set :n :vc "Neogit commit" {:desc "Neogit Commit"}) + (keymap.set :n :vp "Neogit pull" {:desc "Neogit Pull"}) + (keymap.set :n :vP "Neogit push" {:desc "Neogit Push"}) + (keymap.set :n :lk telescope-builtin.keymaps + {:desc "Show Keymappings"}) + (keymap.set :n :ld #(telescope-builtin.diagnostics telescope-ivy) + {:desc "Show Diagnostics"}) + (keymap.set :n :dli :LspInfo {:desc "LSP Info"}) + (keymap.set :n :dlr :LspRestart {:desc "Restart LSP"}) + (keymap.set :n :dt :TSPlaygroundToggle + {:desc "Toggle Treetsitter Playground"}) + (keymap.set :n :dn telescope.extensions.notify.notify + {:desc "Display Notifications"}) ;; Other Mappings - (keymap.set :n : ":nohlsearch" {:noremap true :silent true}) - (keymap.set :i : npairs.autopairs_cr - {:noremap true :expr true :silent true}) - (keymap.set :n : :b {:noremap true}) - (keymap.set :n : :w {:noremap true}) - (keymap.set :n : "^" {:noremap true}) - (keymap.set :n : "$" {:noremap true}) - (keymap.set :i : :b {:noremap true}) - (keymap.set :i : :w {:noremap true}) - (keymap.set :i : :^ {:noremap true}) - (keymap.set :i : :$ {:noremap true}) + (keymap.set :n : ":nohlsearch" {:silent true}) + (keymap.set :i : npairs.autopairs_cr {:expr true :silent true}) + (keymap.set :n :F formatting.maybe-format-buffer {:desc "Format Buffer"}) + (keymap.set :n : :b) + (keymap.set :n : :w) + (keymap.set :n : "^") + (keymap.set :n : "$") + (keymap.set :i : :b) + (keymap.set :i : :w) + (keymap.set :i : :^) + (keymap.set :i : :$) (keymap.set :n :p "(YankyPutAfter)") (keymap.set :n :P "(YankyPutBefore)") (keymap.set :x :p substitute.visual) @@ -114,41 +88,26 @@ (keymap.set :x :y "(YankyYank)")) (fn mod.lsp-attach [client bufnr] - (legendary.bind_keymaps [(map-entry :t - #(telescope-builtin.lsp_document_symbols telescope-dropdown) - {:description "LSP Document Symbols" - :opts {:buffer bufnr}}) - (map-entry :ld - #(telescope-builtin.diagnostics (vim.tbl_extend :keep - telescope-ivy - {: bufnr})) - {:description "LSP Document Diagnostics" - :opts {:buffer bufnr}}) - (map-entry :lca - #(telescope-builtin.lsp_code_actions telescope-dropdown) - {:description "LSP Code Action" - :opts {:buffer bufnr}}) - (map-entry :lfr - #(telescope-builtin.lsp_references telescope-dropdown) - {:description "Find References" - :opts {:buffer bufnr}}) - (map-entry :lfd - #(telescope-builtin.lsp_definitions telescope-dropdown) - {:description "Find Definitions" - :opts {:buffer bufnr}}) - (map-entry :lfi - #(telescope-builtin.lsp_implementations telescope-dropdown) - {:description "Find Implementations" - :opts {:buffer bufnr}}) - (map-entry :K vim.lsp.buf.hover - {:description "Show Documentation" - :opts {:buffer bufnr}}) - (map-entry :F :Format - {:description "Format Buffer" - :opts {:buffer bufnr}})])) + (keymap.set :n :t + #(telescope-builtin.lsp_document_symbols telescope-dropdown) + {:buffer bufnr :desc "LSP Document Symbols"}) + (keymap.set :n :lca + #(telescope-builtin.lsp_code_actions telescope-dropdown) + {:buffer bufnr :desc "LSP Code Action"}) + (keymap.set :n :lfr + #(telescope-builtin.lsp_references telescope-dropdown) + {:buffer bufnr :desc "Find References"}) + (keymap.set :n :lfd + #(telescope-builtin.lsp_definitions telescope-dropdown) + {:buffer bufnr :desc "Find Definitions"}) + (keymap.set :n :lfi + #(telescope-builtin.lsp_implementations telescope-dropdown) + {:buffer bufnr :desc "Find Implementations"}) + (keymap.set :n :K vim.lsp.buf.hover + {:buffer bufnr :desc "Show Documentation"})) (fn mod.terminal-open [bufnr] - (let [map-opts {:noremap true :buffer bufnr}] + (let [map-opts {:buffer bufnr}] (keymap.set :t : "" map-opts) (keymap.set :t : "h" map-opts) (keymap.set :t : "j" map-opts) diff --git a/config/nvim/plugins/legendary.fnl b/config/nvim/plugins/legendary.fnl deleted file mode 100644 index dee324b..0000000 --- a/config/nvim/plugins/legendary.fnl +++ /dev/null @@ -1,2 +0,0 @@ -(let [legendary (require :legendary)] - (legendary.setup {})) diff --git a/config/nvim/plugins/telescope.fnl b/config/nvim/plugins/telescope.fnl index 46ec8eb..12c9462 100644 --- a/config/nvim/plugins/telescope.fnl +++ b/config/nvim/plugins/telescope.fnl @@ -14,6 +14,7 @@ :extensions {:ui-select [(themes.get_dropdown {})]}}) (telescope.load_extension :ui-select) (telescope.load_extension :toggleterm) + (telescope.load_extension :yank_history) (let [augroup (vim.api.nvim_create_augroup :NifocTelescope {:clear true}) aucmd vim.api.nvim_create_autocmd] (aucmd :FileType {:pattern :TelescopePrompt diff --git a/flake.lock b/flake.lock index 1302f06..85e28e0 100644 --- a/flake.lock +++ b/flake.lock @@ -96,11 +96,11 @@ }, "locked": { "dir": "contrib", - "lastModified": 1650570367, - "narHash": "sha256-eCsF9CoqEXSECL5iFND11zBuYcd5DYdT1JnQZpQGFYI=", + "lastModified": 1650672068, + "narHash": "sha256-lt++oCZbD3+qrdMlqVBmecckUExg9A1PhLWkImqLgPM=", "owner": "neovim", "repo": "neovim", - "rev": "6c8a3013ac8cbcbfc8b3e1d51f6491bfa0c4a7aa", + "rev": "4e4914ab2e523f100c06fc5fb253f8625cc67232", "type": "github" }, "original": { @@ -119,11 +119,11 @@ ] }, "locked": { - "lastModified": 1650615499, - "narHash": "sha256-LVG9E/mDHCeBoAcvC8zV68FnfdI5GWFwWyFu86iagq8=", + "lastModified": 1650701691, + "narHash": "sha256-JwvkAgRMtdMKQLjoBFcCu7IyAlAJUisPiksLONWGp1A=", "owner": "nix-community", "repo": "neovim-nightly-overlay", - "rev": "245a28697c7cfc18606c50f0d4f5baedd1dd59ea", + "rev": "ee0dc151a425951a0a6d95a7164b7184e6e0766a", "type": "github" }, "original": { @@ -154,11 +154,11 @@ }, "nixpkgs": { "locked": { - "lastModified": 1650585041, - "narHash": "sha256-wZAZbkHwXKKdFTrDdKiFIvAtYOgQd3qO1jSSsaWlU84=", + "lastModified": 1650647760, + "narHash": "sha256-Ng8CGYLSTxeI+oEux0x+tSRA6K7ydoyfJNQf56ld+Uo=", "owner": "nixos", "repo": "nixpkgs", - "rev": "f53f90b66921488fb3681ac78528ce407b775590", + "rev": "b80f570a92d04e8ace67ff09c34aa48708a5c88c", "type": "github" }, "original": { @@ -186,11 +186,11 @@ ] }, "locked": { - "lastModified": 1650588250, - "narHash": "sha256-RvfHbRbZ7FcwCtdUrhpghaNdk5oUqs1MEEUdfifIkFI=", + "lastModified": 1650674344, + "narHash": "sha256-9hjGLRfBw7vsSTy1Zi9OwKKsYL8xIsAwRCGMr8R91fE=", "owner": "arqv", "repo": "zig-overlay", - "rev": "79ad5ae65cab7033b9483fb53329ffd1be375484", + "rev": "6423fc32a68e9247ce7ed60bc77ed558a1beb426", "type": "github" }, "original": { diff --git a/programs/nvim/default.nix b/programs/nvim/default.nix index b8d73bb..e7fcf6e 100644 --- a/programs/nvim/default.nix +++ b/programs/nvim/default.nix @@ -67,12 +67,6 @@ in plenary-nvim # Keybindings - { - plugin = legendary-nvim; - config = builtins.readFile ../../config/nvim/plugins/legendary.fnl; - type = "fennel"; - } - { plugin = yanky-nvim; config = builtins.readFile ../../config/nvim/plugins/yanky.fnl; diff --git a/programs/nvim/plugins.nix b/programs/nvim/plugins.nix index 50e4c3f..e3a33a0 100644 --- a/programs/nvim/plugins.nix +++ b/programs/nvim/plugins.nix @@ -34,17 +34,6 @@ fetchSubmodules = false; }; }; - legendary-nvim = pkgs.vimUtils.buildVimPluginFrom2Nix { - pname = "legendary.nvim"; - version = "2022-04-19"; - src = pkgs.fetchFromGitHub { - owner = "mrjones2014"; - repo = "legendary.nvim"; - rev = "77b7bc365c2470aff48b7398eb940e8c88789af3"; - sha256 = "0wxfwqs50jg59qf4lrbkbxpsh4f1kswmcfd01kvjz6wpnfg6c1b1"; - fetchSubmodules = false; - }; - }; yanky-nvim = pkgs.vimUtils.buildVimPluginFrom2Nix { pname = "yanky.nvim"; version = "2022-04-22"; @@ -80,12 +69,12 @@ }; leap-nvim = pkgs.vimUtils.buildVimPluginFrom2Nix { pname = "leap.nvim"; - version = "2022-04-20"; + version = "2022-04-23"; src = pkgs.fetchFromGitHub { owner = "ggandor"; repo = "leap.nvim"; - rev = "2a7965c6ec3f5de9efde92dcec0c53f12c84732a"; - sha256 = "0kzqg0gfw1yabxbcgg8iah8ah0dn8gk3652q2p2hfl942qrp662l"; + rev = "73a41d195620bedf8e2293c4e22ce1379224024b"; + sha256 = "1hgdhzg3qg0s1a1hdvdkkrhmvh4mjz9nasxyayxmznrxfywnqg5g"; fetchSubmodules = false; }; }; @@ -102,12 +91,12 @@ }; nvim-treesitter = pkgs.vimUtils.buildVimPluginFrom2Nix { pname = "nvim-treesitter"; - version = "2022-04-22"; + version = "2022-04-23"; src = pkgs.fetchFromGitHub { owner = "nvim-treesitter"; repo = "nvim-treesitter"; - rev = "3c50297eca950b4b1a7c07b28e586b0576c0a796"; - sha256 = "1jkrd5z85hsqg05br39pyv7sjpn2g3warg70s5arm0xxppc5m9pc"; + rev = "909b5d26fddad5043e354046571e7c7353b53b61"; + sha256 = "1x1b7r73g41nqra4bar0k8alzawzc81xxcgj9cw05r3504imvnf4"; fetchSubmodules = false; }; }; @@ -135,12 +124,12 @@ }; telescope-nvim = pkgs.vimUtils.buildVimPluginFrom2Nix { pname = "telescope.nvim"; - version = "2022-04-20"; + version = "2022-04-22"; src = pkgs.fetchFromGitHub { owner = "nvim-telescope"; repo = "telescope.nvim"; - rev = "92019d5053674676576b021904935d101b059fd5"; - sha256 = "03wl6jn6j07iqmm09x3qwd4k5fhhd46lx8n1iab6srnvcarx7kaa"; + rev = "8b02088743c07c2f82aec2772fbd2b3774195448"; + sha256 = "1ir6w7czd6xqk80nmppnpmykal78n8bjl1vjccp80zllrx3cidc7"; fetchSubmodules = false; }; }; @@ -329,12 +318,12 @@ }; nvim-autopairs = pkgs.vimUtils.buildVimPluginFrom2Nix { pname = "nvim-autopairs"; - version = "2022-04-22"; + version = "2022-04-23"; src = pkgs.fetchFromGitHub { owner = "windwp"; repo = "nvim-autopairs"; - rev = "e9b47f0f681f94cedd8af671b363dd2497a22c5c"; - sha256 = "09hbgb233szzbjmrdmkz9znxa6wpi3n06zvq2g7kqzisz87fd8bw"; + rev = "3d7b552eb4db6a3e081bf791e9e03e0dd58b7152"; + sha256 = "1w7pik465dlwpfv5nw2yg2y7g8j06rxvqg2w2cdax7d1h75jgmiv"; fetchSubmodules = false; }; }; @@ -432,8 +421,8 @@ src = pkgs.fetchFromGitHub { owner = "lewis6991"; repo = "gitsigns.nvim"; - rev = "f2243468ee14f69df48e7de61f866889df8b17a7"; - sha256 = "0lfbgwnc8i4q2qymswja9d4mwlgzzvrzzy5vwpjk4r4zzps7lrw3"; + rev = "ead0d48df801431b990d6b91fa210f7efa30ac38"; + sha256 = "1iq99bri0x38i641bn6xs9lhxjy1wgqzr6r1scbw2z6g1psqxq22"; fetchSubmodules = false; }; }; diff --git a/programs/nvim/plugins.yaml b/programs/nvim/plugins.yaml index 8fd07dd..5c05c9f 100644 --- a/programs/nvim/plugins.yaml +++ b/programs/nvim/plugins.yaml @@ -6,7 +6,6 @@ - src: nvim-lua/plenary.nvim # Keybindings -- src: mrjones2014/legendary.nvim - src: gbprod/yanky.nvim - src: gbprod/cutlass.nvim - src: gbprod/substitute.nvim