update: nvim
This commit is contained in:
+1
-1
@@ -8,4 +8,4 @@ jobs:
|
||||
- uses: actions/checkout@v4
|
||||
- uses: lunarmodules/luacheck@v1
|
||||
with:
|
||||
args: . --std luajit --globals vim _debugging _command_panel _flash_esc_or_noh _telescope_collections _toggle_lazygit --max-line-length 150 --no-config
|
||||
args: . --std luajit --max-line-length 150 --no-config --globals vim _debugging _command_panel _flash_esc_or_noh _telescope_collections _toggle_inlayhint _toggle_virtualtext _toggle_lazygit
|
||||
|
||||
Generated
+16
-16
@@ -5,11 +5,11 @@
|
||||
"nixpkgs": "nixpkgs"
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1722113426,
|
||||
"narHash": "sha256-Yo/3loq572A8Su6aY5GP56knpuKYRvM2a1meP9oJZCw=",
|
||||
"lastModified": 1735644329,
|
||||
"narHash": "sha256-tO3HrHriyLvipc4xr+Ewtdlo7wM1OjXNjlWRgmM7peY=",
|
||||
"owner": "numtide",
|
||||
"repo": "devshell",
|
||||
"rev": "67cce7359e4cd3c45296fb4aaf6a19e2a9c757ae",
|
||||
"rev": "f7795ede5b02664b57035b3b757876703e2c3eac",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
@@ -23,11 +23,11 @@
|
||||
"nixpkgs-lib": "nixpkgs-lib"
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1719994518,
|
||||
"narHash": "sha256-pQMhCCHyQGRzdfAkdJ4cIWiw+JNuWsTX7f0ZYSyz0VY=",
|
||||
"lastModified": 1738453229,
|
||||
"narHash": "sha256-7H9XgNiGLKN1G1CgRh0vUL4AheZSYzPm+zmZ7vxbJdo=",
|
||||
"owner": "hercules-ci",
|
||||
"repo": "flake-parts",
|
||||
"rev": "9227223f6d922fee3c7b190b2cc238a99527bbb7",
|
||||
"rev": "32ea77a06711b758da0ad9bd6a844c5740a87abd",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
@@ -43,11 +43,11 @@
|
||||
]
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1722462338,
|
||||
"narHash": "sha256-ss0G8t8RJVDewA3MyqgAlV951cWRK6EtVhVKEZ7J5LU=",
|
||||
"lastModified": 1740796616,
|
||||
"narHash": "sha256-JU97wIfRxeFN6rpTsUVCwWAdix+Wka4Or23907YIrFI=",
|
||||
"owner": "nix-community",
|
||||
"repo": "home-manager",
|
||||
"rev": "6e090576c4824b16e8759ebca3958c5b09659ee8",
|
||||
"rev": "f0b5e7e8a75abdea32bbff09ddd7b6eeb4b9b445",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
@@ -74,23 +74,23 @@
|
||||
},
|
||||
"nixpkgs-lib": {
|
||||
"locked": {
|
||||
"lastModified": 1719876945,
|
||||
"narHash": "sha256-Fm2rDDs86sHy0/1jxTOKB1118Q0O3Uc7EC0iXvXKpbI=",
|
||||
"lastModified": 1738452942,
|
||||
"narHash": "sha256-vJzFZGaCpnmo7I6i416HaBLpC+hvcURh/BQwROcGIp8=",
|
||||
"type": "tarball",
|
||||
"url": "https://github.com/NixOS/nixpkgs/archive/5daf0514482af3f97abaefc78a6606365c9108e2.tar.gz"
|
||||
"url": "https://github.com/NixOS/nixpkgs/archive/072a6db25e947df2f31aab9eccd0ab75d5b2da11.tar.gz"
|
||||
},
|
||||
"original": {
|
||||
"type": "tarball",
|
||||
"url": "https://github.com/NixOS/nixpkgs/archive/5daf0514482af3f97abaefc78a6606365c9108e2.tar.gz"
|
||||
"url": "https://github.com/NixOS/nixpkgs/archive/072a6db25e947df2f31aab9eccd0ab75d5b2da11.tar.gz"
|
||||
}
|
||||
},
|
||||
"nixpkgs_2": {
|
||||
"locked": {
|
||||
"lastModified": 1722415718,
|
||||
"narHash": "sha256-5US0/pgxbMksF92k1+eOa8arJTJiPvsdZj9Dl+vJkM4=",
|
||||
"lastModified": 1740547748,
|
||||
"narHash": "sha256-Ly2fBL1LscV+KyCqPRufUBuiw+zmWrlJzpWOWbahplg=",
|
||||
"owner": "nixos",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "c3392ad349a5227f4a3464dce87bcc5046692fce",
|
||||
"rev": "3a05eebede89661660945da1f151959900903b6a",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
|
||||
@@ -2,7 +2,6 @@
|
||||
"Comment.nvim": { "branch": "master", "commit": "e30b7f2008e52442154b66f7c519bfd2f1e32acb" },
|
||||
"LuaSnip": { "branch": "master", "commit": "45db5addf8d0a201e1cf247cae4cdce605ad3768" },
|
||||
"advanced-git-search.nvim": { "branch": "main", "commit": "36ea105a7b7063a6879ac3b8afffe6fb326e27b1" },
|
||||
"aerial.nvim": { "branch": "master", "commit": "92f93f4e155b2135fc47ed2daf8b63f40726b545" },
|
||||
"alpha-nvim": { "branch": "main", "commit": "b6f4129302db197a7249e67a90de3f2b676de13e" },
|
||||
"autoclose.nvim": { "branch": "main", "commit": "b2077aa2c83df7ebc19b2a20a3a0654b24ae9c8f" },
|
||||
"bigfile.nvim": { "branch": "main", "commit": "33eb067e3d7029ac77e081cfe7c45361887a311a" },
|
||||
@@ -24,6 +23,7 @@
|
||||
"csv.vim": { "branch": "master", "commit": "bddfcbadd788ab11eb3dbba4550a38a412fe3705" },
|
||||
"diffview.nvim": { "branch": "main", "commit": "4516612fe98ff56ae0415a259ff6361a89419b0a" },
|
||||
"dropbar.nvim": { "branch": "master", "commit": "6156e07759fd8c7cbf764414f583aa7e47470368" },
|
||||
"edgy.nvim": { "branch": "main", "commit": "7e8dedc39abebe40c289b8012cc89b11c69aa7a0" },
|
||||
"fidget.nvim": { "branch": "main", "commit": "d855eed8a06531a7e8fd0684889b2943f373c469" },
|
||||
"flash.nvim": { "branch": "main", "commit": "34c7be146a91fec3555c33fe89c7d643f6ef5cf1" },
|
||||
"friendly-snippets": { "branch": "main", "commit": "00ebcaa159e817150bd83bfe2d51fa3b3377d5c4" },
|
||||
@@ -32,11 +32,11 @@
|
||||
"gitsigns.nvim": { "branch": "main", "commit": "899e993850084ea33d001ec229d237bc020c19ae" },
|
||||
"glance.nvim": { "branch": "master", "commit": "51059bcf21016387b6233c89eed220cf47fca752" },
|
||||
"go.nvim": { "branch": "master", "commit": "8389adb56ab124b75d858df5f87b741eaca7b8b3" },
|
||||
"grug-far.nvim": { "branch": "main", "commit": "1b7a54633071cbb7a378162b8f04a38913987d64" },
|
||||
"guihua.lua": { "branch": "master", "commit": "225db770e36aae6a1e9e3a65578095c8eb4038d3" },
|
||||
"hop.nvim": { "branch": "master", "commit": "8f51ef02700bb3cdcce94e92eff16170a6343c4f" },
|
||||
"indent-blankline.nvim": { "branch": "master", "commit": "db926997af951da38e5004ec7b9fbdc480b48f5d" },
|
||||
"lazy.nvim": { "branch": "main", "commit": "077102c5bfc578693f12377846d427f49bc50076" },
|
||||
"local-highlight.nvim": { "branch": "master", "commit": "ae3ada3a332128b1036c84c8587b9069891c63da" },
|
||||
"lsp-format-modifications.nvim": { "branch": "main", "commit": "006d4cd88f4f09fdc4375fcb75dd5b7d981a723b" },
|
||||
"lsp_signature.nvim": { "branch": "master", "commit": "e6d225e27770db81346c2f2aa6c30d0e249f9e7f" },
|
||||
"lspsaga.nvim": { "branch": "main", "commit": "4ce44df854f447cf0a8972e5387b3aeb5efc798b" },
|
||||
@@ -47,8 +47,8 @@
|
||||
"mason-nvim-dap.nvim": { "branch": "main", "commit": "8b9363d83b5d779813cdd2819b8308651cec2a09" },
|
||||
"mason.nvim": { "branch": "main", "commit": "e2f7f9044ec30067bc11800a9e266664b88cda22" },
|
||||
"mini.align": { "branch": "main", "commit": "b54d88b16bfac62ca6b3d699566135639a3ca4fa" },
|
||||
"mini.cursorword": { "branch": "main", "commit": "939ffcc8c57694608ac0896418d4b9a7c5273909" },
|
||||
"neoconf.nvim": { "branch": "main", "commit": "f5befe4772c9d94c43bd3dd318f5546cf955ba3f" },
|
||||
"neodim": { "branch": "master", "commit": "d87470828690342d0139efc2fd56ea0b29e9ecb3" },
|
||||
"neoscroll.nvim": { "branch": "master", "commit": "532dcc8cea4287c4cad6bb77532989a8217cfc7b" },
|
||||
"none-ls.nvim": { "branch": "main", "commit": "203f5ebde4a1af48ba2eb146401b5be2e7866942" },
|
||||
"nvim-bqf": { "branch": "main", "commit": "1b24dc6050c34e8cd377b6b4cd6abe40509e0187" },
|
||||
@@ -61,7 +61,6 @@
|
||||
"nvim-nio": { "branch": "master", "commit": "a428f309119086dc78dd4b19306d2d67be884eee" },
|
||||
"nvim-notify": { "branch": "master", "commit": "d333b6f167900f6d9d42a59005d82919830626bf" },
|
||||
"nvim-scrollview": { "branch": "main", "commit": "401c0498689dcaa54b2e7483d823e33cdc051e72" },
|
||||
"nvim-spectre": { "branch": "master", "commit": "ba7fb777edff6c1fbbeffd343e113af64c04e90a" },
|
||||
"nvim-tree.lua": { "branch": "master", "commit": "d43ab67d0eb4317961c5e9d15fffe908519debe0" },
|
||||
"nvim-treehopper": { "branch": "master", "commit": "13559079e33665a310d9ccf0e43f4e9bb9f337e2" },
|
||||
"nvim-treesitter": { "branch": "master", "commit": "7a64148896289a91cb2a92e9da3f76d5512a3fb8" },
|
||||
|
||||
@@ -32,7 +32,13 @@ local leader_map = function()
|
||||
end
|
||||
|
||||
local gui_config = function()
|
||||
vim.api.nvim_set_option_value("guifont", settings.gui_config.font_name .. ":h" .. settings.gui_config.font_size, {})
|
||||
if next(settings.gui_config) then
|
||||
vim.api.nvim_set_option_value(
|
||||
"guifont",
|
||||
settings.gui_config.font_name .. ":h" .. settings.gui_config.font_size,
|
||||
{}
|
||||
)
|
||||
end
|
||||
end
|
||||
|
||||
local neovide_config = function()
|
||||
@@ -104,7 +110,6 @@ local load_core = function()
|
||||
shell_config()
|
||||
|
||||
require("core.options")
|
||||
require("core.mapping")
|
||||
require("core.event")
|
||||
require("core.pack")
|
||||
require("keymap")
|
||||
|
||||
@@ -1,65 +0,0 @@
|
||||
local bind = require("keymap.bind")
|
||||
local map_cr = bind.map_cr
|
||||
local map_cu = bind.map_cu
|
||||
local map_cmd = bind.map_cmd
|
||||
local map_callback = bind.map_callback
|
||||
|
||||
local core_map = {
|
||||
-- Suckless
|
||||
["n|<S-Tab>"] = map_cr("normal za"):with_noremap():with_silent():with_desc("edit: Toggle code fold"),
|
||||
["n|<C-s>"] = map_cu("write"):with_noremap():with_silent():with_desc("edit: Save file"),
|
||||
["n|Y"] = map_cmd("y$"):with_desc("edit: Yank text to EOL"),
|
||||
["n|D"] = map_cmd("d$"):with_desc("edit: Delete text to EOL"),
|
||||
["n|n"] = map_cmd("nzzzv"):with_noremap():with_desc("edit: Next search result"),
|
||||
["n|N"] = map_cmd("Nzzzv"):with_noremap():with_desc("edit: Prev search result"),
|
||||
["n|J"] = map_cmd("mzJ`z"):with_noremap():with_desc("edit: Join next line"),
|
||||
["n|<Esc>"] = map_callback(function()
|
||||
_flash_esc_or_noh()
|
||||
end)
|
||||
:with_noremap()
|
||||
:with_silent()
|
||||
:with_desc("edit: Clear search highlight"),
|
||||
["n|<C-h>"] = map_cmd("<C-w>h"):with_noremap():with_desc("window: Focus left"),
|
||||
["n|<C-l>"] = map_cmd("<C-w>l"):with_noremap():with_desc("window: Focus right"),
|
||||
["n|<C-j>"] = map_cmd("<C-w>j"):with_noremap():with_desc("window: Focus down"),
|
||||
["n|<C-k>"] = map_cmd("<C-w>k"):with_noremap():with_desc("window: Focus up"),
|
||||
["t|<C-w>h"] = map_cmd("<Cmd>wincmd h<CR>"):with_silent():with_noremap():with_desc("window: Focus left"),
|
||||
["t|<C-w>l"] = map_cmd("<Cmd>wincmd l<CR>"):with_silent():with_noremap():with_desc("window: Focus right"),
|
||||
["t|<C-w>j"] = map_cmd("<Cmd>wincmd j<CR>"):with_silent():with_noremap():with_desc("window: Focus down"),
|
||||
["t|<C-w>k"] = map_cmd("<Cmd>wincmd k<CR>"):with_silent():with_noremap():with_desc("window: Focus up"),
|
||||
["n|<A-h>"] = map_cr("vertical resize -3"):with_silent():with_desc("window: Resize -3 vertically"),
|
||||
["n|<A-l>"] = map_cr("vertical resize +3"):with_silent():with_desc("window: Resize +3 vertically"),
|
||||
["n|<A-j>"] = map_cr("resize -3"):with_silent():with_desc("window: Resize -3 horizontally"),
|
||||
["n|<A-k>"] = map_cr("resize +3"):with_silent():with_desc("window: Resize +3 horizontally"),
|
||||
["n|<C-q>"] = map_cr("wq"):with_desc("edit: Save file and quit"),
|
||||
["n|<A-S-q>"] = map_cr("q!"):with_desc("edit: Force quit"),
|
||||
["n|<leader>o"] = map_cr("setlocal spell! spelllang=en_us"):with_desc("edit: Toggle spell check"),
|
||||
["n|<leader>bn"] = map_cu("enew"):with_noremap():with_silent():with_desc("buffer: New"),
|
||||
["n|tn"] = map_cr("tabnew"):with_noremap():with_silent():with_desc("tab: Create a new tab"),
|
||||
["n|tk"] = map_cr("tabnext"):with_noremap():with_silent():with_desc("tab: Move to next tab"),
|
||||
["n|tj"] = map_cr("tabprevious"):with_noremap():with_silent():with_desc("tab: Move to previous tab"),
|
||||
["n|to"] = map_cr("tabonly"):with_noremap():with_silent():with_desc("tab: Only keep current tab"),
|
||||
-- Insert mode
|
||||
["i|<C-u>"] = map_cmd("<C-G>u<C-U>"):with_noremap():with_desc("edit: Delete previous block"),
|
||||
["i|<C-b>"] = map_cmd("<Left>"):with_noremap():with_desc("edit: Move cursor to left"),
|
||||
["i|<C-a>"] = map_cmd("<ESC>^i"):with_noremap():with_desc("edit: Move cursor to line start"),
|
||||
["i|<C-s>"] = map_cmd("<Esc>:w<CR>"):with_desc("edit: Save file"),
|
||||
["i|<C-q>"] = map_cmd("<Esc>:wq<CR>"):with_desc("edit: Save file and quit"),
|
||||
-- Command mode
|
||||
["c|<C-b>"] = map_cmd("<Left>"):with_noremap():with_desc("edit: Left"),
|
||||
["c|<C-f>"] = map_cmd("<Right>"):with_noremap():with_desc("edit: Right"),
|
||||
["c|<C-a>"] = map_cmd("<Home>"):with_noremap():with_desc("edit: Home"),
|
||||
["c|<C-e>"] = map_cmd("<End>"):with_noremap():with_desc("edit: End"),
|
||||
["c|<C-d>"] = map_cmd("<Del>"):with_noremap():with_desc("edit: Delete"),
|
||||
["c|<C-h>"] = map_cmd("<BS>"):with_noremap():with_desc("edit: Backspace"),
|
||||
["c|<C-t>"] = map_cmd([[<C-R>=expand("%:p:h") . "/" <CR>]])
|
||||
:with_noremap()
|
||||
:with_desc("edit: Complete path of current file"),
|
||||
-- Visual mode
|
||||
["v|J"] = map_cmd(":m '>+1<CR>gv=gv"):with_desc("edit: Move this line down"),
|
||||
["v|K"] = map_cmd(":m '<-2<CR>gv=gv"):with_desc("edit: Move this line up"),
|
||||
["v|<"] = map_cmd("<gv"):with_desc("edit: Decrease indent"),
|
||||
["v|>"] = map_cmd(">gv"):with_desc("edit: Increase indent"),
|
||||
}
|
||||
|
||||
bind.nvim_load_mapping(core_map)
|
||||
@@ -125,7 +125,7 @@ function Lazy:load_lazy()
|
||||
---@type string[]
|
||||
paths = {}, -- add any custom paths here that you want to include in the rtp
|
||||
disabled_plugins = {
|
||||
-- Set this to true in order to enable native EditorConfig support
|
||||
-- Comment out `"editorconfig"` to enable native EditorConfig support
|
||||
-- WARN: Sleuth.vim already includes all the features provided by this plugin.
|
||||
-- Do NOT enable both at the same time, or you risk breaking the entire detection system.
|
||||
"editorconfig",
|
||||
|
||||
@@ -46,9 +46,9 @@ settings["formatter_block_list"] = {
|
||||
-- Servers in this list will skip setting formatting capabilities if rhs is true.
|
||||
---@type table<string, boolean>
|
||||
settings["server_formatting_block_list"] = {
|
||||
lua_ls = true,
|
||||
tsserver = true,
|
||||
clangd = true,
|
||||
lua_ls = true,
|
||||
ts_ls = true,
|
||||
}
|
||||
|
||||
-- Set it to false if you want to turn off LSP Inlay Hints
|
||||
|
||||
@@ -1,27 +1,32 @@
|
||||
local bind = require("keymap.bind")
|
||||
local map_cr = bind.map_cr
|
||||
local map_cmd = bind.map_cmd
|
||||
local map_callback = bind.map_callback
|
||||
|
||||
local plug_map = {
|
||||
["n|<A-f>"] = map_cmd("<Cmd>FormatToggle<CR>"):with_noremap():with_desc("formatter: Toggle format on save"),
|
||||
local mappings = {
|
||||
fmt = {
|
||||
["n|<A-f>"] = map_cr("FormatToggle"):with_noremap():with_silent():with_desc("formatter: Toggle format on save"),
|
||||
["n|<A-S-f>"] = map_cr("Format"):with_noremap():with_silent():with_desc("formatter: Format buffer manually"),
|
||||
},
|
||||
}
|
||||
bind.nvim_load_mapping(plug_map)
|
||||
bind.nvim_load_mapping(mappings.fmt)
|
||||
|
||||
local mapping = {}
|
||||
--- The following code allows this file to be exported ---
|
||||
--- for use with LSP lazy-loaded keymap bindings ---
|
||||
|
||||
function mapping.lsp(buf)
|
||||
local M = {}
|
||||
|
||||
---@param buf integer
|
||||
function M.lsp(buf)
|
||||
local map = {
|
||||
-- LSP-related keymaps, ONLY effective in buffers with LSP(s) attached
|
||||
["n|<leader>li"] = map_cr("LspInfo"):with_silent():with_buffer(buf):with_desc("lsp: Info"),
|
||||
["n|<leader>lr"] = map_cr("LspRestart"):with_silent():with_buffer(buf):with_nowait():with_desc("lsp: Restart"),
|
||||
["n|go"] = map_cr("AerialToggle!"):with_silent():with_buffer(buf):with_desc("lsp: Toggle outline"),
|
||||
["n|gto"] = map_callback(function()
|
||||
require("telescope").extensions.aerial.aerial()
|
||||
["n|go"] = map_callback(function()
|
||||
require("edgy").toggle("right")
|
||||
end)
|
||||
:with_silent()
|
||||
:with_buffer(buf)
|
||||
:with_desc("lsp: Toggle outline in Telescope"),
|
||||
:with_desc("lsp: Toggle outline"),
|
||||
["n|g["] = map_cr("Lspsaga diagnostic_jump_prev")
|
||||
:with_silent()
|
||||
:with_buffer(buf)
|
||||
@@ -62,6 +67,18 @@ function mapping.lsp(buf)
|
||||
:with_silent()
|
||||
:with_buffer(buf)
|
||||
:with_desc("lsp: Show outgoing calls"),
|
||||
["n|<leader>lv"] = map_callback(function()
|
||||
_toggle_virtualtext()
|
||||
end)
|
||||
:with_noremap()
|
||||
:with_silent()
|
||||
:with_desc("lsp: Toggle virtual text display of current buffer"),
|
||||
["n|<leader>lh"] = map_callback(function()
|
||||
_toggle_inlayhint()
|
||||
end)
|
||||
:with_noremap()
|
||||
:with_silent()
|
||||
:with_desc("lsp: Toggle inlay hints dispaly of current buffer"),
|
||||
}
|
||||
bind.nvim_load_mapping(map)
|
||||
|
||||
@@ -71,4 +88,4 @@ function mapping.lsp(buf)
|
||||
end
|
||||
end
|
||||
|
||||
return mapping
|
||||
return M
|
||||
|
||||
@@ -5,105 +5,136 @@ local map_cmd = bind.map_cmd
|
||||
local map_callback = bind.map_callback
|
||||
local et = bind.escape_termcode
|
||||
|
||||
local plug_map = {
|
||||
-- Plugin persisted.nvim
|
||||
["n|<leader>ss"] = map_cu("SessionSave"):with_noremap():with_silent():with_desc("session: Save"),
|
||||
["n|<leader>sl"] = map_cu("SessionLoad"):with_noremap():with_silent():with_desc("session: Load current"),
|
||||
["n|<leader>sd"] = map_cu("SessionDelete"):with_noremap():with_silent():with_desc("session: Delete"),
|
||||
local mappings = {
|
||||
builtins = {
|
||||
-- Builtins: Save & Quit
|
||||
["n|<C-s>"] = map_cu("write"):with_noremap():with_silent():with_desc("edit: Save file"),
|
||||
["n|<C-q>"] = map_cr("wq"):with_desc("edit: Save file and quit"),
|
||||
["n|<A-S-q>"] = map_cr("q!"):with_desc("edit: Force quit"),
|
||||
|
||||
-- Plugin: nvim-bufdel
|
||||
["n|<A-q>"] = map_cr("BufDel"):with_noremap():with_silent():with_desc("buffer: Close current"),
|
||||
-- Builtins: Insert mode
|
||||
["i|<C-u>"] = map_cmd("<C-G>u<C-U>"):with_noremap():with_desc("edit: Delete previous block"),
|
||||
["i|<C-b>"] = map_cmd("<Left>"):with_noremap():with_desc("edit: Move cursor to left"),
|
||||
["i|<C-a>"] = map_cmd("<ESC>^i"):with_noremap():with_desc("edit: Move cursor to line start"),
|
||||
["i|<C-s>"] = map_cmd("<Esc>:w<CR>"):with_desc("edit: Save file"),
|
||||
["i|<C-q>"] = map_cmd("<Esc>:wq<CR>"):with_desc("edit: Save file and quit"),
|
||||
|
||||
-- Plugin: comment.nvim
|
||||
["n|gcc"] = map_callback(function()
|
||||
return vim.v.count == 0 and et("<Plug>(comment_toggle_linewise_current)")
|
||||
or et("<Plug>(comment_toggle_linewise_count)")
|
||||
end)
|
||||
:with_silent()
|
||||
:with_noremap()
|
||||
:with_expr()
|
||||
:with_desc("edit: Toggle comment for line"),
|
||||
["n|gbc"] = map_callback(function()
|
||||
return vim.v.count == 0 and et("<Plug>(comment_toggle_blockwise_current)")
|
||||
or et("<Plug>(comment_toggle_blockwise_count)")
|
||||
end)
|
||||
:with_silent()
|
||||
:with_noremap()
|
||||
:with_expr()
|
||||
:with_desc("edit: Toggle comment for block"),
|
||||
["n|gc"] = map_cmd("<Plug>(comment_toggle_linewise)")
|
||||
:with_silent()
|
||||
:with_noremap()
|
||||
:with_desc("edit: Toggle comment for line with operator"),
|
||||
["n|gb"] = map_cmd("<Plug>(comment_toggle_blockwise)")
|
||||
:with_silent()
|
||||
:with_noremap()
|
||||
:with_desc("edit: Toggle comment for block with operator"),
|
||||
["x|gc"] = map_cmd("<Plug>(comment_toggle_linewise_visual)")
|
||||
:with_silent()
|
||||
:with_noremap()
|
||||
:with_desc("edit: Toggle comment for line with selection"),
|
||||
["x|gb"] = map_cmd("<Plug>(comment_toggle_blockwise_visual)")
|
||||
:with_silent()
|
||||
:with_noremap()
|
||||
:with_desc("edit: Toggle comment for block with selection"),
|
||||
-- Builtins: Command mode
|
||||
["c|<C-b>"] = map_cmd("<Left>"):with_noremap():with_desc("edit: Left"),
|
||||
["c|<C-f>"] = map_cmd("<Right>"):with_noremap():with_desc("edit: Right"),
|
||||
["c|<C-a>"] = map_cmd("<Home>"):with_noremap():with_desc("edit: Home"),
|
||||
["c|<C-e>"] = map_cmd("<End>"):with_noremap():with_desc("edit: End"),
|
||||
["c|<C-d>"] = map_cmd("<Del>"):with_noremap():with_desc("edit: Delete"),
|
||||
["c|<C-h>"] = map_cmd("<BS>"):with_noremap():with_desc("edit: Backspace"),
|
||||
["c|<C-t>"] = map_cmd([[<C-R>=expand("%:p:h") . "/" <CR>]])
|
||||
:with_noremap()
|
||||
:with_desc("edit: Complete path of current file"),
|
||||
|
||||
-- Plugin: diffview.nvim
|
||||
["n|<leader>gd"] = map_cr("DiffviewOpen"):with_silent():with_noremap():with_desc("git: Show diff"),
|
||||
["n|<leader>gD"] = map_cr("DiffviewClose"):with_silent():with_noremap():with_desc("git: Close diff"),
|
||||
-- Builtins: Visual mode
|
||||
["v|J"] = map_cmd(":m '>+1<CR>gv=gv"):with_desc("edit: Move this line down"),
|
||||
["v|K"] = map_cmd(":m '<-2<CR>gv=gv"):with_desc("edit: Move this line up"),
|
||||
["v|<"] = map_cmd("<gv"):with_desc("edit: Decrease indent"),
|
||||
["v|>"] = map_cmd(">gv"):with_desc("edit: Increase indent"),
|
||||
|
||||
-- Plugin: hop.nvim
|
||||
["nv|<leader>w"] = map_cmd("<Cmd>HopWordMW<CR>"):with_noremap():with_desc("jump: Goto word"),
|
||||
["nv|<leader>j"] = map_cmd("<Cmd>HopLineMW<CR>"):with_noremap():with_desc("jump: Goto line"),
|
||||
["nv|<leader>k"] = map_cmd("<Cmd>HopLineMW<CR>"):with_noremap():with_desc("jump: Goto line"),
|
||||
["nv|<leader>c"] = map_cmd("<Cmd>HopChar1MW<CR>"):with_noremap():with_desc("jump: Goto one char"),
|
||||
["nv|<leader>C"] = map_cmd("<Cmd>HopChar2MW<CR>"):with_noremap():with_desc("jump: Goto two chars"),
|
||||
-- Builtins: "Suckless" - named after r/suckless
|
||||
["n|Y"] = map_cmd("y$"):with_desc("edit: Yank text to EOL"),
|
||||
["n|D"] = map_cmd("d$"):with_desc("edit: Delete text to EOL"),
|
||||
["n|n"] = map_cmd("nzzzv"):with_noremap():with_desc("edit: Next search result"),
|
||||
["n|N"] = map_cmd("Nzzzv"):with_noremap():with_desc("edit: Prev search result"),
|
||||
["n|J"] = map_cmd("mzJ`z"):with_noremap():with_desc("edit: Join next line"),
|
||||
["n|<S-Tab>"] = map_cr("normal za"):with_noremap():with_silent():with_desc("edit: Toggle code fold"),
|
||||
["n|<Esc>"] = map_callback(function()
|
||||
_flash_esc_or_noh()
|
||||
end)
|
||||
:with_noremap()
|
||||
:with_silent()
|
||||
:with_desc("edit: Clear search highlight"),
|
||||
["n|<leader>o"] = map_cr("setlocal spell! spelllang=en_us"):with_desc("edit: Toggle spell check"),
|
||||
},
|
||||
plugins = {
|
||||
-- Plugin: persisted.nvim
|
||||
["n|<leader>ss"] = map_cu("SessionSave"):with_noremap():with_silent():with_desc("session: Save"),
|
||||
["n|<leader>sl"] = map_cu("SessionLoad"):with_noremap():with_silent():with_desc("session: Load current"),
|
||||
["n|<leader>sd"] = map_cu("SessionDelete"):with_noremap():with_silent():with_desc("session: Delete"),
|
||||
|
||||
-- Plugin: smart-splits.nvim
|
||||
["n|<A-h>"] = map_cu("SmartResizeLeft"):with_silent():with_noremap():with_desc("window: Resize -3 horizontally"),
|
||||
["n|<A-j>"] = map_cu("SmartResizeDown"):with_silent():with_noremap():with_desc("window: Resize -3 vertically"),
|
||||
["n|<A-k>"] = map_cu("SmartResizeUp"):with_silent():with_noremap():with_desc("window: Resize +3 vertically"),
|
||||
["n|<A-l>"] = map_cu("SmartResizeRight"):with_silent():with_noremap():with_desc("window: Resize +3 horizontally"),
|
||||
["n|<C-h>"] = map_cu("SmartCursorMoveLeft"):with_silent():with_noremap():with_desc("window: Focus left"),
|
||||
["n|<C-j>"] = map_cu("SmartCursorMoveDown"):with_silent():with_noremap():with_desc("window: Focus down"),
|
||||
["n|<C-k>"] = map_cu("SmartCursorMoveUp"):with_silent():with_noremap():with_desc("window: Focus up"),
|
||||
["n|<C-l>"] = map_cu("SmartCursorMoveRight"):with_silent():with_noremap():with_desc("window: Focus right"),
|
||||
["n|<leader>Wh"] = map_cu("SmartSwapLeft"):with_silent():with_noremap():with_desc("window: Move window leftward"),
|
||||
["n|<leader>Wj"] = map_cu("SmartSwapDown"):with_silent():with_noremap():with_desc("window: Move window downward"),
|
||||
["n|<leader>Wk"] = map_cu("SmartSwapUp"):with_silent():with_noremap():with_desc("window: Move window upward"),
|
||||
["n|<leader>Wl"] = map_cu("SmartSwapRight"):with_silent():with_noremap():with_desc("window: Move window rightward"),
|
||||
-- Plugin: comment.nvim
|
||||
["n|gcc"] = map_callback(function()
|
||||
return vim.v.count == 0 and et("<Plug>(comment_toggle_linewise_current)")
|
||||
or et("<Plug>(comment_toggle_linewise_count)")
|
||||
end)
|
||||
:with_silent()
|
||||
:with_noremap()
|
||||
:with_expr()
|
||||
:with_desc("edit: Toggle comment for line"),
|
||||
["n|gbc"] = map_callback(function()
|
||||
return vim.v.count == 0 and et("<Plug>(comment_toggle_blockwise_current)")
|
||||
or et("<Plug>(comment_toggle_blockwise_count)")
|
||||
end)
|
||||
:with_silent()
|
||||
:with_noremap()
|
||||
:with_expr()
|
||||
:with_desc("edit: Toggle comment for block"),
|
||||
["n|gc"] = map_cmd("<Plug>(comment_toggle_linewise)")
|
||||
:with_silent()
|
||||
:with_noremap()
|
||||
:with_desc("edit: Toggle comment for line with operator"),
|
||||
["n|gb"] = map_cmd("<Plug>(comment_toggle_blockwise)")
|
||||
:with_silent()
|
||||
:with_noremap()
|
||||
:with_desc("edit: Toggle comment for block with operator"),
|
||||
["x|gc"] = map_cmd("<Plug>(comment_toggle_linewise_visual)")
|
||||
:with_silent()
|
||||
:with_noremap()
|
||||
:with_desc("edit: Toggle comment for line with selection"),
|
||||
["x|gb"] = map_cmd("<Plug>(comment_toggle_blockwise_visual)")
|
||||
:with_silent()
|
||||
:with_noremap()
|
||||
:with_desc("edit: Toggle comment for block with selection"),
|
||||
|
||||
-- Plugin: nvim-spectre
|
||||
["n|<leader>Ss"] = map_callback(function()
|
||||
require("spectre").toggle()
|
||||
end)
|
||||
:with_silent()
|
||||
:with_noremap()
|
||||
:with_desc("editn: Toggle search & replace panel"),
|
||||
["n|<leader>Sp"] = map_callback(function()
|
||||
require("spectre").open_visual({ select_word = true })
|
||||
end)
|
||||
:with_silent()
|
||||
:with_noremap()
|
||||
:with_desc("editn: search&replace current word (project)"),
|
||||
["v|<leader>Sp"] = map_callback(function()
|
||||
require("spectre").open_visual()
|
||||
end)
|
||||
:with_silent()
|
||||
:with_noremap()
|
||||
:with_desc("edit: search & replace current word (project)"),
|
||||
["n|<leader>Sf"] = map_callback(function()
|
||||
require("spectre").open_file_search({ select_word = true })
|
||||
end)
|
||||
:with_silent()
|
||||
:with_noremap()
|
||||
:with_desc("editn: search & replace current word (file)"),
|
||||
-- Plugin: diffview.nvim
|
||||
["n|<leader>gd"] = map_cr("DiffviewOpen"):with_silent():with_noremap():with_desc("git: Show diff"),
|
||||
["n|<leader>gD"] = map_cr("DiffviewClose"):with_silent():with_noremap():with_desc("git: Close diff"),
|
||||
|
||||
-- Plugin: nvim-treehopper
|
||||
["o|m"] = map_cu("lua require('tsht').nodes()"):with_silent():with_desc("jump: Operate across syntax tree"),
|
||||
-- Plugin: hop.nvim
|
||||
["nv|<leader>w"] = map_cmd("<Cmd>HopWordMW<CR>"):with_noremap():with_desc("jump: Goto word"),
|
||||
["nv|<leader>j"] = map_cmd("<Cmd>HopLineMW<CR>"):with_noremap():with_desc("jump: Goto line"),
|
||||
["nv|<leader>k"] = map_cmd("<Cmd>HopLineMW<CR>"):with_noremap():with_desc("jump: Goto line"),
|
||||
["nv|<leader>c"] = map_cmd("<Cmd>HopChar1MW<CR>"):with_noremap():with_desc("jump: Goto one char"),
|
||||
["nv|<leader>C"] = map_cmd("<Cmd>HopChar2MW<CR>"):with_noremap():with_desc("jump: Goto two chars"),
|
||||
|
||||
-- Plugin suda.vim
|
||||
["n|<A-s>"] = map_cu("SudaWrite"):with_silent():with_noremap():with_desc("editn: Save file using sudo"),
|
||||
-- Plugin: grug-far
|
||||
["n|<leader>Ss"] = map_callback(function()
|
||||
require("grug-far").open()
|
||||
end)
|
||||
:with_silent()
|
||||
:with_noremap()
|
||||
:with_desc("editn: Toggle search & replace panel"),
|
||||
["n|<leader>Sp"] = map_callback(function()
|
||||
require("grug-far").open({ prefills = { search = vim.fn.expand("<cword>") } })
|
||||
end)
|
||||
:with_silent()
|
||||
:with_noremap()
|
||||
:with_desc("editn: search&replace current word (project)"),
|
||||
["v|<leader>Sp"] = map_callback(function()
|
||||
require("grug-far").with_visual_selection()
|
||||
end)
|
||||
:with_silent()
|
||||
:with_noremap()
|
||||
:with_desc("edit: search & replace current word (project)"),
|
||||
["n|<leader>Sf"] = map_callback(function()
|
||||
require("grug-far").open({ prefills = { paths = vim.fn.expand("%") } })
|
||||
end)
|
||||
:with_silent()
|
||||
:with_noremap()
|
||||
:with_desc("editn: search & replace current word (file)"),
|
||||
|
||||
-- Plugin: nvim-treehopper
|
||||
["o|m"] = map_cu("lua require('tsht').nodes()"):with_silent():with_desc("jump: Operate across syntax tree"),
|
||||
|
||||
-- Plugin: suda.vim
|
||||
["n|<A-s>"] = map_cu("SudaWrite"):with_silent():with_noremap():with_desc("editn: Save file using sudo"),
|
||||
},
|
||||
}
|
||||
|
||||
bind.nvim_load_mapping(plug_map)
|
||||
bind.nvim_load_mapping(mappings.builtins)
|
||||
bind.nvim_load_mapping(mappings.plugins)
|
||||
|
||||
@@ -3,14 +3,20 @@ _G._command_panel = function()
|
||||
lhs_filter = function(lhs)
|
||||
return not string.find(lhs, "Þ")
|
||||
end,
|
||||
layout_config = {
|
||||
width = 0.6,
|
||||
height = 0.6,
|
||||
prompt_position = "top",
|
||||
},
|
||||
})
|
||||
end
|
||||
|
||||
_G._flash_esc_or_noh = function()
|
||||
local flash_active, state = pcall(function()
|
||||
return require("flash.plugins.char").state
|
||||
end)
|
||||
if flash_active and state then
|
||||
state:hide()
|
||||
else
|
||||
pcall(vim.cmd.noh)
|
||||
end
|
||||
end
|
||||
|
||||
_G._telescope_collections = function(picker_type)
|
||||
local actions = require("telescope.actions")
|
||||
local action_state = require("telescope.actions.state")
|
||||
@@ -38,14 +44,27 @@ _G._telescope_collections = function(picker_type)
|
||||
:find()
|
||||
end
|
||||
|
||||
_G._flash_esc_or_noh = function()
|
||||
local flash_active, state = pcall(function()
|
||||
return require("flash.plugins.char").state
|
||||
end)
|
||||
if flash_active and state then
|
||||
state:hide()
|
||||
else
|
||||
pcall(vim.cmd.noh)
|
||||
_G._toggle_inlayhint = function()
|
||||
local is_enabled = vim.lsp.inlay_hint.is_enabled()
|
||||
|
||||
vim.lsp.inlay_hint.enable(not is_enabled)
|
||||
vim.notify(
|
||||
(is_enabled and "Inlay hint disabled successfully" or "Inlay hint enabled successfully"),
|
||||
vim.log.levels.INFO,
|
||||
{ title = "LSP Inlay Hint" }
|
||||
)
|
||||
end
|
||||
|
||||
local _vt_enabled = require("core.settings").diagnostics_virtual_text
|
||||
_G._toggle_virtualtext = function()
|
||||
if vim.diagnostic.is_enabled() then
|
||||
_vt_enabled = not _vt_enabled
|
||||
vim.diagnostic[_vt_enabled and "show" or "hide"]()
|
||||
vim.notify(
|
||||
(_vt_enabled and "Virtual text is now displayed" or "Virtual text is now hidden"),
|
||||
vim.log.levels.INFO,
|
||||
{ title = "LSP Diagnostic" }
|
||||
)
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@@ -1,27 +1,42 @@
|
||||
require("keymap.helpers")
|
||||
local bind = require("keymap.bind")
|
||||
local map_cr = bind.map_cr
|
||||
-- local map_cu = bind.map_cu
|
||||
-- local map_cmd = bind.map_cmd
|
||||
-- local map_callback = bind.map_callback
|
||||
|
||||
local plug_map = {
|
||||
-- Package manager: lazy.nvim
|
||||
["n|<leader>ph"] = map_cr("Lazy"):with_silent():with_noremap():with_nowait():with_desc("package: Show"),
|
||||
["n|<leader>ps"] = map_cr("Lazy sync"):with_silent():with_noremap():with_nowait():with_desc("package: Sync"),
|
||||
["n|<leader>pu"] = map_cr("Lazy update"):with_silent():with_noremap():with_nowait():with_desc("package: Update"),
|
||||
["n|<leader>pi"] = map_cr("Lazy install"):with_silent():with_noremap():with_nowait():with_desc("package: Install"),
|
||||
["n|<leader>pl"] = map_cr("Lazy log"):with_silent():with_noremap():with_nowait():with_desc("package: Log"),
|
||||
["n|<leader>pc"] = map_cr("Lazy check"):with_silent():with_noremap():with_nowait():with_desc("package: Check"),
|
||||
["n|<leader>pd"] = map_cr("Lazy debug"):with_silent():with_noremap():with_nowait():with_desc("package: Debug"),
|
||||
["n|<leader>pp"] = map_cr("Lazy profile"):with_silent():with_noremap():with_nowait():with_desc("package: Profile"),
|
||||
["n|<leader>pr"] = map_cr("Lazy restore"):with_silent():with_noremap():with_nowait():with_desc("package: Restore"),
|
||||
["n|<leader>px"] = map_cr("Lazy clean"):with_silent():with_noremap():with_nowait():with_desc("package: Clean"),
|
||||
local mappings = {
|
||||
core = {
|
||||
-- Package manager: lazy.nvim
|
||||
["n|<leader>ph"] = map_cr("Lazy"):with_silent():with_noremap():with_nowait():with_desc("package: Show"),
|
||||
["n|<leader>ps"] = map_cr("Lazy sync"):with_silent():with_noremap():with_nowait():with_desc("package: Sync"),
|
||||
["n|<leader>pu"] = map_cr("Lazy update")
|
||||
:with_silent()
|
||||
:with_noremap()
|
||||
:with_nowait()
|
||||
:with_desc("package: Update"),
|
||||
["n|<leader>pi"] = map_cr("Lazy install")
|
||||
:with_silent()
|
||||
:with_noremap()
|
||||
:with_nowait()
|
||||
:with_desc("package: Install"),
|
||||
["n|<leader>pl"] = map_cr("Lazy log"):with_silent():with_noremap():with_nowait():with_desc("package: Log"),
|
||||
["n|<leader>pc"] = map_cr("Lazy check"):with_silent():with_noremap():with_nowait():with_desc("package: Check"),
|
||||
["n|<leader>pd"] = map_cr("Lazy debug"):with_silent():with_noremap():with_nowait():with_desc("package: Debug"),
|
||||
["n|<leader>pp"] = map_cr("Lazy profile")
|
||||
:with_silent()
|
||||
:with_noremap()
|
||||
:with_nowait()
|
||||
:with_desc("package: Profile"),
|
||||
["n|<leader>pr"] = map_cr("Lazy restore")
|
||||
:with_silent()
|
||||
:with_noremap()
|
||||
:with_nowait()
|
||||
:with_desc("package: Restore"),
|
||||
["n|<leader>px"] = map_cr("Lazy clean"):with_silent():with_noremap():with_nowait():with_desc("package: Clean"),
|
||||
},
|
||||
}
|
||||
|
||||
bind.nvim_load_mapping(plug_map)
|
||||
bind.nvim_load_mapping(mappings.core)
|
||||
|
||||
-- Plugin keymaps
|
||||
-- Builtin & Plugin keymaps
|
||||
require("keymap.completion")
|
||||
require("keymap.editor")
|
||||
require("keymap.lang")
|
||||
@@ -29,7 +44,7 @@ require("keymap.tool")
|
||||
require("keymap.ui")
|
||||
|
||||
-- User keymaps
|
||||
local ok, mappings = pcall(require, "user.keymap.init")
|
||||
local ok, def = pcall(require, "user.keymap.init")
|
||||
if ok then
|
||||
require("modules.utils.keymap").replace(mappings)
|
||||
require("modules.utils.keymap").replace(def)
|
||||
end
|
||||
|
||||
@@ -1,17 +1,16 @@
|
||||
local bind = require("keymap.bind")
|
||||
local map_cr = bind.map_cr
|
||||
-- local map_cu = bind.map_cu
|
||||
-- local map_cmd = bind.map_cmd
|
||||
-- local map_callback = bind.map_callback
|
||||
|
||||
local plug_map = {
|
||||
-- Plugin render-markdown.nvim
|
||||
["n|<F1>"] = map_cr("RenderMarkdown toggle")
|
||||
:with_noremap()
|
||||
:with_silent()
|
||||
:with_desc("tool: toggle markdown preview within nvim"),
|
||||
-- Plugin MarkdownPreview
|
||||
["n|<F12>"] = map_cr("MarkdownPreviewToggle"):with_noremap():with_silent():with_desc("tool: Preview markdown"),
|
||||
local mappings = {
|
||||
plugins = {
|
||||
-- Plugin: render-markdown.nvim
|
||||
["n|<F1>"] = map_cr("RenderMarkdown toggle")
|
||||
:with_noremap()
|
||||
:with_silent()
|
||||
:with_desc("tool: toggle markdown preview within nvim"),
|
||||
-- Plugin: MarkdownPreview
|
||||
["n|<F12>"] = map_cr("MarkdownPreviewToggle"):with_noremap():with_silent():with_desc("tool: Preview markdown"),
|
||||
},
|
||||
}
|
||||
|
||||
bind.nvim_load_mapping(plug_map)
|
||||
bind.nvim_load_mapping(mappings.plugins)
|
||||
|
||||
+201
-176
@@ -1,3 +1,4 @@
|
||||
local vim_path = require("core.global").vim_path
|
||||
local bind = require("keymap.bind")
|
||||
local map_cr = bind.map_cr
|
||||
local map_cu = bind.map_cu
|
||||
@@ -5,187 +6,211 @@ local map_cmd = bind.map_cmd
|
||||
local map_callback = bind.map_callback
|
||||
require("keymap.helpers")
|
||||
|
||||
local plug_map = {
|
||||
-- Plugin: vim-fugitive
|
||||
["n|gps"] = map_cr("G push"):with_noremap():with_silent():with_desc("git: Push"),
|
||||
["n|gpl"] = map_cr("G pull"):with_noremap():with_silent():with_desc("git: Pull"),
|
||||
["n|<leader>gG"] = map_cu("Git"):with_noremap():with_silent():with_desc("git: Open git-fugitive"),
|
||||
local mappings = {
|
||||
plugins = {
|
||||
-- Plugin: edgy
|
||||
["n|<C-n>"] = map_callback(function()
|
||||
require("edgy").toggle("left")
|
||||
end)
|
||||
:with_noremap()
|
||||
:with_silent()
|
||||
:with_desc("filetree: Toggle"),
|
||||
|
||||
-- Plugin: nvim-tree
|
||||
["n|<C-n>"] = map_cr("NvimTreeToggle"):with_noremap():with_silent():with_desc("filetree: Toggle"),
|
||||
["n|<leader>nf"] = map_cr("NvimTreeFindFile"):with_noremap():with_silent():with_desc("filetree: Find file"),
|
||||
["n|<leader>nr"] = map_cr("NvimTreeRefresh"):with_noremap():with_silent():with_desc("filetree: Refresh"),
|
||||
-- Plugin: vim-fugitive
|
||||
["n|gps"] = map_cr("G push"):with_noremap():with_silent():with_desc("git: Push"),
|
||||
["n|gpl"] = map_cr("G pull"):with_noremap():with_silent():with_desc("git: Pull"),
|
||||
["n|<leader>gG"] = map_cu("Git"):with_noremap():with_silent():with_desc("git: Open git-fugitive"),
|
||||
|
||||
-- Plugin: sniprun
|
||||
["v|<leader>r"] = map_cr("SnipRun"):with_noremap():with_silent():with_desc("tool: Run code by range"),
|
||||
["n|<leader>r"] = map_cu([[%SnipRun]]):with_noremap():with_silent():with_desc("tool: Run code by file"),
|
||||
-- Plugin: nvim-tree
|
||||
["n|<leader>nf"] = map_cr("NvimTreeFindFile"):with_noremap():with_silent():with_desc("filetree: Find file"),
|
||||
["n|<leader>nr"] = map_cr("NvimTreeRefresh"):with_noremap():with_silent():with_desc("filetree: Refresh"),
|
||||
|
||||
-- Plugin: toggleterm
|
||||
["t|<Esc><Esc>"] = map_cmd([[<C-\><C-n>]]):with_noremap():with_silent(), -- switch to normal mode in terminal.
|
||||
["n|<C-\\>"] = map_cr("ToggleTerm direction=horizontal")
|
||||
:with_noremap()
|
||||
:with_silent()
|
||||
:with_desc("terminal: Toggle horizontal"),
|
||||
["i|<C-\\>"] = map_cmd("<Esc><Cmd>ToggleTerm direction=horizontal<CR>")
|
||||
:with_noremap()
|
||||
:with_silent()
|
||||
:with_desc("terminal: Toggle horizontal"),
|
||||
["t|<C-\\>"] = map_cmd("<Cmd>ToggleTerm<CR>"):with_noremap():with_silent():with_desc("terminal: Toggle horizontal"),
|
||||
["n|<A-\\>"] = map_cr("ToggleTerm direction=vertical")
|
||||
:with_noremap()
|
||||
:with_silent()
|
||||
:with_desc("terminal: Toggle vertical"),
|
||||
["i|<A-\\>"] = map_cmd("<Esc><Cmd>ToggleTerm direction=vertical<CR>")
|
||||
:with_noremap()
|
||||
:with_silent()
|
||||
:with_desc("terminal: Toggle vertical"),
|
||||
["t|<A-\\>"] = map_cmd("<Cmd>ToggleTerm<CR>"):with_noremap():with_silent():with_desc("terminal: Toggle vertical"),
|
||||
["n|<F5>"] = map_cr("ToggleTerm direction=vertical")
|
||||
:with_noremap()
|
||||
:with_silent()
|
||||
:with_desc("terminal: Toggle vertical"),
|
||||
["i|<F5>"] = map_cmd("<Esc><Cmd>ToggleTerm direction=vertical<CR>")
|
||||
:with_noremap()
|
||||
:with_silent()
|
||||
:with_desc("terminal: Toggle vertical"),
|
||||
["t|<F5>"] = map_cmd("<Cmd>ToggleTerm<CR>"):with_noremap():with_silent():with_desc("terminal: Toggle vertical"),
|
||||
["n|<A-d>"] = map_cr("ToggleTerm direction=float"):with_noremap():with_silent():with_desc("terminal: Toggle float"),
|
||||
["i|<A-d>"] = map_cmd("<Esc><Cmd>ToggleTerm direction=float<CR>")
|
||||
:with_noremap()
|
||||
:with_silent()
|
||||
:with_desc("terminal: Toggle float"),
|
||||
["t|<A-d>"] = map_cmd("<Cmd>ToggleTerm<CR>"):with_noremap():with_silent():with_desc("terminal: Toggle float"),
|
||||
["n|<leader>gg"] = map_callback(function()
|
||||
_toggle_lazygit()
|
||||
end)
|
||||
:with_noremap()
|
||||
:with_silent()
|
||||
:with_desc("git: Toggle lazygit"),
|
||||
-- Plugin: sniprun
|
||||
["v|<leader>r"] = map_cr("SnipRun"):with_noremap():with_silent():with_desc("tool: Run code by range"),
|
||||
["n|<leader>r"] = map_cu([[%SnipRun]]):with_noremap():with_silent():with_desc("tool: Run code by file"),
|
||||
|
||||
-- Plugin: trouble
|
||||
["n|gt"] = map_cr("Trouble diagnostics toggle"):with_noremap():with_silent():with_desc("lsp: Toggle trouble list"),
|
||||
["n|<leader>lw"] = map_cr("Trouble diagnostics toggle")
|
||||
:with_noremap()
|
||||
:with_silent()
|
||||
:with_desc("lsp: Show workspace diagnostics"),
|
||||
["n|<leader>lp"] = map_cr("Trouble project_diagnostics toggle")
|
||||
:with_noremap()
|
||||
:with_silent()
|
||||
:with_desc("lsp: Show project diagnostics"),
|
||||
["n|<leader>ld"] = map_cr("Trouble diagnostics toggle filter.buf=0")
|
||||
:with_noremap()
|
||||
:with_silent()
|
||||
:with_desc("lsp: Show document diagnostics"),
|
||||
-- Plugin: toggleterm
|
||||
["t|<Esc><Esc>"] = map_cmd([[<C-\><C-n>]]):with_noremap():with_silent(), -- switch to normal mode in terminal.
|
||||
["n|<C-\\>"] = map_cr("ToggleTerm direction=horizontal")
|
||||
:with_noremap()
|
||||
:with_silent()
|
||||
:with_desc("terminal: Toggle horizontal"),
|
||||
["i|<C-\\>"] = map_cmd("<Esc><Cmd>ToggleTerm direction=horizontal<CR>")
|
||||
:with_noremap()
|
||||
:with_silent()
|
||||
:with_desc("terminal: Toggle horizontal"),
|
||||
["t|<C-\\>"] = map_cmd("<Cmd>ToggleTerm<CR>")
|
||||
:with_noremap()
|
||||
:with_silent()
|
||||
:with_desc("terminal: Toggle horizontal"),
|
||||
["n|<A-\\>"] = map_cr("ToggleTerm direction=vertical")
|
||||
:with_noremap()
|
||||
:with_silent()
|
||||
:with_desc("terminal: Toggle vertical"),
|
||||
["i|<A-\\>"] = map_cmd("<Esc><Cmd>ToggleTerm direction=vertical<CR>")
|
||||
:with_noremap()
|
||||
:with_silent()
|
||||
:with_desc("terminal: Toggle vertical"),
|
||||
["t|<A-\\>"] = map_cmd("<Cmd>ToggleTerm<CR>")
|
||||
:with_noremap()
|
||||
:with_silent()
|
||||
:with_desc("terminal: Toggle vertical"),
|
||||
["n|<F5>"] = map_cr("ToggleTerm direction=vertical")
|
||||
:with_noremap()
|
||||
:with_silent()
|
||||
:with_desc("terminal: Toggle vertical"),
|
||||
["i|<F5>"] = map_cmd("<Esc><Cmd>ToggleTerm direction=vertical<CR>")
|
||||
:with_noremap()
|
||||
:with_silent()
|
||||
:with_desc("terminal: Toggle vertical"),
|
||||
["t|<F5>"] = map_cmd("<Cmd>ToggleTerm<CR>"):with_noremap():with_silent():with_desc("terminal: Toggle vertical"),
|
||||
["n|<A-d>"] = map_cr("ToggleTerm direction=float")
|
||||
:with_noremap()
|
||||
:with_silent()
|
||||
:with_desc("terminal: Toggle float"),
|
||||
["i|<A-d>"] = map_cmd("<Esc><Cmd>ToggleTerm direction=float<CR>")
|
||||
:with_noremap()
|
||||
:with_silent()
|
||||
:with_desc("terminal: Toggle float"),
|
||||
["t|<A-d>"] = map_cmd("<Cmd>ToggleTerm<CR>"):with_noremap():with_silent():with_desc("terminal: Toggle float"),
|
||||
["n|<leader>gg"] = map_callback(function()
|
||||
_toggle_lazygit()
|
||||
end)
|
||||
:with_noremap()
|
||||
:with_silent()
|
||||
:with_desc("git: Toggle lazygit"),
|
||||
|
||||
-- Plugin: telescope
|
||||
["n|<C-p>"] = map_callback(function()
|
||||
_command_panel()
|
||||
end)
|
||||
:with_noremap()
|
||||
:with_silent()
|
||||
:with_desc("tool: Toggle command panel"),
|
||||
["n|<leader>fc"] = map_callback(function()
|
||||
_telescope_collections(require("telescope.themes").get_dropdown())
|
||||
end)
|
||||
:with_noremap()
|
||||
:with_silent()
|
||||
:with_desc("tool: Open Telescope collections"),
|
||||
["n|<leader>ff"] = map_callback(function()
|
||||
require("search").open({ collection = "file" })
|
||||
end)
|
||||
:with_noremap()
|
||||
:with_silent()
|
||||
:with_desc("tool: Find files"),
|
||||
["n|<leader>fp"] = map_callback(function()
|
||||
require("search").open({ collection = "pattern" })
|
||||
end)
|
||||
:with_noremap()
|
||||
:with_silent()
|
||||
:with_desc("tool: Find patterns"),
|
||||
["v|<leader>fs"] = map_cu("Telescope grep_string")
|
||||
:with_noremap()
|
||||
:with_silent()
|
||||
:with_desc("tool: Find word under cursor"),
|
||||
["n|<leader>fg"] = map_callback(function()
|
||||
require("search").open({ collection = "git" })
|
||||
end)
|
||||
:with_noremap()
|
||||
:with_silent()
|
||||
:with_desc("tool: Locate Git objects"),
|
||||
["n|<leader>fd"] = map_callback(function()
|
||||
require("search").open({ collection = "dossier" })
|
||||
end)
|
||||
:with_noremap()
|
||||
:with_silent()
|
||||
:with_desc("tool: Retrieve dossiers"),
|
||||
["n|<leader>fm"] = map_callback(function()
|
||||
require("search").open({ collection = "misc" })
|
||||
end)
|
||||
:with_noremap()
|
||||
:with_silent()
|
||||
:with_desc("tool: Miscellaneous"),
|
||||
-- Plugin: trouble
|
||||
["n|gt"] = map_cr("Trouble diagnostics toggle")
|
||||
:with_noremap()
|
||||
:with_silent()
|
||||
:with_desc("lsp: Toggle trouble list"),
|
||||
["n|<leader>lw"] = map_cr("Trouble diagnostics toggle")
|
||||
:with_noremap()
|
||||
:with_silent()
|
||||
:with_desc("lsp: Show workspace diagnostics"),
|
||||
["n|<leader>lp"] = map_cr("Trouble project_diagnostics toggle")
|
||||
:with_noremap()
|
||||
:with_silent()
|
||||
:with_desc("lsp: Show project diagnostics"),
|
||||
["n|<leader>ld"] = map_cr("Trouble diagnostics toggle filter.buf=0")
|
||||
:with_noremap()
|
||||
:with_silent()
|
||||
:with_desc("lsp: Show document diagnostics"),
|
||||
|
||||
-- Plugin: dap
|
||||
["n|<F6>"] = map_callback(function()
|
||||
require("dap").continue()
|
||||
end)
|
||||
:with_noremap()
|
||||
:with_silent()
|
||||
:with_desc("debug: Run/Continue"),
|
||||
["n|<F7>"] = map_callback(function()
|
||||
require("dap").terminate()
|
||||
end)
|
||||
:with_noremap()
|
||||
:with_silent()
|
||||
:with_desc("debug: Stop"),
|
||||
["n|<F8>"] = map_callback(function()
|
||||
require("dap").toggle_breakpoint()
|
||||
end)
|
||||
:with_noremap()
|
||||
:with_silent()
|
||||
:with_desc("debug: Toggle breakpoint"),
|
||||
["n|<F9>"] = map_callback(function()
|
||||
require("dap").step_into()
|
||||
end)
|
||||
:with_noremap()
|
||||
:with_silent()
|
||||
:with_desc("debug: Step into"),
|
||||
["n|<F10>"] = map_callback(function()
|
||||
require("dap").step_out()
|
||||
end)
|
||||
:with_noremap()
|
||||
:with_silent()
|
||||
:with_desc("debug: Step out"),
|
||||
["n|<F11>"] = map_callback(function()
|
||||
require("dap").step_over()
|
||||
end)
|
||||
:with_noremap()
|
||||
:with_silent()
|
||||
:with_desc("debug: Step over"),
|
||||
["n|<leader>db"] = map_callback(function()
|
||||
require("dap").set_breakpoint(vim.fn.input("Breakpoint condition: "))
|
||||
end)
|
||||
:with_noremap()
|
||||
:with_silent()
|
||||
:with_desc("debug: Set breakpoint with condition"),
|
||||
["n|<leader>dc"] = map_callback(function()
|
||||
require("dap").run_to_cursor()
|
||||
end)
|
||||
:with_noremap()
|
||||
:with_silent()
|
||||
:with_desc("debug: Run to cursor"),
|
||||
["n|<leader>dl"] = map_callback(function()
|
||||
require("dap").run_last()
|
||||
end)
|
||||
:with_noremap()
|
||||
:with_silent()
|
||||
:with_desc("debug: Run last"),
|
||||
["n|<leader>do"] = map_callback(function()
|
||||
require("dap").repl.open()
|
||||
end)
|
||||
:with_noremap()
|
||||
:with_silent()
|
||||
:with_desc("debug: Open REPL"),
|
||||
-- Plugin: telescope
|
||||
["n|<C-p>"] = map_callback(function()
|
||||
_command_panel()
|
||||
end)
|
||||
:with_noremap()
|
||||
:with_silent()
|
||||
:with_desc("tool: Toggle command panel"),
|
||||
["n|<leader>fc"] = map_callback(function()
|
||||
_telescope_collections(require("telescope.themes").get_dropdown())
|
||||
end)
|
||||
:with_noremap()
|
||||
:with_silent()
|
||||
:with_desc("tool: Open Telescope collections"),
|
||||
["n|<leader>ff"] = map_callback(function()
|
||||
require("search").open({ collection = "file" })
|
||||
end)
|
||||
:with_noremap()
|
||||
:with_silent()
|
||||
:with_desc("tool: Find files"),
|
||||
["n|<leader>fp"] = map_callback(function()
|
||||
require("search").open({ collection = "pattern" })
|
||||
end)
|
||||
:with_noremap()
|
||||
:with_silent()
|
||||
:with_desc("tool: Find patterns"),
|
||||
["v|<leader>fs"] = map_callback(function()
|
||||
local opts = vim.fn.getcwd() == vim_path and { additional_args = { "--no-ignore" } } or {}
|
||||
require("telescope-live-grep-args.shortcuts").grep_visual_selection(opts)
|
||||
end)
|
||||
:with_noremap()
|
||||
:with_silent()
|
||||
:with_desc("tool: Find word under cursor"),
|
||||
["n|<leader>fg"] = map_callback(function()
|
||||
require("search").open({ collection = "git" })
|
||||
end)
|
||||
:with_noremap()
|
||||
:with_silent()
|
||||
:with_desc("tool: Locate Git objects"),
|
||||
["n|<leader>fd"] = map_callback(function()
|
||||
require("search").open({ collection = "dossier" })
|
||||
end)
|
||||
:with_noremap()
|
||||
:with_silent()
|
||||
:with_desc("tool: Retrieve dossiers"),
|
||||
["n|<leader>fm"] = map_callback(function()
|
||||
require("search").open({ collection = "misc" })
|
||||
end)
|
||||
:with_noremap()
|
||||
:with_silent()
|
||||
:with_desc("tool: Miscellaneous"),
|
||||
|
||||
-- Plugin: dap
|
||||
["n|<F6>"] = map_callback(function()
|
||||
require("dap").continue()
|
||||
end)
|
||||
:with_noremap()
|
||||
:with_silent()
|
||||
:with_desc("debug: Run/Continue"),
|
||||
["n|<F7>"] = map_callback(function()
|
||||
require("dap").terminate()
|
||||
end)
|
||||
:with_noremap()
|
||||
:with_silent()
|
||||
:with_desc("debug: Stop"),
|
||||
["n|<F8>"] = map_callback(function()
|
||||
require("dap").toggle_breakpoint()
|
||||
end)
|
||||
:with_noremap()
|
||||
:with_silent()
|
||||
:with_desc("debug: Toggle breakpoint"),
|
||||
["n|<F9>"] = map_callback(function()
|
||||
require("dap").step_into()
|
||||
end)
|
||||
:with_noremap()
|
||||
:with_silent()
|
||||
:with_desc("debug: Step into"),
|
||||
["n|<F10>"] = map_callback(function()
|
||||
require("dap").step_out()
|
||||
end)
|
||||
:with_noremap()
|
||||
:with_silent()
|
||||
:with_desc("debug: Step out"),
|
||||
["n|<F11>"] = map_callback(function()
|
||||
require("dap").step_over()
|
||||
end)
|
||||
:with_noremap()
|
||||
:with_silent()
|
||||
:with_desc("debug: Step over"),
|
||||
["n|<leader>db"] = map_callback(function()
|
||||
require("dap").set_breakpoint(vim.fn.input("Breakpoint condition: "))
|
||||
end)
|
||||
:with_noremap()
|
||||
:with_silent()
|
||||
:with_desc("debug: Set breakpoint with condition"),
|
||||
["n|<leader>dc"] = map_callback(function()
|
||||
require("dap").run_to_cursor()
|
||||
end)
|
||||
:with_noremap()
|
||||
:with_silent()
|
||||
:with_desc("debug: Run to cursor"),
|
||||
["n|<leader>dl"] = map_callback(function()
|
||||
require("dap").run_last()
|
||||
end)
|
||||
:with_noremap()
|
||||
:with_silent()
|
||||
:with_desc("debug: Run last"),
|
||||
["n|<leader>do"] = map_callback(function()
|
||||
require("dap").repl.open()
|
||||
end)
|
||||
:with_noremap()
|
||||
:with_silent()
|
||||
:with_desc("debug: Open REPL"),
|
||||
},
|
||||
}
|
||||
|
||||
bind.nvim_load_mapping(plug_map)
|
||||
bind.nvim_load_mapping(mappings.plugins)
|
||||
|
||||
+147
-81
@@ -1,105 +1,171 @@
|
||||
local bind = require("keymap.bind")
|
||||
local map_cr = bind.map_cr
|
||||
-- local map_cu = bind.map_cu
|
||||
-- local map_cmd = bind.map_cmd
|
||||
-- local map_callback = bind.map_callback
|
||||
local map_cu = bind.map_cu
|
||||
local map_cmd = bind.map_cmd
|
||||
local map_callback = bind.map_callback
|
||||
|
||||
local plug_map = {
|
||||
-- Plugin: bufferline.nvim
|
||||
["n|<A-i>"] = map_cr("BufferLineCycleNext"):with_noremap():with_silent():with_desc("buffer: Switch to next"),
|
||||
["n|<A-o>"] = map_cr("BufferLineCyclePrev"):with_noremap():with_silent():with_desc("buffer: Switch to prev"),
|
||||
["n|<A-S-i>"] = map_cr("BufferLineMoveNext"):with_noremap():with_silent():with_desc("buffer: Move current to next"),
|
||||
["n|<A-S-o>"] = map_cr("BufferLineMovePrev"):with_noremap():with_silent():with_desc("buffer: Move current to prev"),
|
||||
["n|<leader>be"] = map_cr("BufferLineSortByExtension"):with_noremap():with_desc("buffer: Sort by extension"),
|
||||
["n|<leader>bd"] = map_cr("BufferLineSortByDirectory"):with_noremap():with_desc("buffer: Sort by directory"),
|
||||
["n|<A-1>"] = map_cr("BufferLineGoToBuffer 1"):with_noremap():with_silent():with_desc("buffer: Goto buffer 1"),
|
||||
["n|<A-2>"] = map_cr("BufferLineGoToBuffer 2"):with_noremap():with_silent():with_desc("buffer: Goto buffer 2"),
|
||||
["n|<A-3>"] = map_cr("BufferLineGoToBuffer 3"):with_noremap():with_silent():with_desc("buffer: Goto buffer 3"),
|
||||
["n|<A-4>"] = map_cr("BufferLineGoToBuffer 4"):with_noremap():with_silent():with_desc("buffer: Goto buffer 4"),
|
||||
["n|<A-5>"] = map_cr("BufferLineGoToBuffer 5"):with_noremap():with_silent():with_desc("buffer: Goto buffer 5"),
|
||||
["n|<A-6>"] = map_cr("BufferLineGoToBuffer 6"):with_noremap():with_silent():with_desc("buffer: Goto buffer 6"),
|
||||
["n|<A-7>"] = map_cr("BufferLineGoToBuffer 7"):with_noremap():with_silent():with_desc("buffer: Goto buffer 7"),
|
||||
["n|<A-8>"] = map_cr("BufferLineGoToBuffer 8"):with_noremap():with_silent():with_desc("buffer: Goto buffer 8"),
|
||||
["n|<A-9>"] = map_cr("BufferLineGoToBuffer 9"):with_noremap():with_silent():with_desc("buffer: Goto buffer 9"),
|
||||
local mappings = {
|
||||
builtins = {
|
||||
-- Builtins: Buffer
|
||||
["n|<leader>bn"] = map_cu("enew"):with_noremap():with_silent():with_desc("buffer: New"),
|
||||
|
||||
-- Builtins: Terminal
|
||||
["t|<C-w>h"] = map_cmd("<Cmd>wincmd h<CR>"):with_silent():with_noremap():with_desc("window: Focus left"),
|
||||
["t|<C-w>l"] = map_cmd("<Cmd>wincmd l<CR>"):with_silent():with_noremap():with_desc("window: Focus right"),
|
||||
["t|<C-w>j"] = map_cmd("<Cmd>wincmd j<CR>"):with_silent():with_noremap():with_desc("window: Focus down"),
|
||||
["t|<C-w>k"] = map_cmd("<Cmd>wincmd k<CR>"):with_silent():with_noremap():with_desc("window: Focus up"),
|
||||
|
||||
-- Builtins: Tabpage
|
||||
["n|tn"] = map_cr("tabnew"):with_noremap():with_silent():with_desc("tab: Create a new tab"),
|
||||
["n|tk"] = map_cr("tabnext"):with_noremap():with_silent():with_desc("tab: Move to next tab"),
|
||||
["n|tj"] = map_cr("tabprevious"):with_noremap():with_silent():with_desc("tab: Move to previous tab"),
|
||||
["n|to"] = map_cr("tabonly"):with_noremap():with_silent():with_desc("tab: Only keep current tab"),
|
||||
},
|
||||
plugins = {
|
||||
-- Plugin: nvim-bufdel
|
||||
["n|<A-q>"] = map_cr("BufDel"):with_noremap():with_silent():with_desc("buffer: Close current"),
|
||||
|
||||
-- Plugin: bufferline.nvim
|
||||
["n|<A-i>"] = map_cr("BufferLineCycleNext"):with_noremap():with_silent():with_desc("buffer: Switch to next"),
|
||||
["n|<A-o>"] = map_cr("BufferLineCyclePrev"):with_noremap():with_silent():with_desc("buffer: Switch to prev"),
|
||||
["n|<A-S-i>"] = map_cr("BufferLineMoveNext")
|
||||
:with_noremap()
|
||||
:with_silent()
|
||||
:with_desc("buffer: Move current to next"),
|
||||
["n|<A-S-o>"] = map_cr("BufferLineMovePrev")
|
||||
:with_noremap()
|
||||
:with_silent()
|
||||
:with_desc("buffer: Move current to prev"),
|
||||
["n|<leader>be"] = map_cr("BufferLineSortByExtension"):with_noremap():with_desc("buffer: Sort by extension"),
|
||||
["n|<leader>bd"] = map_cr("BufferLineSortByDirectory"):with_noremap():with_desc("buffer: Sort by directory"),
|
||||
["n|<A-1>"] = map_cr("BufferLineGoToBuffer 1"):with_noremap():with_silent():with_desc("buffer: Goto buffer 1"),
|
||||
["n|<A-2>"] = map_cr("BufferLineGoToBuffer 2"):with_noremap():with_silent():with_desc("buffer: Goto buffer 2"),
|
||||
["n|<A-3>"] = map_cr("BufferLineGoToBuffer 3"):with_noremap():with_silent():with_desc("buffer: Goto buffer 3"),
|
||||
["n|<A-4>"] = map_cr("BufferLineGoToBuffer 4"):with_noremap():with_silent():with_desc("buffer: Goto buffer 4"),
|
||||
["n|<A-5>"] = map_cr("BufferLineGoToBuffer 5"):with_noremap():with_silent():with_desc("buffer: Goto buffer 5"),
|
||||
["n|<A-6>"] = map_cr("BufferLineGoToBuffer 6"):with_noremap():with_silent():with_desc("buffer: Goto buffer 6"),
|
||||
["n|<A-7>"] = map_cr("BufferLineGoToBuffer 7"):with_noremap():with_silent():with_desc("buffer: Goto buffer 7"),
|
||||
["n|<A-8>"] = map_cr("BufferLineGoToBuffer 8"):with_noremap():with_silent():with_desc("buffer: Goto buffer 8"),
|
||||
["n|<A-9>"] = map_cr("BufferLineGoToBuffer 9"):with_noremap():with_silent():with_desc("buffer: Goto buffer 9"),
|
||||
|
||||
-- Plugin: smart-splits.nvim
|
||||
["n|<A-h>"] = map_cu("SmartResizeLeft")
|
||||
:with_silent()
|
||||
:with_noremap()
|
||||
:with_desc("window: Resize -3 horizontally"),
|
||||
["n|<A-j>"] = map_cu("SmartResizeDown"):with_silent():with_noremap():with_desc("window: Resize -3 vertically"),
|
||||
["n|<A-k>"] = map_cu("SmartResizeUp"):with_silent():with_noremap():with_desc("window: Resize +3 vertically"),
|
||||
["n|<A-l>"] = map_cu("SmartResizeRight")
|
||||
:with_silent()
|
||||
:with_noremap()
|
||||
:with_desc("window: Resize +3 horizontally"),
|
||||
["n|<C-h>"] = map_cu("SmartCursorMoveLeft"):with_silent():with_noremap():with_desc("window: Focus left"),
|
||||
["n|<C-j>"] = map_cu("SmartCursorMoveDown"):with_silent():with_noremap():with_desc("window: Focus down"),
|
||||
["n|<C-k>"] = map_cu("SmartCursorMoveUp"):with_silent():with_noremap():with_desc("window: Focus up"),
|
||||
["n|<C-l>"] = map_cu("SmartCursorMoveRight"):with_silent():with_noremap():with_desc("window: Focus right"),
|
||||
["n|<leader>Wh"] = map_cu("SmartSwapLeft")
|
||||
:with_silent()
|
||||
:with_noremap()
|
||||
:with_desc("window: Move window leftward"),
|
||||
["n|<leader>Wj"] = map_cu("SmartSwapDown")
|
||||
:with_silent()
|
||||
:with_noremap()
|
||||
:with_desc("window: Move window downward"),
|
||||
["n|<leader>Wk"] = map_cu("SmartSwapUp"):with_silent():with_noremap():with_desc("window: Move window upward"),
|
||||
["n|<leader>Wl"] = map_cu("SmartSwapRight")
|
||||
:with_silent()
|
||||
:with_noremap()
|
||||
:with_desc("window: Move window rightward"),
|
||||
},
|
||||
}
|
||||
|
||||
bind.nvim_load_mapping(plug_map)
|
||||
bind.nvim_load_mapping(mappings.builtins)
|
||||
bind.nvim_load_mapping(mappings.plugins)
|
||||
|
||||
local mapping = {}
|
||||
--- The following code enables this file to be exported ---
|
||||
--- for use with gitsigns lazy-loaded keymap bindings ---
|
||||
|
||||
function mapping.gitsigns(buf)
|
||||
local actions = require("gitsigns.actions")
|
||||
local M = {}
|
||||
|
||||
function M.gitsigns(bufnr)
|
||||
local gitsigns = require("gitsigns")
|
||||
local map = {
|
||||
["n|]g"] = bind.map_callback(function()
|
||||
if vim.wo.diff then
|
||||
return "]g"
|
||||
end
|
||||
vim.schedule(function()
|
||||
actions.next_hunk()
|
||||
["n|]g"] = map_callback(function()
|
||||
if vim.wo.diff then
|
||||
return "]g"
|
||||
end
|
||||
vim.schedule(function()
|
||||
gitsigns.nav_hunk("next")
|
||||
end)
|
||||
return "<Ignore>"
|
||||
end)
|
||||
return "<Ignore>"
|
||||
end)
|
||||
:with_buffer(buf)
|
||||
:with_buffer(bufnr)
|
||||
:with_noremap()
|
||||
:with_expr()
|
||||
:with_desc("git: Goto next hunk"),
|
||||
["n|[g"] = bind.map_callback(function()
|
||||
if vim.wo.diff then
|
||||
return "[g"
|
||||
end
|
||||
vim.schedule(function()
|
||||
actions.prev_hunk()
|
||||
["n|[g"] = map_callback(function()
|
||||
if vim.wo.diff then
|
||||
return "[g"
|
||||
end
|
||||
vim.schedule(function()
|
||||
gitsigns.nav_hunk("prev")
|
||||
end)
|
||||
return "<Ignore>"
|
||||
end)
|
||||
return "<Ignore>"
|
||||
end)
|
||||
:with_buffer(buf)
|
||||
:with_buffer(bufnr)
|
||||
:with_noremap()
|
||||
:with_expr()
|
||||
:with_desc("git: Goto prev hunk"),
|
||||
["n|<leader>gs"] = bind.map_callback(function()
|
||||
actions.stage_hunk()
|
||||
end)
|
||||
:with_buffer(buf)
|
||||
:with_desc("git: Stage hunk"),
|
||||
["v|<leader>gs"] = bind.map_callback(function()
|
||||
actions.stage_hunk({ vim.fn.line("."), vim.fn.line("v") })
|
||||
end)
|
||||
:with_buffer(buf)
|
||||
:with_desc("git: Stage hunk"),
|
||||
["n|<leader>gu"] = bind.map_callback(function()
|
||||
actions.undo_stage_hunk()
|
||||
end)
|
||||
:with_buffer(buf)
|
||||
:with_desc("git: Undo stage hunk"),
|
||||
["n|<leader>gr"] = bind.map_callback(function()
|
||||
actions.reset_hunk()
|
||||
end)
|
||||
:with_buffer(buf)
|
||||
["n|<leader>gs"] = map_callback(function()
|
||||
gitsigns.stage_hunk()
|
||||
end)
|
||||
:with_buffer(bufnr)
|
||||
:with_noremap()
|
||||
:with_desc("git: Toggle staging/unstaging of hunk"),
|
||||
["v|<leader>gs"] = map_callback(function()
|
||||
gitsigns.stage_hunk({ vim.fn.line("."), vim.fn.line("v") })
|
||||
end)
|
||||
:with_buffer(bufnr)
|
||||
:with_noremap()
|
||||
:with_desc("git: Toggle staging/unstaging of selected hunk"),
|
||||
["n|<leader>gr"] = map_callback(function()
|
||||
gitsigns.reset_hunk()
|
||||
end)
|
||||
:with_buffer(bufnr)
|
||||
:with_noremap()
|
||||
:with_desc("git: Reset hunk"),
|
||||
["v|<leader>gr"] = bind.map_callback(function()
|
||||
actions.reset_hunk({ vim.fn.line("."), vim.fn.line("v") })
|
||||
end)
|
||||
:with_buffer(buf)
|
||||
["v|<leader>gr"] = map_callback(function()
|
||||
gitsigns.reset_hunk({ vim.fn.line("."), vim.fn.line("v") })
|
||||
end)
|
||||
:with_buffer(bufnr)
|
||||
:with_noremap()
|
||||
:with_desc("git: Reset hunk"),
|
||||
["n|<leader>gR"] = bind.map_callback(function()
|
||||
actions.reset_buffer()
|
||||
end)
|
||||
:with_buffer(buf)
|
||||
["n|<leader>gR"] = map_callback(function()
|
||||
gitsigns.reset_buffer()
|
||||
end)
|
||||
:with_buffer(bufnr)
|
||||
:with_noremap()
|
||||
:with_desc("git: Reset buffer"),
|
||||
["n|<leader>gp"] = bind.map_callback(function()
|
||||
actions.preview_hunk()
|
||||
end)
|
||||
:with_buffer(buf)
|
||||
["n|<leader>gp"] = map_callback(function()
|
||||
gitsigns.preview_hunk()
|
||||
end)
|
||||
:with_buffer(bufnr)
|
||||
:with_noremap()
|
||||
:with_desc("git: Preview hunk"),
|
||||
["n|<leader>gb"] = bind.map_callback(function()
|
||||
actions.blame_line({ full = true })
|
||||
end)
|
||||
:with_buffer(buf)
|
||||
["n|<leader>gb"] = map_callback(function()
|
||||
gitsigns.blame_line({ full = true })
|
||||
end)
|
||||
:with_buffer(bufnr)
|
||||
:with_noremap()
|
||||
:with_desc("git: Blame line"),
|
||||
-- Text objects
|
||||
["ox|ih"] = bind.map_callback(function()
|
||||
actions.text_object()
|
||||
end):with_buffer(buf),
|
||||
["ox|ih"] = map_callback(function()
|
||||
gitsigns.select_hunk()
|
||||
end)
|
||||
:with_buffer(bufnr)
|
||||
:with_noremap(),
|
||||
}
|
||||
bind.nvim_load_mapping(map)
|
||||
end
|
||||
|
||||
return mapping
|
||||
return M
|
||||
|
||||
@@ -1,80 +0,0 @@
|
||||
return function()
|
||||
require("modules.utils").load_plugin("aerial", {
|
||||
lazy_load = false,
|
||||
close_on_select = true,
|
||||
highlight_on_jump = false,
|
||||
disable_max_lines = 8500,
|
||||
disable_max_size = 1000000,
|
||||
ignore = { filetypes = { "NvimTree", "terminal", "nofile" } },
|
||||
-- Use symbol tree for folding. Set to true or false to enable/disable
|
||||
-- Set to "auto" to manage folds if your previous foldmethod was 'manual'
|
||||
-- This can be a filetype map (see :help aerial-filetype-map)
|
||||
manage_folds = "auto",
|
||||
layout = {
|
||||
-- Determines the default direction to open the aerial window. The 'prefer'
|
||||
-- options will open the window in the other direction *if* there is a
|
||||
-- different buffer in the way of the preferred direction
|
||||
-- Enum: prefer_right, prefer_left, right, left, float
|
||||
default_direction = "prefer_right",
|
||||
},
|
||||
-- Keymaps in aerial window. Can be any value that `vim.keymap.set` accepts OR a table of keymap
|
||||
-- options with a `callback` (e.g. { callback = function() ... end, desc = "", nowait = true })
|
||||
-- Additionally, if it is a string that matches "actions.<name>",
|
||||
-- it will use the mapping at require("aerial.actions").<name>
|
||||
-- Set to `false` to remove a keymap
|
||||
keymaps = {
|
||||
["?"] = "actions.show_help",
|
||||
["g?"] = "actions.show_help",
|
||||
["<CR>"] = "actions.jump",
|
||||
["<2-LeftMouse>"] = "actions.jump",
|
||||
["<C-v>"] = "actions.jump_vsplit",
|
||||
["<C-s>"] = "actions.jump_split",
|
||||
["<C-d>"] = "actions.down_and_scroll",
|
||||
["<C-u>"] = "actions.up_and_scroll",
|
||||
["{"] = "actions.prev",
|
||||
["}"] = "actions.next",
|
||||
["[["] = "actions.prev_up",
|
||||
["]]"] = "actions.next_up",
|
||||
["q"] = "actions.close",
|
||||
["o"] = "actions.tree_toggle",
|
||||
["O"] = "actions.tree_toggle_recursive",
|
||||
["zr"] = "actions.tree_increase_fold_level",
|
||||
["zR"] = "actions.tree_open_all",
|
||||
["zm"] = "actions.tree_decrease_fold_level",
|
||||
["zM"] = "actions.tree_close_all",
|
||||
["zx"] = "actions.tree_sync_folds",
|
||||
["zX"] = "actions.tree_sync_folds",
|
||||
},
|
||||
-- A list of all symbols to display. Set to false to display all symbols.
|
||||
-- This can be a filetype map (see :help aerial-filetype-map)
|
||||
-- To see all available values, see :help SymbolKind
|
||||
filter_kind = {
|
||||
"Array",
|
||||
"Boolean",
|
||||
"Class",
|
||||
"Constant",
|
||||
"Constructor",
|
||||
"Enum",
|
||||
"EnumMember",
|
||||
"Event",
|
||||
"Field",
|
||||
"File",
|
||||
"Function",
|
||||
"Interface",
|
||||
"Key",
|
||||
"Method",
|
||||
"Module",
|
||||
"Namespace",
|
||||
"Null",
|
||||
-- "Number",
|
||||
"Object",
|
||||
"Operator",
|
||||
"Package",
|
||||
-- "Property",
|
||||
-- "String",
|
||||
"Struct",
|
||||
-- "TypeParameter",
|
||||
-- "Variable",
|
||||
},
|
||||
})
|
||||
end
|
||||
@@ -8,6 +8,13 @@ local format_modifications_only = settings.format_modifications_only
|
||||
local server_formatting_block_list = settings.server_formatting_block_list
|
||||
local format_timeout = settings.format_timeout
|
||||
|
||||
vim.api.nvim_create_user_command("Format", function()
|
||||
M.format({
|
||||
timeout = format_timeout,
|
||||
filter = M.format_filter,
|
||||
})
|
||||
end, {})
|
||||
|
||||
vim.api.nvim_create_user_command("FormatToggle", function()
|
||||
M.toggle_format_on_save()
|
||||
end, {})
|
||||
@@ -118,7 +125,7 @@ function M.format(opts)
|
||||
end
|
||||
|
||||
local bufnr = opts.bufnr or vim.api.nvim_get_current_buf()
|
||||
local clients = vim.lsp.get_clients({ buffer = bufnr })
|
||||
local clients = vim.lsp.get_clients({ bufnr = bufnr })
|
||||
|
||||
if opts.filter then
|
||||
clients = opts.filter(clients)
|
||||
|
||||
@@ -1,14 +1,20 @@
|
||||
return function()
|
||||
local snippet_path = vim.fn.stdpath("config") .. "/snips/"
|
||||
if not vim.tbl_contains(vim.opt.rtp:get(), snippet_path) then
|
||||
vim.opt.rtp:append(snippet_path)
|
||||
end
|
||||
local vim_path = require("core.global").vim_path
|
||||
local snippet_path = vim_path .. "/snips/"
|
||||
local user_snippet_path = vim_path .. "/lua/user/snips/"
|
||||
|
||||
require("modules.utils").load_plugin("luasnip", {
|
||||
history = true,
|
||||
update_events = "TextChanged,TextChangedI",
|
||||
delete_check_events = "TextChanged,InsertLeave",
|
||||
}, false, require("luasnip").config.set_config)
|
||||
|
||||
require("luasnip.loaders.from_vscode").lazy_load({
|
||||
paths = {
|
||||
snippet_path,
|
||||
user_snippet_path,
|
||||
},
|
||||
})
|
||||
require("luasnip.loaders.from_lua").lazy_load()
|
||||
require("luasnip.loaders.from_vscode").lazy_load()
|
||||
require("luasnip.loaders.from_snipmate").lazy_load()
|
||||
|
||||
@@ -52,10 +52,12 @@ please REMOVE your LSP configuration (rust_analyzer.lua) from the `servers` dire
|
||||
end
|
||||
|
||||
local ok, custom_handler = pcall(require, "user.configs.lsp-servers." .. lsp_name)
|
||||
local default_ok, default_handler = pcall(require, "completion.servers." .. lsp_name)
|
||||
-- Use preset if there is no user definition
|
||||
if not ok then
|
||||
ok, custom_handler = pcall(require, "completion.servers." .. lsp_name)
|
||||
ok, custom_handler = default_ok, default_handler
|
||||
end
|
||||
|
||||
if not ok then
|
||||
-- Default to use factory config for server(s) that doesn't include a spec
|
||||
nvim_lsp[lsp_name].setup(opts)
|
||||
@@ -66,7 +68,14 @@ please REMOVE your LSP configuration (rust_analyzer.lua) from the `servers` dire
|
||||
--- See `clangd.lua` for example.
|
||||
custom_handler(opts)
|
||||
elseif type(custom_handler) == "table" then
|
||||
nvim_lsp[lsp_name].setup(vim.tbl_deep_extend("force", opts, custom_handler))
|
||||
nvim_lsp[lsp_name].setup(
|
||||
vim.tbl_deep_extend(
|
||||
"force",
|
||||
opts,
|
||||
type(default_handler) == "table" and default_handler or {},
|
||||
custom_handler
|
||||
)
|
||||
)
|
||||
else
|
||||
vim.notify(
|
||||
string.format(
|
||||
|
||||
@@ -83,7 +83,9 @@ M.setup = function()
|
||||
)
|
||||
end,
|
||||
on_stderr = function(_, msg_stream)
|
||||
vim.notify(msg_stream, vim.log.levels.ERROR, { title = "[lsp] Install Failure" })
|
||||
if msg_stream then
|
||||
vim.notify(msg_stream, vim.log.levels.ERROR, { title = "[lsp] Install Failure" })
|
||||
end
|
||||
end,
|
||||
})
|
||||
:start()
|
||||
|
||||
@@ -17,7 +17,7 @@ return function()
|
||||
-- Don't specify any config here if you are using the default one.
|
||||
local sources = {
|
||||
btns.formatting.clang_format.with({
|
||||
filetypes = { "c", "cpp", "objc", "objcpp", "cs", "java", "cuda", "proto" },
|
||||
filetypes = { "c", "cpp", "objc", "objcpp", "cs", "cuda", "proto" },
|
||||
extra_args = formatter_args("clang_format"),
|
||||
}),
|
||||
btns.formatting.prettier.with({
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
-- https://github.com/neovim/nvim-lspconfig/blob/master/lua/lspconfig/server_configurations/bashls.lua
|
||||
-- https://github.com/neovim/nvim-lspconfig/blob/master/lua/lspconfig/configs/bashls.lua
|
||||
return {
|
||||
cmd = { "bash-language-server", "start" },
|
||||
filetypes = { "bash", "sh" },
|
||||
|
||||
@@ -33,7 +33,7 @@ local function get_binary_path_list(binaries)
|
||||
return table.concat(path_list, ",")
|
||||
end
|
||||
|
||||
-- https://github.com/neovim/nvim-lspconfig/blob/master/lua/lspconfig/server_configurations/clangd.lua
|
||||
-- https://github.com/neovim/nvim-lspconfig/blob/master/lua/lspconfig/configs/clangd.lua
|
||||
return function(options)
|
||||
require("lspconfig").clangd.setup({
|
||||
on_attach = options.on_attach,
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
-- https://github.com/neovim/nvim-lspconfig/blob/master/lua/lspconfig/server_configurations/dartls.lua
|
||||
-- https://github.com/neovim/nvim-lspconfig/blob/master/lua/lspconfig/configs/dartls.lua
|
||||
return {
|
||||
cmd = { "dart", "language-server", "--protocol=lsp" },
|
||||
filetypes = { "dart" },
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
-- https://github.com/neovim/nvim-lspconfig/blob/master/lua/lspconfig/server_configurations/gopls.lua
|
||||
-- https://github.com/neovim/nvim-lspconfig/blob/master/lua/lspconfig/configs/gopls.lua
|
||||
return {
|
||||
cmd = { "gopls", "-remote.debug=:0", "-remote=auto" },
|
||||
filetypes = { "go", "gomod", "gosum", "gotmpl", "gohtmltmpl", "gotexttmpl" },
|
||||
@@ -31,11 +31,11 @@ return {
|
||||
gopls = {
|
||||
staticcheck = true,
|
||||
semanticTokens = true,
|
||||
noSemanticString = true,
|
||||
usePlaceholders = true,
|
||||
completeUnimported = true,
|
||||
symbolMatcher = "Fuzzy",
|
||||
buildFlags = { "-tags", "integration" },
|
||||
semanticTokenTypes = { string = false },
|
||||
codelenses = {
|
||||
generate = true,
|
||||
gc_details = true,
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
-- https://github.com/neovim/nvim-lspconfig/blob/master/lua/lspconfig/server_configurations/jsonls.lua
|
||||
-- https://github.com/neovim/nvim-lspconfig/blob/master/lua/lspconfig/configs/jsonls.lua
|
||||
return {
|
||||
flags = { debounce_text_changes = 500 },
|
||||
settings = {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
-- https://github.com/neovim/nvim-lspconfig/blob/master/lua/lspconfig/server_configurations/lua_ls.lua
|
||||
-- https://github.com/neovim/nvim-lspconfig/blob/master/lua/lspconfig/configs/lua_ls.lua
|
||||
return {
|
||||
settings = {
|
||||
Lua = {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
-- https://github.com/neovim/nvim-lspconfig/blob/master/lua/lspconfig/server_configurations/pylsp.lua
|
||||
-- https://github.com/neovim/nvim-lspconfig/blob/master/lua/lspconfig/configs/pylsp.lua
|
||||
return {
|
||||
cmd = { "pylsp" },
|
||||
filetypes = { "python" },
|
||||
|
||||
@@ -0,0 +1,7 @@
|
||||
return function()
|
||||
require("mini.cursorword").setup({
|
||||
-- Delay (in ms) between when cursor moved and when highlighting appeared
|
||||
delay = 200,
|
||||
})
|
||||
require("modules.utils").gen_cursorword_hl()
|
||||
end
|
||||
@@ -0,0 +1,20 @@
|
||||
return function()
|
||||
vim.g.maplocalleader = ","
|
||||
require("modules.utils").load_plugin("grug-far", {
|
||||
engine = "ripgrep",
|
||||
engines = {
|
||||
ripgrep = {
|
||||
path = "rg",
|
||||
showReplaceDiff = true,
|
||||
placeholders = {
|
||||
enabled = true,
|
||||
},
|
||||
},
|
||||
},
|
||||
windowCreationCommand = "bot split",
|
||||
disableBufferLineNumbers = false,
|
||||
icons = {
|
||||
enabled = true,
|
||||
},
|
||||
})
|
||||
end
|
||||
@@ -1,6 +0,0 @@
|
||||
return function()
|
||||
require("modules.utils").load_plugin("local-highlight", {
|
||||
hlgroup = "IlluminatedWordText",
|
||||
insert_mode = false,
|
||||
})
|
||||
end
|
||||
@@ -0,0 +1,5 @@
|
||||
return function()
|
||||
vim.g.matchup_transmute_enabled = 1
|
||||
vim.g.matchup_surround_enabled = 1
|
||||
vim.g.matchup_matchparen_offscreen = { method = "popup" }
|
||||
end
|
||||
@@ -10,7 +10,6 @@ return function()
|
||||
require("modules.utils").load_plugin("crates", {
|
||||
smart_insert = true,
|
||||
insert_closing_quote = true,
|
||||
avoid_prerelease = true,
|
||||
autoload = true,
|
||||
autoupdate = true,
|
||||
autoupdate_throttle = 250,
|
||||
@@ -19,7 +18,6 @@ return function()
|
||||
thousands_separator = ",",
|
||||
notification_title = "Crates",
|
||||
curl_args = { "-sL", "--retry", "1" },
|
||||
disable_invalid_feature_diagnostic = false,
|
||||
text = {
|
||||
loading = " " .. icons.misc.Watch .. "Loading",
|
||||
version = " " .. icons.ui.Check .. "%s",
|
||||
|
||||
@@ -5,20 +5,43 @@ return function()
|
||||
misc = require("modules.utils.icons").get("misc", true),
|
||||
ui = require("modules.utils.icons").get("ui", true),
|
||||
}
|
||||
local utils = require("dropbar.utils")
|
||||
local sources = require("dropbar.sources")
|
||||
-- Custom source to display only the leaf filename in the dropbar
|
||||
sources.symbols = {
|
||||
get_symbols = function(buf, win, cursor)
|
||||
local symbols = sources.path.get_symbols(buf, win, cursor)
|
||||
return { symbols[#symbols] }
|
||||
end,
|
||||
}
|
||||
|
||||
require("modules.utils").load_plugin("dropbar", {
|
||||
bar = {
|
||||
hover = false,
|
||||
truncate = true,
|
||||
pick = { pivots = "etovxqpdygfblzhckisuran" },
|
||||
sources = function(buf)
|
||||
if vim.bo[buf].ft == "markdown" then
|
||||
return {
|
||||
sources.symbols,
|
||||
sources.markdown,
|
||||
}
|
||||
end
|
||||
if vim.bo[buf].buftype == "terminal" then
|
||||
return {
|
||||
sources.terminal,
|
||||
}
|
||||
end
|
||||
return {
|
||||
sources.symbols,
|
||||
utils.source.fallback({
|
||||
sources.lsp,
|
||||
sources.treesitter,
|
||||
}),
|
||||
}
|
||||
end,
|
||||
},
|
||||
sources = {
|
||||
path = {
|
||||
relative_to = function()
|
||||
-- Only show the leaf filename in dropbar
|
||||
return vim.fn.expand("%:p:h")
|
||||
end,
|
||||
},
|
||||
terminal = {
|
||||
name = function(buf)
|
||||
local name = vim.api.nvim_buf_get_name(buf)
|
||||
@@ -35,7 +58,6 @@ return function()
|
||||
icons = {
|
||||
enable = true,
|
||||
kinds = {
|
||||
use_devicons = true,
|
||||
symbols = {
|
||||
-- Type
|
||||
Array = icons.type.Array,
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
return function()
|
||||
local builtin = require("telescope.builtin")
|
||||
local extensions = require("telescope").extensions
|
||||
local vim_path = require("core.global").vim_path
|
||||
|
||||
require("modules.utils").load_plugin("search", {
|
||||
collections = {
|
||||
@@ -12,7 +13,9 @@ return function()
|
||||
name = "Files",
|
||||
tele_func = function(opts)
|
||||
opts = opts or {}
|
||||
if vim.fn.isdirectory(".git") == 1 then
|
||||
if vim.fn.getcwd() == vim_path then
|
||||
builtin.find_files(vim.tbl_deep_extend("force", opts, { no_ignore = true }))
|
||||
elseif vim.fn.isdirectory(".git") == 1 then
|
||||
builtin.git_files(opts)
|
||||
else
|
||||
builtin.find_files(opts)
|
||||
@@ -46,13 +49,20 @@ return function()
|
||||
{
|
||||
name = "Word in project",
|
||||
tele_func = function()
|
||||
extensions.live_grep_args.live_grep_args()
|
||||
local opts = {}
|
||||
if vim.fn.getcwd() == vim_path then
|
||||
opts["additional_args"] = { "--no-ignore" }
|
||||
end
|
||||
extensions.live_grep_args.live_grep_args(opts)
|
||||
end,
|
||||
},
|
||||
{
|
||||
name = "Word under cursor",
|
||||
tele_func = function(opts)
|
||||
opts = opts or {}
|
||||
if vim.fn.getcwd() == vim_path then
|
||||
opts["additional_args"] = { "--no-ignore" }
|
||||
end
|
||||
builtin.grep_string(opts)
|
||||
end,
|
||||
},
|
||||
|
||||
@@ -44,13 +44,6 @@ return function()
|
||||
buffer_previewer_maker = require("telescope.previewers").buffer_previewer_maker,
|
||||
},
|
||||
extensions = {
|
||||
aerial = {
|
||||
show_lines = false,
|
||||
show_nesting = {
|
||||
["_"] = false, -- This key will be the default
|
||||
lua = true, -- You can set the option for specific filetypes
|
||||
},
|
||||
},
|
||||
fzf = {
|
||||
fuzzy = false,
|
||||
override_generic_sorter = true,
|
||||
@@ -97,6 +90,5 @@ return function()
|
||||
require("telescope").load_extension("undo")
|
||||
require("telescope").load_extension("zoxide")
|
||||
require("telescope").load_extension("persisted")
|
||||
require("telescope").load_extension("aerial")
|
||||
require("telescope").load_extension("advanced_git_search")
|
||||
end
|
||||
|
||||
@@ -8,21 +8,11 @@ return function()
|
||||
return vim.o.columns * 0.40
|
||||
end
|
||||
end,
|
||||
on_open = function(term)
|
||||
on_open = function()
|
||||
-- Prevent infinite calls from freezing neovim.
|
||||
-- Only set these options specific to this terminal buffer.
|
||||
vim.api.nvim_set_option_value("foldmethod", "manual", { scope = "local" })
|
||||
vim.api.nvim_set_option_value("foldexpr", "0", { scope = "local" })
|
||||
|
||||
-- Prevent horizontal terminal from obscuring `nvim-tree`.
|
||||
local api = require("nvim-tree.api")
|
||||
local tree = require("nvim-tree.view")
|
||||
if tree.is_visible() and term.direction == "horizontal" then
|
||||
local width = vim.fn.winwidth(tree.get_winnr())
|
||||
api.tree.toggle()
|
||||
tree.View.width = width
|
||||
api.tree.toggle(false, true)
|
||||
end
|
||||
end,
|
||||
highlights = {
|
||||
Normal = {
|
||||
|
||||
@@ -34,8 +34,8 @@ return function()
|
||||
padding = 0,
|
||||
},
|
||||
{
|
||||
filetype = "aerial",
|
||||
text = "Symbol Outline",
|
||||
filetype = "trouble",
|
||||
text = "LSP Outline",
|
||||
text_align = "center",
|
||||
padding = 0,
|
||||
},
|
||||
|
||||
@@ -30,7 +30,23 @@ return function()
|
||||
properties = {},
|
||||
},
|
||||
integrations = {
|
||||
treesitter = true,
|
||||
cmp = true,
|
||||
dap = true,
|
||||
dap_ui = true,
|
||||
diffview = true,
|
||||
dropbar = { enabled = true, color_mode = true },
|
||||
fidget = true,
|
||||
flash = true,
|
||||
fzf = true,
|
||||
gitsigns = true,
|
||||
grug_far = true,
|
||||
hop = true,
|
||||
indent_blankline = { enabled = true, colored_indent_levels = true },
|
||||
lsp_saga = true,
|
||||
lsp_trouble = true,
|
||||
markdown = true,
|
||||
mason = true,
|
||||
mini = { enabled = true, indentscope_color = "" },
|
||||
native_lsp = {
|
||||
enabled = true,
|
||||
virtual_text = {
|
||||
@@ -46,53 +62,14 @@ return function()
|
||||
information = { "underline" },
|
||||
},
|
||||
},
|
||||
aerial = true,
|
||||
alpha = false,
|
||||
barbar = false,
|
||||
beacon = false,
|
||||
cmp = true,
|
||||
coc_nvim = false,
|
||||
dap = true,
|
||||
dap_ui = true,
|
||||
dashboard = false,
|
||||
dropbar = { enabled = true, color_mode = true },
|
||||
fern = false,
|
||||
fidget = true,
|
||||
flash = true,
|
||||
gitgutter = false,
|
||||
gitsigns = true,
|
||||
harpoon = false,
|
||||
headlines = false,
|
||||
hop = true,
|
||||
illuminate = true,
|
||||
indent_blankline = { enabled = true, colored_indent_levels = false },
|
||||
leap = false,
|
||||
lightspeed = false,
|
||||
lsp_saga = true,
|
||||
lsp_trouble = true,
|
||||
markdown = true,
|
||||
mason = true,
|
||||
mini = false,
|
||||
navic = { enabled = false },
|
||||
neogit = false,
|
||||
neotest = false,
|
||||
neotree = { enabled = false, show_root = true, transparent_panel = false },
|
||||
noice = false,
|
||||
notify = true,
|
||||
nvimtree = true,
|
||||
overseer = false,
|
||||
pounce = false,
|
||||
rainbow_delimiters = true,
|
||||
render_markdown = true,
|
||||
sandwich = false,
|
||||
semantic_tokens = true,
|
||||
symbols_outline = false,
|
||||
telekasten = false,
|
||||
telescope = { enabled = true, style = "nvchad" },
|
||||
treesitter = true,
|
||||
treesitter_context = true,
|
||||
ts_rainbow = false,
|
||||
vim_sneak = false,
|
||||
vimwiki = false,
|
||||
which_key = true,
|
||||
},
|
||||
color_overrides = {},
|
||||
|
||||
@@ -0,0 +1,76 @@
|
||||
return function()
|
||||
local trouble_filter = function(position)
|
||||
return function(_, win)
|
||||
return vim.w[win].trouble
|
||||
and vim.w[win].trouble.position == position
|
||||
and vim.w[win].trouble.type == "split"
|
||||
and vim.w[win].trouble.relative == "editor"
|
||||
and not vim.w[win].trouble_preview
|
||||
end
|
||||
end
|
||||
|
||||
require("modules.utils").load_plugin("edgy", {
|
||||
close_when_all_hidden = true,
|
||||
exit_when_last = true,
|
||||
wo = { winbar = false },
|
||||
keys = {
|
||||
["q"] = false,
|
||||
["Q"] = false,
|
||||
["<C-q>"] = false,
|
||||
["<A-j>"] = function(win)
|
||||
win:resize("height", -2)
|
||||
end,
|
||||
["<A-k>"] = function(win)
|
||||
win:resize("height", 2)
|
||||
end,
|
||||
["<A-h>"] = function(win)
|
||||
win:resize("width", -2)
|
||||
end,
|
||||
["<A-l>"] = function(win)
|
||||
win:resize("width", 2)
|
||||
end,
|
||||
},
|
||||
bottom = {
|
||||
{ ft = "qf", size = { height = 0.3 } },
|
||||
{
|
||||
ft = "toggleterm",
|
||||
size = { height = 0.3 },
|
||||
filter = function(_, win)
|
||||
return vim.w[win].relative == ""
|
||||
end,
|
||||
},
|
||||
{
|
||||
ft = "help",
|
||||
size = { height = 0.3 },
|
||||
filter = function(buf)
|
||||
return vim.bo[buf].buftype == "help"
|
||||
end,
|
||||
},
|
||||
},
|
||||
left = {
|
||||
{
|
||||
ft = "NvimTree",
|
||||
pinned = true,
|
||||
open = "NvimTreeOpen",
|
||||
size = { width = 30 },
|
||||
},
|
||||
},
|
||||
right = {
|
||||
{
|
||||
ft = "trouble",
|
||||
pinned = true,
|
||||
size = { height = 0.6, width = 0.3 },
|
||||
open = "Trouble symbols toggle win.position=right",
|
||||
filter = trouble_filter("right"),
|
||||
},
|
||||
{
|
||||
ft = "trouble",
|
||||
pinned = true,
|
||||
collapsed = true,
|
||||
size = { height = 0.4, width = 0.3 },
|
||||
open = "Trouble lsp toggle win.position=right",
|
||||
filter = trouble_filter("right"),
|
||||
},
|
||||
},
|
||||
}, false, nil, true)
|
||||
end
|
||||
@@ -164,7 +164,7 @@ return function()
|
||||
lsp = {
|
||||
function()
|
||||
local buf_ft = vim.bo.filetype
|
||||
local clients = vim.lsp.get_clients({ buffer = vim.api.nvim_get_current_buf() })
|
||||
local clients = vim.lsp.get_clients({ bufnr = vim.api.nvim_get_current_buf() })
|
||||
local lsp_lists = {}
|
||||
local available_servers = {}
|
||||
if next(clients) == nil then
|
||||
|
||||
@@ -1,37 +0,0 @@
|
||||
return function()
|
||||
local blend_color = require("modules.utils").gen_neodim_blend_attr()
|
||||
|
||||
require("modules.utils").load_plugin("neodim", {
|
||||
alpha = 0.45,
|
||||
blend_color = blend_color,
|
||||
refresh_delay = 75, -- time in ms to wait after typing before refreshing diagnostics
|
||||
hide = {
|
||||
virtual_text = true,
|
||||
signs = false,
|
||||
underline = false,
|
||||
},
|
||||
priority = 80,
|
||||
disable = {
|
||||
"alpha",
|
||||
"bigfile",
|
||||
"checkhealth",
|
||||
"dap-repl",
|
||||
"diff",
|
||||
"fugitive",
|
||||
"fugitiveblame",
|
||||
"git",
|
||||
"gitcommit",
|
||||
"help",
|
||||
"log",
|
||||
"notify",
|
||||
"NvimTree",
|
||||
"Outline",
|
||||
"qf",
|
||||
"TelescopePrompt",
|
||||
"text",
|
||||
"toggleterm",
|
||||
"undotree",
|
||||
"vimwiki",
|
||||
},
|
||||
})
|
||||
end
|
||||
@@ -21,11 +21,6 @@ completion["nvimdev/lspsaga.nvim"] = {
|
||||
config = require("completion.lspsaga"),
|
||||
dependencies = { "nvim-tree/nvim-web-devicons" },
|
||||
}
|
||||
completion["stevearc/aerial.nvim"] = {
|
||||
lazy = true,
|
||||
event = "LspAttach",
|
||||
config = require("completion.aerial"),
|
||||
}
|
||||
completion["DNLHC/glance.nvim"] = {
|
||||
lazy = true,
|
||||
event = "LspAttach",
|
||||
|
||||
@@ -55,17 +55,17 @@ editor["echasnovski/mini.align"] = {
|
||||
event = { "CursorHold", "CursorHoldI" },
|
||||
config = require("editor.align"),
|
||||
}
|
||||
editor["echasnovski/mini.cursorword"] = {
|
||||
lazy = true,
|
||||
event = { "BufReadPost", "BufAdd", "BufNewFile" },
|
||||
config = require("editor.cursorword"),
|
||||
}
|
||||
editor["smoka7/hop.nvim"] = {
|
||||
lazy = true,
|
||||
version = "*",
|
||||
event = { "CursorHold", "CursorHoldI" },
|
||||
config = require("editor.hop"),
|
||||
}
|
||||
editor["tzachar/local-highlight.nvim"] = {
|
||||
lazy = true,
|
||||
event = { "BufReadPost", "BufAdd", "BufNewFile" },
|
||||
config = require("editor.local-highlight"),
|
||||
}
|
||||
editor["brenoprata10/nvim-highlight-colors"] = {
|
||||
lazy = true,
|
||||
event = { "CursorHold", "CursorHoldI" },
|
||||
@@ -84,32 +84,30 @@ editor["tpope/vim-sleuth"] = {
|
||||
lazy = true,
|
||||
event = { "BufNewFile", "BufReadPost", "BufFilePost" },
|
||||
}
|
||||
editor["nvim-pack/nvim-spectre"] = {
|
||||
editor["MagicDuck/grug-far.nvim"] = {
|
||||
lazy = true,
|
||||
cmd = "Spectre",
|
||||
cmd = "GrugFar",
|
||||
config = require("editor.grug-far"),
|
||||
}
|
||||
editor["mrjones2014/smart-splits.nvim"] = {
|
||||
lazy = true,
|
||||
event = { "CursorHoldI", "CursorHold" },
|
||||
config = require("editor.splits"),
|
||||
}
|
||||
|
||||
----------------------------------------------------------------------
|
||||
-- :treesitter related plugins --
|
||||
----------------------------------------------------------------------
|
||||
editor["nvim-treesitter/nvim-treesitter"] = {
|
||||
lazy = true,
|
||||
build = function()
|
||||
if vim.fn.has("gui_running") == 1 then
|
||||
if #vim.api.nvim_list_uis() > 0 then
|
||||
vim.api.nvim_command([[TSUpdate]])
|
||||
end
|
||||
end,
|
||||
event = "BufReadPre",
|
||||
config = require("editor.treesitter"),
|
||||
dependencies = {
|
||||
{ "andymass/vim-matchup" },
|
||||
{ "mfussenegger/nvim-treehopper" },
|
||||
{ "nvim-treesitter/nvim-treesitter-textobjects" },
|
||||
{
|
||||
"andymass/vim-matchup",
|
||||
init = require("editor.matchup"),
|
||||
},
|
||||
{
|
||||
"windwp/nvim-ts-autotag",
|
||||
config = require("editor.autotag"),
|
||||
|
||||
@@ -7,9 +7,14 @@ ui["goolord/alpha-nvim"] = {
|
||||
}
|
||||
ui["akinsho/bufferline.nvim"] = {
|
||||
lazy = true,
|
||||
event = { "BufReadPost", "BufAdd", "BufNewFile" },
|
||||
event = { "BufReadPre", "BufAdd", "BufNewFile" },
|
||||
config = require("ui.bufferline"),
|
||||
}
|
||||
ui["folke/edgy.nvim"] = {
|
||||
lazy = true,
|
||||
event = { "BufReadPre", "BufAdd", "BufNewFile" },
|
||||
config = require("ui.edgy"),
|
||||
}
|
||||
ui["Jint-lzxy/nvim"] = {
|
||||
lazy = false,
|
||||
branch = "refactor/syntax-highlighting",
|
||||
@@ -36,11 +41,6 @@ ui["nvim-lualine/lualine.nvim"] = {
|
||||
event = { "BufReadPost", "BufAdd", "BufNewFile" },
|
||||
config = require("ui.lualine"),
|
||||
}
|
||||
ui["zbirenbaum/neodim"] = {
|
||||
lazy = true,
|
||||
event = "LspAttach",
|
||||
config = require("ui.neodim"),
|
||||
}
|
||||
ui["karb94/neoscroll.nvim"] = {
|
||||
lazy = true,
|
||||
event = { "CursorHold", "CursorHoldI" },
|
||||
@@ -56,6 +56,11 @@ ui["folke/paint.nvim"] = {
|
||||
event = { "CursorHold", "CursorHoldI" },
|
||||
config = require("ui.paint"),
|
||||
}
|
||||
ui["mrjones2014/smart-splits.nvim"] = {
|
||||
lazy = true,
|
||||
event = { "CursorHoldI", "CursorHold" },
|
||||
config = require("ui.splits"),
|
||||
}
|
||||
ui["folke/todo-comments.nvim"] = {
|
||||
lazy = true,
|
||||
event = { "CursorHold", "CursorHoldI" },
|
||||
|
||||
@@ -57,7 +57,7 @@ local function init_palette()
|
||||
end
|
||||
|
||||
if not palette then
|
||||
palette = vim.g.colors_name:find("catppuccin") and require("catppuccin.palettes").get_palette()
|
||||
palette = (vim.g.colors_name or ""):find("catppuccin") and require("catppuccin.palettes").get_palette()
|
||||
or {
|
||||
rosewater = "#DC8A78",
|
||||
flamingo = "#DD7878",
|
||||
@@ -104,7 +104,7 @@ end
|
||||
-- NOTE: If the active colorscheme isn't `catppuccin`, this function won't overwrite existing definitions
|
||||
---Sets a global highlight group.
|
||||
---@param name string @Highlight group name, e.g. "ErrorMsg"
|
||||
---@param foreground string @The foreground color
|
||||
---@param foreground? string @The foreground color
|
||||
---@param background? string @The background color
|
||||
---@param italic? boolean
|
||||
local function set_global_hl(name, foreground, background, italic)
|
||||
@@ -133,6 +133,24 @@ function M.blend(foreground, background, alpha)
|
||||
return string.format("#%02x%02x%02x", blend_channel(1), blend_channel(2), blend_channel(3))
|
||||
end
|
||||
|
||||
---Darken a color by blending it with the background color.
|
||||
---@param hex string @The color in hex to darken
|
||||
---@param amount number @The amount to darken the color
|
||||
---@param bg string @The background color to blend with
|
||||
---@return string @The darkened color as a hex string
|
||||
function M.darken(hex, amount, bg)
|
||||
return M.blend(hex, bg or "#000000", math.abs(amount))
|
||||
end
|
||||
|
||||
---Lighten a color by blending it with the foreground color.
|
||||
---@param hex string @The color in hex to lighten
|
||||
---@param amount number @The amount to lighten the color
|
||||
---@param fg string @The foreground color to blend with
|
||||
---@return string @The lightened color as a hex string
|
||||
function M.lighten(hex, amount, fg)
|
||||
return M.blend(hex, fg or "#FFFFFF", math.abs(amount))
|
||||
end
|
||||
|
||||
---Get RGB highlight by highlight group
|
||||
---@param hl_group string @Highlight group name
|
||||
---@param use_bg boolean @Returns background or not
|
||||
@@ -143,7 +161,10 @@ function M.hl_to_rgb(hl_group, use_bg, fallback_hl)
|
||||
local hlexists = pcall(vim.api.nvim_get_hl, 0, { name = hl_group, link = false })
|
||||
|
||||
if hlexists then
|
||||
local result = vim.api.nvim_get_hl(0, { name = hl_group, link = false })
|
||||
-- FIXME: Investigate why hl-StatusLine is undefined in toggleterm and remove this workaround
|
||||
-- (@Jint-lzxy)
|
||||
local link = vim.bo.filetype == "toggleterm"
|
||||
local result = vim.api.nvim_get_hl(0, { name = hl_group, link = link })
|
||||
if use_bg then
|
||||
hex = result.bg and string.format("#%06x", result.bg) or "NONE"
|
||||
else
|
||||
@@ -166,6 +187,7 @@ function M.extend_hl(name, def)
|
||||
local current_def = vim.api.nvim_get_hl(0, { name = name, link = false })
|
||||
local combined_def = vim.tbl_deep_extend("force", current_def, def)
|
||||
|
||||
---@diagnostic disable-next-line: param-type-mismatch
|
||||
vim.api.nvim_set_hl(0, name, combined_def)
|
||||
end
|
||||
|
||||
@@ -235,18 +257,13 @@ function M.gen_alpha_hl()
|
||||
set_global_hl("AlphaFooter", colors.yellow)
|
||||
end
|
||||
|
||||
-- Generate blend_color for neodim.
|
||||
function M.gen_neodim_blend_attr()
|
||||
local trans_bg = require("core.settings").transparent_background
|
||||
local appearance = require("core.settings").background
|
||||
-- Generate highlight groups for cursorword. Existing attributes will NOT be overwritten
|
||||
function M.gen_cursorword_hl()
|
||||
local colors = M.get_palette()
|
||||
|
||||
if trans_bg and appearance == "dark" then
|
||||
return "#000000"
|
||||
elseif trans_bg and appearance == "light" then
|
||||
return "#FFFFFF"
|
||||
else
|
||||
return M.hl_to_rgb("Normal", true)
|
||||
end
|
||||
-- Do not highlight `MiniCursorwordCurrent`
|
||||
set_global_hl("MiniCursorword", nil, M.darken(colors.surface1, 0.7, colors.base))
|
||||
set_global_hl("MiniCursorwordCurrent", nil)
|
||||
end
|
||||
|
||||
---Convert number (0/1) to boolean
|
||||
@@ -303,7 +320,8 @@ end
|
||||
---@param opts nil|table @The default config to be merged with
|
||||
---@param vim_plugin? boolean @If this plugin is written in vimscript or not
|
||||
---@param setup_callback? function @Add new callback if the plugin needs unusual setup function
|
||||
function M.load_plugin(plugin_name, opts, vim_plugin, setup_callback)
|
||||
---@param overwrite? boolean @If load user table-type config by overwriting
|
||||
function M.load_plugin(plugin_name, opts, vim_plugin, setup_callback, overwrite)
|
||||
vim_plugin = vim_plugin or false
|
||||
|
||||
-- Get the file name of the default config
|
||||
@@ -336,7 +354,11 @@ function M.load_plugin(plugin_name, opts, vim_plugin, setup_callback)
|
||||
if ok then
|
||||
-- Extend base config if the returned user config is a table
|
||||
if type(user_config) == "table" then
|
||||
opts = tbl_recursive_merge(opts, user_config)
|
||||
if overwrite == true then
|
||||
opts = vim.tbl_deep_extend("force", opts, user_config)
|
||||
else
|
||||
opts = tbl_recursive_merge(opts, user_config)
|
||||
end
|
||||
setup_callback(opts)
|
||||
-- Replace base config if the returned user config is a function
|
||||
elseif type(user_config) == "function" then
|
||||
|
||||
Reference in New Issue
Block a user