generated from AstroNvim/user_example
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
✨ add yank_history,undo_history and refactoring
- Loading branch information
shelken
committed
Apr 18, 2024
1 parent
397e195
commit deccde7
Showing
8 changed files
with
203 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,10 @@ | ||
---@type LazySpec | ||
return { | ||
-- "0x00-ketsu/autosave.nvim", | ||
-- -- lazy-loading on events | ||
-- event = { "InsertLeave", "TextChanged" }, | ||
-- opts = function(_, opts) | ||
-- opts.prompt_style = "stdout" -- notify or stdout | ||
-- end, | ||
"0x00-ketsu/autosave.nvim", | ||
-- lazy-loading on events | ||
event = { "InsertLeave", "TextChanged" }, | ||
opts = function(_, opts) | ||
opts.prompt_style = "stdout" -- notify or stdout | ||
end, | ||
enabled = false, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,4 @@ | ||
---@type LazySpec | ||
return { | ||
"LudoPinelli/comment-box.nvim", | ||
keys = { | ||
{ | ||
mode = "v", | ||
"<leader>mm", | ||
":CBccbox", | ||
desc = "美化注释", | ||
}, | ||
{ | ||
mode = "n", | ||
"<leader>mm", | ||
":CBccbox", | ||
desc = "美化注释", | ||
}, | ||
}, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
---@type LazySpec | ||
return { | ||
"ThePrimeagen/refactoring.nvim", | ||
dependencies = { | ||
{ "nvim-lua/plenary.nvim" }, | ||
{ "nvim-treesitter/nvim-treesitter" }, | ||
}, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
---@type LazySpec | ||
return { | ||
"nvim-telescope/telescope.nvim", | ||
branch = "0.1.x", | ||
dependencies = { "nvim-lua/plenary.nvim" }, | ||
init = function() | ||
-- 1. Disable highlighting for certain filetypes | ||
-- 2. Ignore files larger than a certain filesize | ||
local previewers = require "telescope.previewers" | ||
|
||
local _bad = { ".*%.csv", ".*%.min.js" } -- Put all filetypes that slow you down in this array | ||
local filesize_threshold = 300 * 1024 -- 300KB | ||
local bad_files = function(filepath) | ||
for _, v in ipairs(_bad) do | ||
if filepath:match(v) then return false end | ||
end | ||
return true | ||
end | ||
|
||
local new_maker = function(filepath, bufnr, opts) | ||
opts = opts or {} | ||
if opts.use_ft_detect == nil then opts.use_ft_detect = true end | ||
|
||
-- 1. Check if the file is in the bad_files array, and if so, don't highlight it | ||
opts.use_ft_detect = opts.use_ft_detect == false and false or bad_files(filepath) | ||
|
||
-- 2. Check the file size, and ignore it if it's too big(preview nothing). | ||
filepath = vim.fn.expand(filepath) | ||
vim.loop.fs_stat(filepath, function(_, stat) | ||
if not stat then return end | ||
if stat.size > filesize_threshold then | ||
return | ||
else | ||
previewers.buffer_previewer_maker(filepath, bufnr, opts) | ||
end | ||
end) | ||
|
||
-- Load Extensions | ||
require("telescope").load_extension "refactoring" | ||
require("telescope").load_extension "yank_history" | ||
require("telescope").load_extension "undo" | ||
end | ||
|
||
require("telescope").setup { | ||
defaults = { | ||
buffer_previewer_maker = new_maker, | ||
}, | ||
} | ||
end, | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
---@type LazySpec | ||
return { | ||
"debugloop/telescope-undo.nvim" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
-- clipboard manager | ||
return { | ||
"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" }, | ||
}, | ||
} |