1
0
Fork 0

nvim: Remove legendary

... Telescope can do roughly the same thing already
This commit is contained in:
Daniel Kempkens 2022-04-23 20:51:50 +02:00
parent 073212b173
commit 6f237fea8c
8 changed files with 107 additions and 165 deletions

View file

@ -15,11 +15,13 @@
(fn mod.maybe-format-buffer [] (fn mod.maybe-format-buffer []
(let [formatprg (vim.opt_local.formatprg:get) (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) (if (= b.nifoc_lsp_formatter_enabled 1)
(vim.lsp.buf.formatting_sync nil 1000) (vim.lsp.buf.formatting_sync nil 1000)
(not= formatprg-exe nil) (not= formatprg-exe nil)
(cmd (.. "undojoin | Neoformat " formatprg-exe))))) (cmd (.. "try | undojoin | " neoformat " | catch /E790/ | " neoformat
" | endtry")))))
mod) mod)

View file

@ -1,6 +1,5 @@
(let [mod {} (let [mod {}
keymap vim.keymap keymap vim.keymap
legendary (require :legendary)
substitute (require :substitute) substitute (require :substitute)
telescope (require :telescope) telescope (require :telescope)
telescope-builtin (require :telescope.builtin) telescope-builtin (require :telescope.builtin)
@ -11,7 +10,8 @@
telescope-dropdown (telescope-themes.get_dropdown) telescope-dropdown (telescope-themes.get_dropdown)
npairs (require :nvim-autopairs) npairs (require :nvim-autopairs)
gitsigns (require :gitsigns) gitsigns (require :gitsigns)
repl (require :nifoc.repl)] repl (require :nifoc.repl)
formatting (require :nifoc.formatting)]
(fn map-entry [key cmd opts] (fn map-entry [key cmd opts]
(vim.tbl_extend :keep {1 key 2 cmd} opts)) (vim.tbl_extend :keep {1 key 2 cmd} opts))
@ -19,89 +19,63 @@
(keymap.set :n :<space> :<nop> {:noremap true}) (keymap.set :n :<space> :<nop> {:noremap true})
(set vim.g.mapleader " ") (set vim.g.mapleader " ")
(set vim.opt.timeoutlen 500) (set vim.opt.timeoutlen 500)
(legendary.bind_keymaps [(map-entry :<leader>o ;; Leader Mappings
telescope-nifoc.project-files (keymap.set :n :<leader>o telescope-nifoc.project-files
{:description "Find Files"}) {:desc "Find Files"})
(map-entry :<leader>s (keymap.set :n :<leader>s #(telescope-builtin.live_grep telescope-ivy)
#(telescope-builtin.live_grep telescope-ivy) {:desc "Live Grep"})
{:description "Live Grep"}) (keymap.set :n :<leader>fn :<cmd>enew<CR> {:desc "New File"})
(map-entry :<leader>fn :<cmd>enew<CR> (keymap.set :n :<leader>ut :<cmd>UndotreeToggle<CR>
{:description "New File"}) {:desc "Toggle Undotree"})
(map-entry :<leader>ut :<cmd>UndotreeToggle<CR> (keymap.set :n :<leader>c repl.toggle-shell {:desc "Toggle Shell"})
{:description "Toggle Undotree"}) (keymap.set :n :<leader>cs #(telescope-toggleterm.open telescope-dropdown)
(map-entry :<leader>c repl.toggle-shell {:desc "Select Terminal"})
{:description "Toggle Shell"}) (keymap.set :n :<leader>r repl.toggle-repl {:desc "Toggle REPL"})
(map-entry :<leader>cs (keymap.set :n :<leader>bl #(telescope-builtin.buffers telescope-dropdown)
#(telescope-toggleterm.open telescope-dropdown) {:desc "List Buffers"})
{:description "Select Terminal"}) (keymap.set :n :<leader>bn :<cmd>BufferLineCycleNext<CR>
(map-entry :<leader>r repl.toggle-repl {:desc "Next Buffer"})
{:description "Toggle REPL"}) (keymap.set :n :<leader>bp :<cmd>BufferLineCyclePrev<CR>
;; Buffer {:desc "Previous Buffer"})
(map-entry :<leader>bl (keymap.set :n :<leader>bf
#(telescope-builtin.buffers telescope-dropdown)
{:description "List Buffers"})
(map-entry :<leader>bn
:<cmd>BufferLineCycleNext<CR>
{:description "Next Buffer"})
(map-entry :<leader>bp
:<cmd>BufferLineCyclePrev<CR>
{:description "Previous Buffer"})
(map-entry :<leader>bf
#(telescope-builtin.current_buffer_fuzzy_find telescope-dropdown) #(telescope-builtin.current_buffer_fuzzy_find telescope-dropdown)
{:description "Find In Buffer"}) {:desc "Find In Buffer"})
(map-entry :<leader>bt (keymap.set :n :<leader>bt
#(telescope-builtin.treesitter telescope-dropdown) #(telescope-builtin.treesitter telescope-dropdown)
{:description "Find Via Treesitter"}) {:desc "Find via Treesitter"})
;; Project (keymap.set :n :<leader>pt :<cmd>TodoTelescope<CR> {:desc "TODO Comments"})
(map-entry :<leader>pt :<cmd>TodoTelescope<CR> (keymap.set :n :<leader>vs #(telescope-builtin.git_status telescope-ivy)
{:description "TODO Comments"}) {:desc "VCS Status"})
;; VCS (keymap.set :n :<leader>vb
(map-entry :<leader>vs
#(telescope-builtin.git_status telescope-ivy)
{:description "VCS Status"})
(map-entry :<leader>vb
#(telescope-builtin.git_branches telescope-dropdown) #(telescope-builtin.git_branches telescope-dropdown)
{:description "List VCS Branches"}) {:desc "List VCS Branches"})
(map-entry :<leader>vl gitsigns.blame_line (keymap.set :n :<leader>vl gitsigns.blame_line {:desc "Blame Line"})
{:description "Blame Line"}) (keymap.set :n :<leader>vn :<cmd>Neogit<CR> {:desc "Open Neogit"})
(map-entry :<leader>vn :<cmd>Neogit<CR> (keymap.set :n :<leader>vc "<cmd>Neogit commit<CR>" {:desc "Neogit Commit"})
{:description "Open Neogit"}) (keymap.set :n :<leader>vp "<cmd>Neogit pull<CR>" {:desc "Neogit Pull"})
(map-entry :<leader>vc "<cmd>Neogit commit<CR>" (keymap.set :n :<leader>vP "<cmd>Neogit push<CR>" {:desc "Neogit Push"})
{:description "Neogit Commit"}) (keymap.set :n :<leader>lk telescope-builtin.keymaps
(map-entry :<leader>vp "<cmd>Neogit pull<CR>" {:desc "Show Keymappings"})
{:description "Neogit Pull"}) (keymap.set :n :<leader>ld #(telescope-builtin.diagnostics telescope-ivy)
(map-entry :<leader>vP "<cmd>Neogit push<CR>" {:desc "Show Diagnostics"})
{:description "Neogit Push"}) (keymap.set :n :<leader>dli :<cmd>LspInfo<CR> {:desc "LSP Info"})
;; Legendary (keymap.set :n :<leader>dlr :<cmd>LspRestart<CR> {:desc "Restart LSP"})
(map-entry :<leader>lk #(legendary.find :keymaps) (keymap.set :n :<leader>dt :<cmd>TSPlaygroundToggle<CR>
{:description "Legendary Keymaps"}) {:desc "Toggle Treetsitter Playground"})
(map-entry :<leader>lc #(legendary.find :commands) (keymap.set :n :<leader>dn telescope.extensions.notify.notify
{:description "Legendary Commands"}) {:desc "Display Notifications"})
(map-entry :<leader>la #(legendary.find :autocmds)
{:description "Legendary Autocmds"})
;; Debug
(map-entry :<leader>dli :<cmd>LspInfo<CR>
{:description "LSP Info"})
(map-entry :<leader>dlr :<cmd>LspRestart<CR>
{:description "LSP Restart"})
(map-entry :<leader>dt
:<cmd>TSPlaygroundToggle<CR>
{:description "Toggle Treetsitter Playground"})
(map-entry :<leader>dn
telescope.extensions.notify.notify
{:description "Display Notifications"})])
;; Other Mappings ;; Other Mappings
(keymap.set :n :<CR> ":nohlsearch<CR><CR>" {:noremap true :silent true}) (keymap.set :n :<CR> ":nohlsearch<CR><CR>" {:silent true})
(keymap.set :i :<CR> npairs.autopairs_cr (keymap.set :i :<CR> npairs.autopairs_cr {:expr true :silent true})
{:noremap true :expr true :silent true}) (keymap.set :n :F formatting.maybe-format-buffer {:desc "Format Buffer"})
(keymap.set :n :<A-Left> :b {:noremap true}) (keymap.set :n :<A-Left> :b)
(keymap.set :n :<A-Right> :w {:noremap true}) (keymap.set :n :<A-Right> :w)
(keymap.set :n :<S-Left> "^" {:noremap true}) (keymap.set :n :<S-Left> "^")
(keymap.set :n :<S-Right> "$" {:noremap true}) (keymap.set :n :<S-Right> "$")
(keymap.set :i :<A-Left> :<C-o>b {:noremap true}) (keymap.set :i :<A-Left> :<C-o>b)
(keymap.set :i :<A-Right> :<C-o>w {:noremap true}) (keymap.set :i :<A-Right> :<C-o>w)
(keymap.set :i :<S-Left> :<C-o>^ {:noremap true}) (keymap.set :i :<S-Left> :<C-o>^)
(keymap.set :i :<S-Right> :<C-o>$ {:noremap true}) (keymap.set :i :<S-Right> :<C-o>$)
(keymap.set :n :p "<Plug>(YankyPutAfter)") (keymap.set :n :p "<Plug>(YankyPutAfter)")
(keymap.set :n :P "<Plug>(YankyPutBefore)") (keymap.set :n :P "<Plug>(YankyPutBefore)")
(keymap.set :x :p substitute.visual) (keymap.set :x :p substitute.visual)
@ -114,41 +88,26 @@
(keymap.set :x :y "<Plug>(YankyYank)")) (keymap.set :x :y "<Plug>(YankyYank)"))
(fn mod.lsp-attach [client bufnr] (fn mod.lsp-attach [client bufnr]
(legendary.bind_keymaps [(map-entry :<leader>t (keymap.set :n :<leader>t
#(telescope-builtin.lsp_document_symbols telescope-dropdown) #(telescope-builtin.lsp_document_symbols telescope-dropdown)
{:description "LSP Document Symbols" {:buffer bufnr :desc "LSP Document Symbols"})
:opts {:buffer bufnr}}) (keymap.set :n :<leader>lca
(map-entry :<leader>ld
#(telescope-builtin.diagnostics (vim.tbl_extend :keep
telescope-ivy
{: bufnr}))
{:description "LSP Document Diagnostics"
:opts {:buffer bufnr}})
(map-entry :<leader>lca
#(telescope-builtin.lsp_code_actions telescope-dropdown) #(telescope-builtin.lsp_code_actions telescope-dropdown)
{:description "LSP Code Action" {:buffer bufnr :desc "LSP Code Action"})
:opts {:buffer bufnr}}) (keymap.set :n :<leader>lfr
(map-entry :<leader>lfr
#(telescope-builtin.lsp_references telescope-dropdown) #(telescope-builtin.lsp_references telescope-dropdown)
{:description "Find References" {:buffer bufnr :desc "Find References"})
:opts {:buffer bufnr}}) (keymap.set :n :<leader>lfd
(map-entry :<leader>lfd
#(telescope-builtin.lsp_definitions telescope-dropdown) #(telescope-builtin.lsp_definitions telescope-dropdown)
{:description "Find Definitions" {:buffer bufnr :desc "Find Definitions"})
:opts {:buffer bufnr}}) (keymap.set :n :<leader>lfi
(map-entry :<leader>lfi
#(telescope-builtin.lsp_implementations telescope-dropdown) #(telescope-builtin.lsp_implementations telescope-dropdown)
{:description "Find Implementations" {:buffer bufnr :desc "Find Implementations"})
:opts {:buffer bufnr}}) (keymap.set :n :K vim.lsp.buf.hover
(map-entry :K vim.lsp.buf.hover {:buffer bufnr :desc "Show Documentation"}))
{:description "Show Documentation"
:opts {:buffer bufnr}})
(map-entry :F :<cmd>Format<CR>
{:description "Format Buffer"
:opts {:buffer bufnr}})]))
(fn mod.terminal-open [bufnr] (fn mod.terminal-open [bufnr]
(let [map-opts {:noremap true :buffer bufnr}] (let [map-opts {:buffer bufnr}]
(keymap.set :t :<esc> "<C-\\><C-n>" map-opts) (keymap.set :t :<esc> "<C-\\><C-n>" map-opts)
(keymap.set :t :<C-h> "<C-\\><C-n><C-W>h" map-opts) (keymap.set :t :<C-h> "<C-\\><C-n><C-W>h" map-opts)
(keymap.set :t :<C-j> "<C-\\><C-n><C-W>j" map-opts) (keymap.set :t :<C-j> "<C-\\><C-n><C-W>j" map-opts)

View file

@ -1,2 +0,0 @@
(let [legendary (require :legendary)]
(legendary.setup {}))

View file

@ -14,6 +14,7 @@
:extensions {:ui-select [(themes.get_dropdown {})]}}) :extensions {:ui-select [(themes.get_dropdown {})]}})
(telescope.load_extension :ui-select) (telescope.load_extension :ui-select)
(telescope.load_extension :toggleterm) (telescope.load_extension :toggleterm)
(telescope.load_extension :yank_history)
(let [augroup (vim.api.nvim_create_augroup :NifocTelescope {:clear true}) (let [augroup (vim.api.nvim_create_augroup :NifocTelescope {:clear true})
aucmd vim.api.nvim_create_autocmd] aucmd vim.api.nvim_create_autocmd]
(aucmd :FileType {:pattern :TelescopePrompt (aucmd :FileType {:pattern :TelescopePrompt

View file

@ -96,11 +96,11 @@
}, },
"locked": { "locked": {
"dir": "contrib", "dir": "contrib",
"lastModified": 1650570367, "lastModified": 1650672068,
"narHash": "sha256-eCsF9CoqEXSECL5iFND11zBuYcd5DYdT1JnQZpQGFYI=", "narHash": "sha256-lt++oCZbD3+qrdMlqVBmecckUExg9A1PhLWkImqLgPM=",
"owner": "neovim", "owner": "neovim",
"repo": "neovim", "repo": "neovim",
"rev": "6c8a3013ac8cbcbfc8b3e1d51f6491bfa0c4a7aa", "rev": "4e4914ab2e523f100c06fc5fb253f8625cc67232",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -119,11 +119,11 @@
] ]
}, },
"locked": { "locked": {
"lastModified": 1650615499, "lastModified": 1650701691,
"narHash": "sha256-LVG9E/mDHCeBoAcvC8zV68FnfdI5GWFwWyFu86iagq8=", "narHash": "sha256-JwvkAgRMtdMKQLjoBFcCu7IyAlAJUisPiksLONWGp1A=",
"owner": "nix-community", "owner": "nix-community",
"repo": "neovim-nightly-overlay", "repo": "neovim-nightly-overlay",
"rev": "245a28697c7cfc18606c50f0d4f5baedd1dd59ea", "rev": "ee0dc151a425951a0a6d95a7164b7184e6e0766a",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -154,11 +154,11 @@
}, },
"nixpkgs": { "nixpkgs": {
"locked": { "locked": {
"lastModified": 1650585041, "lastModified": 1650647760,
"narHash": "sha256-wZAZbkHwXKKdFTrDdKiFIvAtYOgQd3qO1jSSsaWlU84=", "narHash": "sha256-Ng8CGYLSTxeI+oEux0x+tSRA6K7ydoyfJNQf56ld+Uo=",
"owner": "nixos", "owner": "nixos",
"repo": "nixpkgs", "repo": "nixpkgs",
"rev": "f53f90b66921488fb3681ac78528ce407b775590", "rev": "b80f570a92d04e8ace67ff09c34aa48708a5c88c",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -186,11 +186,11 @@
] ]
}, },
"locked": { "locked": {
"lastModified": 1650588250, "lastModified": 1650674344,
"narHash": "sha256-RvfHbRbZ7FcwCtdUrhpghaNdk5oUqs1MEEUdfifIkFI=", "narHash": "sha256-9hjGLRfBw7vsSTy1Zi9OwKKsYL8xIsAwRCGMr8R91fE=",
"owner": "arqv", "owner": "arqv",
"repo": "zig-overlay", "repo": "zig-overlay",
"rev": "79ad5ae65cab7033b9483fb53329ffd1be375484", "rev": "6423fc32a68e9247ce7ed60bc77ed558a1beb426",
"type": "github" "type": "github"
}, },
"original": { "original": {

View file

@ -67,12 +67,6 @@ in
plenary-nvim plenary-nvim
# Keybindings # Keybindings
{
plugin = legendary-nvim;
config = builtins.readFile ../../config/nvim/plugins/legendary.fnl;
type = "fennel";
}
{ {
plugin = yanky-nvim; plugin = yanky-nvim;
config = builtins.readFile ../../config/nvim/plugins/yanky.fnl; config = builtins.readFile ../../config/nvim/plugins/yanky.fnl;

View file

@ -34,17 +34,6 @@
fetchSubmodules = false; 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 { yanky-nvim = pkgs.vimUtils.buildVimPluginFrom2Nix {
pname = "yanky.nvim"; pname = "yanky.nvim";
version = "2022-04-22"; version = "2022-04-22";
@ -80,12 +69,12 @@
}; };
leap-nvim = pkgs.vimUtils.buildVimPluginFrom2Nix { leap-nvim = pkgs.vimUtils.buildVimPluginFrom2Nix {
pname = "leap.nvim"; pname = "leap.nvim";
version = "2022-04-20"; version = "2022-04-23";
src = pkgs.fetchFromGitHub { src = pkgs.fetchFromGitHub {
owner = "ggandor"; owner = "ggandor";
repo = "leap.nvim"; repo = "leap.nvim";
rev = "2a7965c6ec3f5de9efde92dcec0c53f12c84732a"; rev = "73a41d195620bedf8e2293c4e22ce1379224024b";
sha256 = "0kzqg0gfw1yabxbcgg8iah8ah0dn8gk3652q2p2hfl942qrp662l"; sha256 = "1hgdhzg3qg0s1a1hdvdkkrhmvh4mjz9nasxyayxmznrxfywnqg5g";
fetchSubmodules = false; fetchSubmodules = false;
}; };
}; };
@ -102,12 +91,12 @@
}; };
nvim-treesitter = pkgs.vimUtils.buildVimPluginFrom2Nix { nvim-treesitter = pkgs.vimUtils.buildVimPluginFrom2Nix {
pname = "nvim-treesitter"; pname = "nvim-treesitter";
version = "2022-04-22"; version = "2022-04-23";
src = pkgs.fetchFromGitHub { src = pkgs.fetchFromGitHub {
owner = "nvim-treesitter"; owner = "nvim-treesitter";
repo = "nvim-treesitter"; repo = "nvim-treesitter";
rev = "3c50297eca950b4b1a7c07b28e586b0576c0a796"; rev = "909b5d26fddad5043e354046571e7c7353b53b61";
sha256 = "1jkrd5z85hsqg05br39pyv7sjpn2g3warg70s5arm0xxppc5m9pc"; sha256 = "1x1b7r73g41nqra4bar0k8alzawzc81xxcgj9cw05r3504imvnf4";
fetchSubmodules = false; fetchSubmodules = false;
}; };
}; };
@ -135,12 +124,12 @@
}; };
telescope-nvim = pkgs.vimUtils.buildVimPluginFrom2Nix { telescope-nvim = pkgs.vimUtils.buildVimPluginFrom2Nix {
pname = "telescope.nvim"; pname = "telescope.nvim";
version = "2022-04-20"; version = "2022-04-22";
src = pkgs.fetchFromGitHub { src = pkgs.fetchFromGitHub {
owner = "nvim-telescope"; owner = "nvim-telescope";
repo = "telescope.nvim"; repo = "telescope.nvim";
rev = "92019d5053674676576b021904935d101b059fd5"; rev = "8b02088743c07c2f82aec2772fbd2b3774195448";
sha256 = "03wl6jn6j07iqmm09x3qwd4k5fhhd46lx8n1iab6srnvcarx7kaa"; sha256 = "1ir6w7czd6xqk80nmppnpmykal78n8bjl1vjccp80zllrx3cidc7";
fetchSubmodules = false; fetchSubmodules = false;
}; };
}; };
@ -329,12 +318,12 @@
}; };
nvim-autopairs = pkgs.vimUtils.buildVimPluginFrom2Nix { nvim-autopairs = pkgs.vimUtils.buildVimPluginFrom2Nix {
pname = "nvim-autopairs"; pname = "nvim-autopairs";
version = "2022-04-22"; version = "2022-04-23";
src = pkgs.fetchFromGitHub { src = pkgs.fetchFromGitHub {
owner = "windwp"; owner = "windwp";
repo = "nvim-autopairs"; repo = "nvim-autopairs";
rev = "e9b47f0f681f94cedd8af671b363dd2497a22c5c"; rev = "3d7b552eb4db6a3e081bf791e9e03e0dd58b7152";
sha256 = "09hbgb233szzbjmrdmkz9znxa6wpi3n06zvq2g7kqzisz87fd8bw"; sha256 = "1w7pik465dlwpfv5nw2yg2y7g8j06rxvqg2w2cdax7d1h75jgmiv";
fetchSubmodules = false; fetchSubmodules = false;
}; };
}; };
@ -432,8 +421,8 @@
src = pkgs.fetchFromGitHub { src = pkgs.fetchFromGitHub {
owner = "lewis6991"; owner = "lewis6991";
repo = "gitsigns.nvim"; repo = "gitsigns.nvim";
rev = "f2243468ee14f69df48e7de61f866889df8b17a7"; rev = "ead0d48df801431b990d6b91fa210f7efa30ac38";
sha256 = "0lfbgwnc8i4q2qymswja9d4mwlgzzvrzzy5vwpjk4r4zzps7lrw3"; sha256 = "1iq99bri0x38i641bn6xs9lhxjy1wgqzr6r1scbw2z6g1psqxq22";
fetchSubmodules = false; fetchSubmodules = false;
}; };
}; };

View file

@ -6,7 +6,6 @@
- src: nvim-lua/plenary.nvim - src: nvim-lua/plenary.nvim
# Keybindings # Keybindings
- src: mrjones2014/legendary.nvim
- src: gbprod/yanky.nvim - src: gbprod/yanky.nvim
- src: gbprod/cutlass.nvim - src: gbprod/cutlass.nvim
- src: gbprod/substitute.nvim - src: gbprod/substitute.nvim