mirror of
https://github.com/ryan4yin/nix-config.git
synced 2026-03-23 18:01:25 +01:00
feat: neovim - more plugins
This commit is contained in:
@@ -66,24 +66,40 @@ return {
|
||||
end,
|
||||
},
|
||||
|
||||
---- Nushell
|
||||
-- Enhanced matchparen.vim plugin for Neovim to highlight the outer pair.
|
||||
{
|
||||
"LhKipp/nvim-nu",
|
||||
"utilyre/sentiment.nvim",
|
||||
version = "*",
|
||||
event = "VeryLazy", -- keep for lazy loading
|
||||
opts = {
|
||||
-- config
|
||||
},
|
||||
init = function()
|
||||
-- `matchparen.vim` needs to be disabled manually in case of lazy loading
|
||||
vim.g.loaded_matchparen = 1
|
||||
end,
|
||||
},
|
||||
|
||||
-- joining blocks of code into oneline, or splitting one line into multiple lines.
|
||||
{
|
||||
'Wansmer/treesj',
|
||||
keys = { '<space>m', '<space>j', '<space>s' },
|
||||
dependencies = { 'nvim-treesitter/nvim-treesitter' },
|
||||
config = function()
|
||||
require'nu'.setup({
|
||||
use_lsp_features = true, -- requires https://github.com/jose-elias-alvarez/null-ls.nvim
|
||||
-- lsp_feature: all_cmd_names is the source for the cmd name completion.
|
||||
-- It can be
|
||||
-- * a string, which is interpreted as a shell command and the returned list is the source for completions (requires plenary.nvim)
|
||||
-- * a list, which is the direct source for completions (e.G. all_cmd_names = {"echo", "to csv", ...})
|
||||
-- * a function, returning a list of strings and the return value is used as the source for completions
|
||||
all_cmd_names = [[nu -c 'help commands | get name | str join "\n"']]
|
||||
require('treesj').setup({--[[ your config ]]})
|
||||
end,
|
||||
},
|
||||
|
||||
-- clipboard history manager
|
||||
{
|
||||
"gbprod/yanky.nvim",
|
||||
config = function()
|
||||
require("yanky").setup({
|
||||
-- your configuration comes here
|
||||
-- or leave it empty to use the default settings
|
||||
-- refer to the configuration section below
|
||||
})
|
||||
end,
|
||||
dependencies = {
|
||||
{"nvim-treesitter/nvim-treesitter"},
|
||||
{ "jose-elias-alvarez/null-ls.nvim"},
|
||||
}
|
||||
},
|
||||
|
||||
-- File explorer(Custom configs)
|
||||
@@ -135,6 +151,17 @@ return {
|
||||
end,
|
||||
},
|
||||
|
||||
-- implementation/definition preview
|
||||
{
|
||||
'rmagatti/goto-preview',
|
||||
config = function()
|
||||
require('goto-preview').setup {}
|
||||
end
|
||||
},
|
||||
|
||||
-- Undo tree
|
||||
{ "debugloop/telescope-undo.nvim", },
|
||||
|
||||
-- Install lsp, formmatter and others via home manager instead of Mason.nvim
|
||||
-- LSP installations
|
||||
{
|
||||
@@ -215,6 +242,18 @@ return {
|
||||
opts.automatic_installation = false
|
||||
end,
|
||||
},
|
||||
|
||||
-- Fast and feature-rich surround actions
|
||||
{
|
||||
"kylechui/nvim-surround",
|
||||
version = "*", -- Use for stability; omit to use `main` branch for the latest features
|
||||
event = "VeryLazy",
|
||||
config = function()
|
||||
require("nvim-surround").setup({
|
||||
-- Configuration here, or leave empty to use defaults
|
||||
})
|
||||
end
|
||||
},
|
||||
},
|
||||
|
||||
-- Configure require("lazy").setup() options
|
||||
|
||||
@@ -4,7 +4,11 @@
|
||||
-- lower level configuration and more robust one. (which-key will
|
||||
-- automatically pick-up stored data by this setting.)
|
||||
local utils = require "astronvim.utils"
|
||||
|
||||
require("telescope").load_extension("refactoring")
|
||||
require("telescope").load_extension("yank_history")
|
||||
require("telescope").load_extension("undo")
|
||||
|
||||
return {
|
||||
-- first key is the mode
|
||||
n = {
|
||||
@@ -21,13 +25,28 @@ return {
|
||||
['<leader>sp'] ={'<cmd>lua require("spectre").open_file_search({select_word=true})<CR>', desc = "Search on current file" },
|
||||
|
||||
-- refactoring
|
||||
["<leader>ri"] = { function() require('refactoring').refactor('Inline Variable') end, desc = "Refactoring Inline Variable" },
|
||||
["<leader>ri"] = { function() require('refactoring').refactor('Inline Variable') end, desc = "Inverse of extract variable" },
|
||||
["<leader>rb"] = { function() require('refactoring').refactor('Extract Block') end, desc = "Extract Block" },
|
||||
["<leader>rbf"] = { function() require('refactoring').refactor('Extract Block To File') end, desc = "Extract Block To File" },
|
||||
["<leader>rr"] = { function() require('telescope').extensions.refactoring.refactors() end, desc = "Prompt for a refactor to apply" },
|
||||
["<leader>rp"] = { function() require('refactoring').debug.printf({below = false}) end, desc = "Print debug info" },
|
||||
["<leader>rv"] = { function() require('refactoring').debug.print_var() end, desc = "Print debug var" },
|
||||
["<leader>rc"] = { function() require('refactoring').debug.cleanup({}) end, desc = "Cleanup debugging" },
|
||||
["<leader>rp"] = { function() require('refactoring').debug.printf({below = false}) end, desc = "Insert print statement to mark the calling of a function" },
|
||||
["<leader>rv"] = { function() require('refactoring').debug.print_var() end, desc = "Insert print statement to print a variable" },
|
||||
["<leader>rc"] = { function() require('refactoring').debug.cleanup({}) end, desc = "Cleanup of all generated print statements" },
|
||||
|
||||
-- yank_history
|
||||
["<leader>yh"] = { function() require("telescope").extensions.yank_history.yank_history() end, desc = "Preview Yank History" },
|
||||
["p"] = {"<Plug>(YankyPutAfter)", desc="YankyPutAfter" },
|
||||
["P"] = {"<Plug>(YankyPutBefore)", desc="YankyPutBefore" },
|
||||
|
||||
-- undo history
|
||||
["<leader>uh"] = {"<cmd>Telescope undo<cr>", desc="Telescope undo" },
|
||||
|
||||
-- implementation/definition preview
|
||||
["gpd"] = { "<cmd>lua require('goto-preview').goto_preview_definition()<CR>", desc="goto_preview_definition" },
|
||||
["gpt"] = { "<cmd>lua require('goto-preview').goto_preview_type_definition()<CR>", desc="goto_preview_type_definition" },
|
||||
["gpi"] = { "<cmd>lua require('goto-preview').goto_preview_implementation()<CR>", desc="goto_preview_implementation" },
|
||||
["gP" ] = { "<cmd>lua require('goto-preview').close_all_win()<CR>", desc="close_all_win" },
|
||||
["gpr"] = { "<cmd>lua require('goto-preview').goto_preview_references()<CR>", desc="goto_preview_references" },
|
||||
},
|
||||
v = {
|
||||
-- search and replace globally
|
||||
@@ -35,11 +54,15 @@ return {
|
||||
},
|
||||
x = {
|
||||
-- refactoring
|
||||
["<leader>ri"] = { function() require('refactoring').refactor('Inline Variable') end, desc = "Refactoring Inline Variable" },
|
||||
["<leader>re"] = { function() require('refactoring').refactor('Extract Function') end, desc = "Extract Function" },
|
||||
["<leader>ri"] = { function() require('refactoring').refactor('Inline Variable') end, desc = "Inverse of extract variable" },
|
||||
["<leader>re"] = { function() require('refactoring').refactor('Extract Function') end, desc = "Extracts the selected code to a separate function" },
|
||||
["<leader>rf"] = { function() require('refactoring').refactor('Extract Function To File') end, desc = "Extract Function To File" },
|
||||
["<leader>rv"] = { function() require('refactoring').refactor('Extract Variable') end, desc = "Extract Variable" },
|
||||
["<leader>rv"] = { function() require('refactoring').refactor('Extract Variable') end, desc = "Extracts occurrences of a selected expression to its own variable" },
|
||||
["<leader>rr"] = { function() require('telescope').extensions.refactoring.refactors() end, desc = "Prompt for a refactor to apply" },
|
||||
|
||||
-- yank_history
|
||||
["p"] = {"<Plug>(YankyPutAfter)", desc="YankyPutAfter" },
|
||||
["P"] = {"<Plug>(YankyPutBefore)", desc="YankyPutBefore" },
|
||||
},
|
||||
t = {
|
||||
-- setting a mapping to false will disable it
|
||||
|
||||
@@ -35,10 +35,11 @@
|
||||
# Horizontal Split Terminal: `<Space> + th`
|
||||
# Vertical Split Terminal: `<Space> + tv`
|
||||
# Open IPython REPL: `<Space> + tp`
|
||||
# Opening LSP symbols: `<Space> + lS`
|
||||
# Toggle line wrap: `<Space> + uw`
|
||||
# Show line diagnostics: `gl`
|
||||
# Show function/variable info: `K`
|
||||
# Go to definition: `gd`
|
||||
# References of a symbol: `gr`
|
||||
#
|
||||
# Switching between windows: `<Ctrl> + h/j/k/l`
|
||||
# Resizing windows: `<Ctrl> + Up/Down/Left/Right`
|
||||
@@ -52,10 +53,11 @@
|
||||
#
|
||||
# Toggle buffer auto formatting: `<Space> + uf`
|
||||
# Format Document: `<Space> + lf`
|
||||
# Comment Line: `<Space> + /`
|
||||
# Can be used in visual mode
|
||||
# Code Actions: `<Space> + la`
|
||||
# Rename: `<Space> + lr`
|
||||
# Opening LSP symbols: `<Space> + lS`
|
||||
# Comment Line: `<Space> + /`
|
||||
# Can be used in visual mode
|
||||
# Open filepath/URL at cursor: `gx`
|
||||
# This is a neovim builtin command
|
||||
# Find files by name(fzf): `<Space> + ff`
|
||||
@@ -89,17 +91,26 @@
|
||||
# 1. Open Spectre search and replace panel: `<Space> + ss`
|
||||
# 2. search and replace in command line: `find -name "*.nix" | sad '<pattern>' '<replacement>' | delta`
|
||||
#
|
||||
# Add surrounding characters: `ysiw'` (will add `'` around the word under cursor)
|
||||
# Delete surrounding characters: `ds'` (will delete `'` around the word under cursor)
|
||||
# Change surrounding characters: `cs'"` (will change `'` to `"` around the word under cursor)
|
||||
#
|
||||
# Joining a Selection of Lines With Space: `:join`
|
||||
# Joining without spaces: `:join!`
|
||||
# Join with lsp intellegence(treesj): `<Space> + j`
|
||||
# Splitting a Line into Multiple Lines(treesj): `<Space> + s`
|
||||
#
|
||||
# Toggle text's case: `~`
|
||||
# Convert to uppercase: `U`
|
||||
# Convert to lowercase: `u`
|
||||
#
|
||||
# Save the selected text to a file: `:w filename` (will show `:'<,'>w filename`)
|
||||
# Show all Yank History: `:<Space> + yh`
|
||||
# Show undo history: `:<Space> + uh`
|
||||
#
|
||||
# ......
|
||||
# See https://astronvim.com/Basic%20Usage/walkthrough
|
||||
# And ./astronvim_user/mapping.lua
|
||||
#
|
||||
#e#############################################################################
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user