mirror of
https://github.com/ryan4yin/nix-config.git
synced 2026-03-18 07:24:10 +01:00
feat: neovim - using configs from astrocommunity
This commit is contained in:
@@ -57,11 +57,11 @@ Provided by [flash.nvim](https://github.com/folke/flash.nvim), it's a intelligen
|
||||
|
||||
1. It enhaces the default search and jump behavior of neovim.(search with prefix `/`)
|
||||
|
||||
| Action | Shortcut |
|
||||
| ----------------- | -------------------------------------------------------------------------------------- |
|
||||
| Search | `/`(normal search), `s`(disable all code highlight, only highlight matches) |
|
||||
| Treesitter Search | `yR`,`dR`, `cR`, `vR`, `ctrl+v+R`(arround your matches, all the surrounding Treesitter nodes will be labeled) |
|
||||
| Remote Flash | `yr`, `dr`, `cr`, (arround your matches, all the surrounding Treesitter nodes will be labeled) |
|
||||
| Action | Shortcut |
|
||||
| ----------------- | ------------------------------------------------------------------------------------------------------------- |
|
||||
| Search | `/`(normal search), `s`(disable all code highlight, only highlight matches) |
|
||||
| Treesitter Search | `yR`,`dR`, `cR`, `vR`, `ctrl+v+R`(arround your matches, all the surrounding Treesitter nodes will be labeled) |
|
||||
| Remote Flash | `yr`, `dr`, `cr`, (arround your matches, all the surrounding Treesitter nodes will be labeled) |
|
||||
|
||||
## Text Manipulation
|
||||
|
||||
@@ -183,11 +183,16 @@ The postfix(flags) in the above commands:
|
||||
|
||||
## Surrounding Characters
|
||||
|
||||
| Action | Shortcut | Description |
|
||||
| ----------------------------- | -------- | ---------------------------------------------- |
|
||||
| Add surrounding characters | `ysiw'` | Add `'` around the word under cursor |
|
||||
| Delete surrounding characters | `ds'` | Delete `'` around the word under cursor |
|
||||
| Change surrounding characters | `cs'"` | Change `'` to `"` around the word under cursor |
|
||||
Provided by mini.surround plugin.
|
||||
|
||||
- Prefix `gz`
|
||||
|
||||
| Action | Shortcut | Description |
|
||||
| ------------------------------ | -------- | ----------------------------------------------- |
|
||||
| Add surrounding characters | `gzaiw'` | Add `'` around the word under cursor |
|
||||
| Delete surrounding characters | `gzd'` | Delete `'` around the word under cursor |
|
||||
| Replace surrounding characters | `gzr'"` | Replace `'` by `"` around the word under cursor |
|
||||
| Highlight surrounding | `gzh'` | Highlight `'` around the word under cursor |
|
||||
|
||||
## Text Manipulation
|
||||
|
||||
|
||||
@@ -26,6 +26,8 @@ return {
|
||||
{ import = "astrocommunity.scrolling.nvim-scrollbar" },
|
||||
{ import = "astrocommunity.editing-support.auto-save-nvim" },
|
||||
{ import = "astrocommunity.editing-support.todo-comments-nvim" },
|
||||
-- clipboard history manager
|
||||
{ import = "astrocommunity.editing-support.yanky-nvim" },
|
||||
-- Language Support
|
||||
---- Frontend & NodeJS
|
||||
{ import = "astrocommunity.pack.typescript-all-in-one" },
|
||||
@@ -52,6 +54,14 @@ return {
|
||||
{ import = "astrocommunity.pack.cmake" },
|
||||
{ import = "astrocommunity.pack.cpp" },
|
||||
{ import = "astrocommunity.pack.docker" },
|
||||
-- Motion
|
||||
{ import = "astrocommunity.motion.mini-surround" },
|
||||
-- https://github.com/echasnovski/mini.ai
|
||||
{ import = "astrocommunity.motion.mini-ai" },
|
||||
{ import = "astrocommunity.motion.flash-nvim" },
|
||||
{ "folke/flash.nvim", vscode = false },
|
||||
-- Lua implementation of CamelCaseMotion, with extra consideration of punctuation.
|
||||
{ import = "astrocommunity.motion.nvim-spider" },
|
||||
-- AI Assistant
|
||||
{ import = "astrocommunity.completion.copilot-lua-cmp" },
|
||||
-- Custom copilot-lua to enable filtypes: markdown
|
||||
@@ -78,6 +88,44 @@ return {
|
||||
end,
|
||||
},
|
||||
|
||||
-- clipboard manager
|
||||
{
|
||||
"gbprod/yanky.nvim",
|
||||
opts = function()
|
||||
local mapping = require "yanky.telescope.mapping"
|
||||
local mappings = mapping.get_defaults()
|
||||
mappings.i["<c-p>"] = nil
|
||||
return {
|
||||
highlight = { timer = 200 },
|
||||
picker = {
|
||||
telescope = {
|
||||
use_default_mappings = false,
|
||||
mappings = mappings,
|
||||
},
|
||||
},
|
||||
}
|
||||
end,
|
||||
keys = {
|
||||
{ "y", "<Plug>(YankyYank)", mode = { "n", "x" }, desc = "Yank text" },
|
||||
{ "p", "<Plug>(YankyPutAfter)", mode = { "n", "x" }, desc = "Put yanked text after cursor" },
|
||||
{ "P", "<Plug>(YankyPutBefore)", mode = { "n", "x" }, desc = "Put yanked text before cursor" },
|
||||
{ "gp", "<Plug>(YankyGPutAfter)", mode = { "n", "x" }, desc = "Put yanked text after selection" },
|
||||
{ "gP", "<Plug>(YankyGPutBefore)", mode = { "n", "x" }, desc = "Put yanked text before selection" },
|
||||
{ "[y", "<Plug>(YankyCycleForward)", desc = "Cycle forward through yank history" },
|
||||
{ "]y", "<Plug>(YankyCycleBackward)", desc = "Cycle backward through yank history" },
|
||||
{ "]p", "<Plug>(YankyPutIndentAfterLinewise)", desc = "Put indented after cursor (linewise)" },
|
||||
{ "[p", "<Plug>(YankyPutIndentBeforeLinewise)", desc = "Put indented before cursor (linewise)" },
|
||||
{ "]P", "<Plug>(YankyPutIndentAfterLinewise)", desc = "Put indented after cursor (linewise)" },
|
||||
{ "[P", "<Plug>(YankyPutIndentBeforeLinewise)", desc = "Put indented before cursor (linewise)" },
|
||||
{ ">p", "<Plug>(YankyPutIndentAfterShiftRight)", desc = "Put and indent right" },
|
||||
{ "<p", "<Plug>(YankyPutIndentAfterShiftLeft)", desc = "Put and indent left" },
|
||||
{ ">P", "<Plug>(YankyPutIndentBeforeShiftRight)", desc = "Put before and indent right" },
|
||||
{ "<P", "<Plug>(YankyPutIndentBeforeShiftLeft)", desc = "Put before and indent left" },
|
||||
{ "=p", "<Plug>(YankyPutAfterFilter)", desc = "Put after applying a filter" },
|
||||
{ "=P", "<Plug>(YankyPutBeforeFilter)", desc = "Put before applying a filter" },
|
||||
},
|
||||
},
|
||||
|
||||
-- Enhanced matchparen.vim plugin for Neovim to highlight the outer pair.
|
||||
{
|
||||
"utilyre/sentiment.nvim",
|
||||
@@ -102,18 +150,6 @@ return {
|
||||
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,
|
||||
},
|
||||
|
||||
-- File explorer(Custom configs)
|
||||
{
|
||||
"nvim-neo-tree/neo-tree.nvim",
|
||||
@@ -188,9 +224,6 @@ return {
|
||||
-- Undo tree
|
||||
{ "debugloop/telescope-undo.nvim", },
|
||||
|
||||
-- Lua implementation of CamelCaseMotion, with extra consideration of punctuation.
|
||||
{ "chrisgrieser/nvim-spider", lazy = true },
|
||||
|
||||
-- Install lsp, formmatter and others via home manager instead of Mason.nvim
|
||||
-- LSP installations
|
||||
{
|
||||
@@ -272,40 +305,6 @@ return {
|
||||
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
|
||||
},
|
||||
|
||||
-- Flash enhances the built-in search/jump functionality.
|
||||
{
|
||||
"folke/flash.nvim",
|
||||
event = "VeryLazy",
|
||||
vscode = true,
|
||||
---@type Flash.Config
|
||||
opts = {},
|
||||
-- stylua: ignore
|
||||
keys = {
|
||||
-- Normal, Visual, or Operator-pending modes
|
||||
{ "s", mode = { "n", "x", "o" }, function() require("flash").jump() end, desc = "Flash" },
|
||||
-- confict with nvim-surround's keys
|
||||
{ "S", mode = { "n", "o", "x" }, function() require("flash").treesitter() end, desc = "Flash Treesitter" },
|
||||
-- command: yr
|
||||
{ "r", mode = "o", function() require("flash").remote() end, desc = "Remote Flash" },
|
||||
-- command: yR
|
||||
{ "R", mode = { "o", "x" }, function() require("flash").treesitter_search() end, desc = "Treesitter Search" },
|
||||
-- <ctrl + s>, Command-line mode(prefix: `:`)
|
||||
{ "<c-s>", mode = { "c" }, function() require("flash").toggle() end, desc = "Toggle Flash Search" },
|
||||
},
|
||||
},
|
||||
|
||||
{
|
||||
'nvim-telescope/telescope.nvim', branch = '0.1.x',
|
||||
dependencies = { 'nvim-lua/plenary.nvim' },
|
||||
|
||||
@@ -35,8 +35,6 @@ return {
|
||||
|
||||
-- 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" },
|
||||
@@ -61,9 +59,5 @@ return {
|
||||
["<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 = "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" },
|
||||
},
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user