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 []
(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)

View file

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

View file

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

View file

@ -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

View file

@ -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": {

View file

@ -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;

View file

@ -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;
};
};

View file

@ -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