add some surround plugin configuration
This commit is contained in:
parent
887fa25cb3
commit
6fd3bab760
4 changed files with 762 additions and 736 deletions
|
|
@ -4,4 +4,4 @@ require("lazy-init")
|
||||||
require("config.autocmds")
|
require("config.autocmds")
|
||||||
require("config.filetypes")
|
require("config.filetypes")
|
||||||
require("funcs").set_title()
|
require("funcs").set_title()
|
||||||
require("funcs").set_maps(require("config.keymaps").maps)
|
require("funcs").set_maps(require("config.keymaps").maps())
|
||||||
|
|
|
||||||
|
|
@ -18,34 +18,35 @@ M.sections = {
|
||||||
e = { desc = icons.FileTree .. " File Manager" },
|
e = { desc = icons.FileTree .. " File Manager" },
|
||||||
}
|
}
|
||||||
|
|
||||||
-- Standard --
|
M.maps = function()
|
||||||
maps.n["j"] = { "v:count == 0 ? 'gj' : 'j'", expr = true, desc = "Move cursor down" }
|
-- Standard --
|
||||||
maps.n["k"] = { "v:count == 0 ? 'gk' : 'k'", expr = true, desc = "Move cursor up" }
|
maps.n["j"] = { "v:count == 0 ? 'gj' : 'j'", expr = true, desc = "Move cursor down" }
|
||||||
maps.n["<Leader>w"] = { "<Cmd>w<CR>", desc = "Write buffer" }
|
maps.n["k"] = { "v:count == 0 ? 'gk' : 'k'", expr = true, desc = "Move cursor up" }
|
||||||
maps.n["<Leader>c"] = { "<Cmd>conf q<CR>", desc = "Quit" }
|
maps.n["<Leader>w"] = { "<Cmd>w<CR>", desc = "Write buffer" }
|
||||||
maps.n["<Leader>C"] = { "<Cmd>conf qa<CR>", desc = "Quit all" }
|
maps.n["<Leader>c"] = { "<Cmd>conf q<CR>", desc = "Quit" }
|
||||||
maps.n["<Leader>n"] = { "<Cmd>ene<CR>", desc = "New buffer" }
|
maps.n["<Leader>C"] = { "<Cmd>conf qa<CR>", desc = "Quit all" }
|
||||||
maps.n["<Leader>h"] = { "<Cmd>noh<CR>", desc = "Clear highlight" }
|
maps.n["<Leader>n"] = { "<Cmd>ene<CR>", desc = "New buffer" }
|
||||||
maps.n["<C-s>"] = { "<Cmd>w!<cr>", desc = "Force write buffer" }
|
maps.n["<Leader>h"] = { "<Cmd>noh<CR>", desc = "Clear highlight" }
|
||||||
maps.n["<C-q>"] = { "<Cmd>qa!<cr>", desc = "Force quit all" }
|
maps.n["<C-s>"] = { "<Cmd>w!<cr>", desc = "Force write buffer" }
|
||||||
maps.n["<Leader>|"] = { "<Cmd>vsplit<cr>", desc = "Vertical split" }
|
maps.n["<C-q>"] = { "<Cmd>qa!<cr>", desc = "Force quit all" }
|
||||||
maps.n["<Leader>\\"] = { "<Cmd>split<cr>", desc = "Horizontal split" }
|
maps.n["<Leader>|"] = { "<Cmd>vsplit<cr>", desc = "Vertical split" }
|
||||||
maps.v["<"] = { "<gv", desc = "Unindent line" }
|
maps.n["<Leader>\\"] = { "<Cmd>split<cr>", desc = "Horizontal split" }
|
||||||
maps.v[">"] = { ">gv", desc = "Indent line" }
|
maps.v["<"] = { "<gv", desc = "Unindent line" }
|
||||||
maps.n["<Leader>q"] = { f.buf_close, desc = "Close buffer" }
|
maps.v[">"] = { ">gv", desc = "Indent line" }
|
||||||
maps.n["<C-b>"] = { "<C-a>" }
|
maps.n["<Leader>q"] = { f.buf_close, desc = "Close buffer" }
|
||||||
maps.n["<C-f>"] = { "<Nop>" }
|
maps.n["<C-b>"] = { "<C-a>" }
|
||||||
maps.i["<C-h>"] = { "<C-W>" }
|
maps.n["<C-f>"] = { "<Nop>" }
|
||||||
maps.v["p"] = { "pgvy" }
|
maps.i["<C-h>"] = { "<C-W>" }
|
||||||
|
maps.v["p"] = { "pgvy" }
|
||||||
|
|
||||||
-- Utility --
|
-- Utility --
|
||||||
if f.is_available("nvim-colorizer.lua") then
|
if f.is_available("nvim-colorizer.lua") then
|
||||||
maps.n["<Leader>u"] = M.sections.u
|
maps.n["<Leader>u"] = M.sections.u
|
||||||
maps.n["<Leader>uc"] = { "<Cmd>ColorizerToggle<CR>", desc = "Toggle colorizer" }
|
maps.n["<Leader>uc"] = { "<Cmd>ColorizerToggle<CR>", desc = "Toggle colorizer" }
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Notes --
|
-- Notes --
|
||||||
if f.is_available("zk-nvim") then
|
if f.is_available("zk-nvim") then
|
||||||
maps.n["<Leader>n"] = M.sections.n
|
maps.n["<Leader>n"] = M.sections.n
|
||||||
maps.v["<Leader>n"] = maps.n["<Leader>n"]
|
maps.v["<Leader>n"] = maps.n["<Leader>n"]
|
||||||
maps.n["<Leader>nn"] = {
|
maps.n["<Leader>nn"] = {
|
||||||
|
|
@ -74,92 +75,92 @@ if f.is_available("zk-nvim") then
|
||||||
end,
|
end,
|
||||||
desc = "Index Notes",
|
desc = "Index Notes",
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Window Navigation --
|
-- Window Navigation --
|
||||||
maps.n["<C-h>"] = { "<C-w>h", desc = "Move to left split" }
|
maps.n["<C-h>"] = { "<C-w>h", desc = "Move to left split" }
|
||||||
maps.n["<C-j>"] = { "<C-w>j", desc = "Move to below split" }
|
maps.n["<C-j>"] = { "<C-w>j", desc = "Move to below split" }
|
||||||
maps.n["<C-k>"] = { "<C-w>k", desc = "Move to above split" }
|
maps.n["<C-k>"] = { "<C-w>k", desc = "Move to above split" }
|
||||||
maps.n["<C-l>"] = { "<C-w>l", desc = "Move to right split" }
|
maps.n["<C-l>"] = { "<C-w>l", desc = "Move to right split" }
|
||||||
maps.n["<C-Up>"] = { "<Cmd>resize -2<CR>", desc = "Resize split up" }
|
maps.n["<C-Up>"] = { "<Cmd>resize -2<CR>", desc = "Resize split up" }
|
||||||
maps.n["<C-Down>"] = { "<Cmd>resize +2<CR>", desc = "Resize split down" }
|
maps.n["<C-Down>"] = { "<Cmd>resize +2<CR>", desc = "Resize split down" }
|
||||||
maps.n["<C-Left>"] = { "<Cmd>vertical resize -2<CR>", desc = "Resize split left" }
|
maps.n["<C-Left>"] = { "<Cmd>vertical resize -2<CR>", desc = "Resize split left" }
|
||||||
maps.n["<C-Right>"] = { "<Cmd>vertical resize +2<CR>", desc = "Resize split right" }
|
maps.n["<C-Right>"] = { "<Cmd>vertical resize +2<CR>", desc = "Resize split right" }
|
||||||
maps.t["<C-h>"] = { "<Cmd>wincmd h<cr>", desc = "Terminal left window navigation" }
|
maps.t["<C-h>"] = { "<Cmd>wincmd h<cr>", desc = "Terminal left window navigation" }
|
||||||
maps.t["<C-j>"] = { "<Cmd>wincmd j<cr>", desc = "Terminal down window navigation" }
|
maps.t["<C-j>"] = { "<Cmd>wincmd j<cr>", desc = "Terminal down window navigation" }
|
||||||
maps.t["<C-k>"] = { "<Cmd>wincmd k<cr>", desc = "Terminal up window navigation" }
|
maps.t["<C-k>"] = { "<Cmd>wincmd k<cr>", desc = "Terminal up window navigation" }
|
||||||
maps.t["<C-l>"] = { "<Cmd>wincmd l<cr>", desc = "Terminal right window navigation" }
|
maps.t["<C-l>"] = { "<Cmd>wincmd l<cr>", desc = "Terminal right window navigation" }
|
||||||
|
|
||||||
-- Plugin Manager --
|
-- Plugin Manager --
|
||||||
maps.n["<Leader>p"] = M.sections.p
|
maps.n["<Leader>p"] = M.sections.p
|
||||||
maps.n["<Leader>ph"] = {
|
maps.n["<Leader>ph"] = {
|
||||||
function()
|
function()
|
||||||
require("lazy").home()
|
require("lazy").home()
|
||||||
end,
|
end,
|
||||||
desc = "Home",
|
desc = "Home",
|
||||||
}
|
}
|
||||||
maps.n["<Leader>pi"] = {
|
maps.n["<Leader>pi"] = {
|
||||||
function()
|
function()
|
||||||
require("lazy").install()
|
require("lazy").install()
|
||||||
end,
|
end,
|
||||||
desc = "Install",
|
desc = "Install",
|
||||||
}
|
}
|
||||||
maps.n["<Leader>pu"] = {
|
maps.n["<Leader>pu"] = {
|
||||||
function()
|
function()
|
||||||
require("lazy").update()
|
require("lazy").update()
|
||||||
end,
|
end,
|
||||||
desc = "Update",
|
desc = "Update",
|
||||||
}
|
}
|
||||||
maps.n["<Leader>ps"] = {
|
maps.n["<Leader>ps"] = {
|
||||||
function()
|
function()
|
||||||
require("lazy").sync()
|
require("lazy").sync()
|
||||||
end,
|
end,
|
||||||
desc = "Sync",
|
desc = "Sync",
|
||||||
}
|
}
|
||||||
maps.n["<Leader>px"] = {
|
maps.n["<Leader>px"] = {
|
||||||
function()
|
function()
|
||||||
require("lazy").clean()
|
require("lazy").clean()
|
||||||
end,
|
end,
|
||||||
desc = "Clean",
|
desc = "Clean",
|
||||||
}
|
}
|
||||||
maps.n["<Leader>pc"] = {
|
maps.n["<Leader>pc"] = {
|
||||||
function()
|
function()
|
||||||
require("lazy").check()
|
require("lazy").check()
|
||||||
end,
|
end,
|
||||||
desc = "Check",
|
desc = "Check",
|
||||||
}
|
}
|
||||||
maps.n["<Leader>pl"] = {
|
maps.n["<Leader>pl"] = {
|
||||||
function()
|
function()
|
||||||
require("lazy").log()
|
require("lazy").log()
|
||||||
end,
|
end,
|
||||||
desc = "Log",
|
desc = "Log",
|
||||||
}
|
}
|
||||||
maps.n["<Leader>pr"] = {
|
maps.n["<Leader>pr"] = {
|
||||||
function()
|
function()
|
||||||
require("lazy").restore()
|
require("lazy").restore()
|
||||||
end,
|
end,
|
||||||
desc = "Restore",
|
desc = "Restore",
|
||||||
}
|
}
|
||||||
maps.n["<Leader>pp"] = {
|
maps.n["<Leader>pp"] = {
|
||||||
function()
|
function()
|
||||||
require("lazy").profile()
|
require("lazy").profile()
|
||||||
end,
|
end,
|
||||||
desc = "Profile",
|
desc = "Profile",
|
||||||
}
|
}
|
||||||
maps.n["<Leader>pd"] = {
|
maps.n["<Leader>pd"] = {
|
||||||
function()
|
function()
|
||||||
require("lazy").debug()
|
require("lazy").debug()
|
||||||
end,
|
end,
|
||||||
desc = "Debug",
|
desc = "Debug",
|
||||||
}
|
}
|
||||||
maps.n["<Leader>p?"] = {
|
maps.n["<Leader>p?"] = {
|
||||||
function()
|
function()
|
||||||
require("lazy").help()
|
require("lazy").help()
|
||||||
end,
|
end,
|
||||||
desc = "Help",
|
desc = "Help",
|
||||||
}
|
}
|
||||||
|
|
||||||
if f.is_available("bufferline.nvim") then
|
if f.is_available("bufferline.nvim") then
|
||||||
maps.n["<S-l>"] = {
|
maps.n["<S-l>"] = {
|
||||||
function()
|
function()
|
||||||
require("bufferline").cycle(1)
|
require("bufferline").cycle(1)
|
||||||
|
|
@ -228,9 +229,9 @@ if f.is_available("bufferline.nvim") then
|
||||||
end,
|
end,
|
||||||
desc = "By tabs",
|
desc = "By tabs",
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
if f.is_available("Comment.nvim") then
|
if f.is_available("Comment.nvim") then
|
||||||
maps.n["<Leader>/"] = {
|
maps.n["<Leader>/"] = {
|
||||||
function()
|
function()
|
||||||
require("Comment.api").toggle.linewise.count(vim.v.count > 0 and vim.v.count or 1)
|
require("Comment.api").toggle.linewise.count(vim.v.count > 0 and vim.v.count or 1)
|
||||||
|
|
@ -241,9 +242,9 @@ if f.is_available("Comment.nvim") then
|
||||||
"<esc><Cmd>lua require('Comment.api').toggle.linewise(vim.fn.visualmode())<cr>",
|
"<esc><Cmd>lua require('Comment.api').toggle.linewise(vim.fn.visualmode())<cr>",
|
||||||
desc = "Toggle comment for selection",
|
desc = "Toggle comment for selection",
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
if f.is_available("gitsigns.nvim") then
|
if f.is_available("gitsigns.nvim") then
|
||||||
maps.n["<Leader>g"] = M.sections.g
|
maps.n["<Leader>g"] = M.sections.g
|
||||||
maps.n["]g"] = {
|
maps.n["]g"] = {
|
||||||
function()
|
function()
|
||||||
|
|
@ -311,9 +312,9 @@ if f.is_available("gitsigns.nvim") then
|
||||||
end,
|
end,
|
||||||
desc = "View Git diff",
|
desc = "View Git diff",
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
if f.is_available("taolf") then
|
if f.is_available("taolf") then
|
||||||
maps.n["<Leader>e"] = M.sections.e
|
maps.n["<Leader>e"] = M.sections.e
|
||||||
maps.n["E"] = {
|
maps.n["E"] = {
|
||||||
function()
|
function()
|
||||||
|
|
@ -340,13 +341,13 @@ if f.is_available("taolf") then
|
||||||
end,
|
end,
|
||||||
desc = "File manager in open file's working directory",
|
desc = "File manager in open file's working directory",
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
if f.is_available("mason.nvim") then
|
if f.is_available("mason.nvim") then
|
||||||
maps.n["<Leader>pm"] = { "<Cmd>Mason<cr>", desc = "Mason" }
|
maps.n["<Leader>pm"] = { "<Cmd>Mason<cr>", desc = "Mason" }
|
||||||
end
|
end
|
||||||
|
|
||||||
if f.is_available("aerial.nvim") then
|
if f.is_available("aerial.nvim") then
|
||||||
maps.n["<leader>l"] = M.sections.l
|
maps.n["<leader>l"] = M.sections.l
|
||||||
maps.n["<leader>lS"] = {
|
maps.n["<leader>lS"] = {
|
||||||
function()
|
function()
|
||||||
|
|
@ -354,9 +355,9 @@ if f.is_available("aerial.nvim") then
|
||||||
end,
|
end,
|
||||||
desc = "Symbols outline",
|
desc = "Symbols outline",
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
if f.is_available("telescope.nvim") then
|
if f.is_available("telescope.nvim") then
|
||||||
maps.n["<Leader>f"] = M.sections.f
|
maps.n["<Leader>f"] = M.sections.f
|
||||||
maps.n["<Leader>g"] = M.sections.g
|
maps.n["<Leader>g"] = M.sections.g
|
||||||
maps.n["<Leader>gb"] = {
|
maps.n["<Leader>gb"] = {
|
||||||
|
|
@ -490,9 +491,9 @@ if f.is_available("telescope.nvim") then
|
||||||
end,
|
end,
|
||||||
desc = "Search symbols",
|
desc = "Search symbols",
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
if f.is_available("toggleterm.nvim") then
|
if f.is_available("toggleterm.nvim") then
|
||||||
maps.n["<leader>t"] = M.sections.t
|
maps.n["<leader>t"] = M.sections.t
|
||||||
if vim.fn.executable("lazygit") == 1 then
|
if vim.fn.executable("lazygit") == 1 then
|
||||||
maps.n["<leader>g"] = M.sections.g
|
maps.n["<leader>g"] = M.sections.g
|
||||||
|
|
@ -544,9 +545,9 @@ if f.is_available("toggleterm.nvim") then
|
||||||
maps.n["<leader>th"] = { "<Cmd>ToggleTerm direction=horizontal<cr>", desc = "ToggleTerm horizontal split" }
|
maps.n["<leader>th"] = { "<Cmd>ToggleTerm direction=horizontal<cr>", desc = "ToggleTerm horizontal split" }
|
||||||
maps.n["<C-z>"] = { "<Cmd>ToggleTerm<cr>", desc = "Toggle terminal" }
|
maps.n["<C-z>"] = { "<Cmd>ToggleTerm<cr>", desc = "Toggle terminal" }
|
||||||
maps.t["<C-z>"] = maps.n["<F7>"]
|
maps.t["<C-z>"] = maps.n["<F7>"]
|
||||||
end
|
end
|
||||||
|
|
||||||
if f.is_available("nvim-dap") then
|
if f.is_available("nvim-dap") then
|
||||||
local conditional_breakpoint = function()
|
local conditional_breakpoint = function()
|
||||||
vim.ui.input({ prompt = "Condition: " }, function(condition)
|
vim.ui.input({ prompt = "Condition: " }, function(condition)
|
||||||
if condition then
|
if condition then
|
||||||
|
|
@ -709,9 +710,9 @@ if f.is_available("nvim-dap") then
|
||||||
desc = "Debugger Hover",
|
desc = "Debugger Hover",
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
if f.is_available("nvim-ufo") then
|
if f.is_available("nvim-ufo") then
|
||||||
maps.n["zR"] = {
|
maps.n["zR"] = {
|
||||||
function()
|
function()
|
||||||
require("ufo").openAllFolds()
|
require("ufo").openAllFolds()
|
||||||
|
|
@ -742,8 +743,22 @@ if f.is_available("nvim-ufo") then
|
||||||
end,
|
end,
|
||||||
desc = "Peek fold",
|
desc = "Peek fold",
|
||||||
}
|
}
|
||||||
|
end
|
||||||
|
return maps
|
||||||
end
|
end
|
||||||
|
|
||||||
M.maps = maps
|
M.surround = {
|
||||||
|
insert = false,
|
||||||
|
insert_line = false,
|
||||||
|
normal = "ys",
|
||||||
|
normal_cur = "yss",
|
||||||
|
normal_line = "yS",
|
||||||
|
normal_cur_line = "ySS",
|
||||||
|
visual = "S",
|
||||||
|
visual_line = "gS",
|
||||||
|
delete = "ds",
|
||||||
|
change = "cs",
|
||||||
|
change_line = "cS",
|
||||||
|
}
|
||||||
|
|
||||||
return M
|
return M
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,21 @@
|
||||||
local M = { "kylechui/nvim-surround" }
|
local M = { "kylechui/nvim-surround" }
|
||||||
|
|
||||||
M.event = { "BufReadPost", "BufNewFile" }
|
M.event = "VeryLazy"
|
||||||
|
|
||||||
M.config = true
|
M.opts = {
|
||||||
|
keymaps = require("config.keymaps").surround,
|
||||||
|
surrounds = {
|
||||||
|
["B"] = {
|
||||||
|
add = { "{{ ", " }}" },
|
||||||
|
find = function()
|
||||||
|
return require("nvim-surround.config").get_selection({ motion = "2a}" })
|
||||||
|
end,
|
||||||
|
delete = "^(.. ?)().-( ?..)()$",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
aliases = {
|
||||||
|
["B"] = false,
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
return M
|
return M
|
||||||
|
|
|
||||||
|
|
@ -3,11 +3,13 @@
|
||||||
#
|
#
|
||||||
# TODO: detect existing repos and automatically modify config file accordingly
|
# TODO: detect existing repos and automatically modify config file accordingly
|
||||||
# TODO: function to detect unclean working trees
|
# TODO: function to detect unclean working trees
|
||||||
# TODO: Move update hooks to the actual .git/hooks directory
|
# TODO: Handle cloning
|
||||||
|
# TODO: Handle pulling
|
||||||
|
# TODO: Trigger hooks on clone/pull
|
||||||
#
|
#
|
||||||
|
|
||||||
print("This shit ain't done yet!");
|
print("This shit ain't done yet!\n");
|
||||||
exit;
|
# exit;
|
||||||
|
|
||||||
use strict;
|
use strict;
|
||||||
use warnings;
|
use warnings;
|
||||||
|
|
@ -150,9 +152,6 @@ sub read_conf() {
|
||||||
# █ ████ ██ ████ ██ ██ ███ █
|
# █ ████ ██ ████ ██ ██ ███ █
|
||||||
# ████████████████████████████████████████
|
# ████████████████████████████████████████
|
||||||
|
|
||||||
# TODO: Handle cloning
|
|
||||||
# TODO: Handle pulling
|
|
||||||
# TODO: Trigger hooks on clone/pull
|
|
||||||
|
|
||||||
read_conf();
|
read_conf();
|
||||||
|
|
||||||
|
|
@ -179,12 +178,10 @@ foreach my $i ( keys @{ $conf{plugins} } ) {
|
||||||
$_ = `printf "$_"`;
|
$_ = `printf "$_"`;
|
||||||
}
|
}
|
||||||
foreach my $j ( keys @{ $plugin{targets} } ) {
|
foreach my $j ( keys @{ $plugin{targets} } ) {
|
||||||
|
|
||||||
# FIX: $_[$j] is empty
|
|
||||||
$last_handle++;
|
$last_handle++;
|
||||||
$handles[$last_handle]{plugin} = $i;
|
$handles[$last_handle]{plugin} = $i;
|
||||||
print("$plugin{api_url}/$_[$j]/$plugin{endpoint}\n");
|
print("$plugin{api_url}/$plugin{targets}[$j]/$plugin{endpoint}\n");
|
||||||
set_curl( $last_handle, "$plugin{api_url}/$_[$j]/$plugin{endpoint}",
|
set_curl( $last_handle, "$plugin{api_url}/$plugin{targets}[$j]/$plugin{endpoint}",
|
||||||
$plugin{extra_headers} );
|
$plugin{extra_headers} );
|
||||||
add_callback( $last_handle, \&dump );
|
add_callback( $last_handle, \&dump );
|
||||||
add_callback( $last_handle, \&json_decode );
|
add_callback( $last_handle, \&json_decode );
|
||||||
Loading…
Add table
Add a link
Reference in a new issue