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.filetypes")
|
||||
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" },
|
||||
}
|
||||
|
||||
-- Standard --
|
||||
maps.n["j"] = { "v:count == 0 ? 'gj' : 'j'", expr = true, desc = "Move cursor down" }
|
||||
maps.n["k"] = { "v:count == 0 ? 'gk' : 'k'", expr = true, desc = "Move cursor up" }
|
||||
maps.n["<Leader>w"] = { "<Cmd>w<CR>", desc = "Write buffer" }
|
||||
maps.n["<Leader>c"] = { "<Cmd>conf q<CR>", desc = "Quit" }
|
||||
maps.n["<Leader>C"] = { "<Cmd>conf qa<CR>", desc = "Quit all" }
|
||||
maps.n["<Leader>n"] = { "<Cmd>ene<CR>", desc = "New buffer" }
|
||||
maps.n["<Leader>h"] = { "<Cmd>noh<CR>", desc = "Clear highlight" }
|
||||
maps.n["<C-s>"] = { "<Cmd>w!<cr>", desc = "Force write buffer" }
|
||||
maps.n["<C-q>"] = { "<Cmd>qa!<cr>", desc = "Force quit all" }
|
||||
maps.n["<Leader>|"] = { "<Cmd>vsplit<cr>", desc = "Vertical split" }
|
||||
maps.n["<Leader>\\"] = { "<Cmd>split<cr>", desc = "Horizontal split" }
|
||||
maps.v["<"] = { "<gv", desc = "Unindent line" }
|
||||
maps.v[">"] = { ">gv", desc = "Indent line" }
|
||||
maps.n["<Leader>q"] = { f.buf_close, desc = "Close buffer" }
|
||||
maps.n["<C-b>"] = { "<C-a>" }
|
||||
maps.n["<C-f>"] = { "<Nop>" }
|
||||
maps.i["<C-h>"] = { "<C-W>" }
|
||||
maps.v["p"] = { "pgvy" }
|
||||
M.maps = function()
|
||||
-- Standard --
|
||||
maps.n["j"] = { "v:count == 0 ? 'gj' : 'j'", expr = true, desc = "Move cursor down" }
|
||||
maps.n["k"] = { "v:count == 0 ? 'gk' : 'k'", expr = true, desc = "Move cursor up" }
|
||||
maps.n["<Leader>w"] = { "<Cmd>w<CR>", desc = "Write buffer" }
|
||||
maps.n["<Leader>c"] = { "<Cmd>conf q<CR>", desc = "Quit" }
|
||||
maps.n["<Leader>C"] = { "<Cmd>conf qa<CR>", desc = "Quit all" }
|
||||
maps.n["<Leader>n"] = { "<Cmd>ene<CR>", desc = "New buffer" }
|
||||
maps.n["<Leader>h"] = { "<Cmd>noh<CR>", desc = "Clear highlight" }
|
||||
maps.n["<C-s>"] = { "<Cmd>w!<cr>", desc = "Force write buffer" }
|
||||
maps.n["<C-q>"] = { "<Cmd>qa!<cr>", desc = "Force quit all" }
|
||||
maps.n["<Leader>|"] = { "<Cmd>vsplit<cr>", desc = "Vertical split" }
|
||||
maps.n["<Leader>\\"] = { "<Cmd>split<cr>", desc = "Horizontal split" }
|
||||
maps.v["<"] = { "<gv", desc = "Unindent line" }
|
||||
maps.v[">"] = { ">gv", desc = "Indent line" }
|
||||
maps.n["<Leader>q"] = { f.buf_close, desc = "Close buffer" }
|
||||
maps.n["<C-b>"] = { "<C-a>" }
|
||||
maps.n["<C-f>"] = { "<Nop>" }
|
||||
maps.i["<C-h>"] = { "<C-W>" }
|
||||
maps.v["p"] = { "pgvy" }
|
||||
|
||||
-- Utility --
|
||||
if f.is_available("nvim-colorizer.lua") then
|
||||
-- Utility --
|
||||
if f.is_available("nvim-colorizer.lua") then
|
||||
maps.n["<Leader>u"] = M.sections.u
|
||||
maps.n["<Leader>uc"] = { "<Cmd>ColorizerToggle<CR>", desc = "Toggle colorizer" }
|
||||
end
|
||||
end
|
||||
|
||||
-- Notes --
|
||||
if f.is_available("zk-nvim") then
|
||||
-- Notes --
|
||||
if f.is_available("zk-nvim") then
|
||||
maps.n["<Leader>n"] = M.sections.n
|
||||
maps.v["<Leader>n"] = maps.n["<Leader>n"]
|
||||
maps.n["<Leader>nn"] = {
|
||||
|
|
@ -74,92 +75,92 @@ if f.is_available("zk-nvim") then
|
|||
end,
|
||||
desc = "Index Notes",
|
||||
}
|
||||
end
|
||||
end
|
||||
|
||||
-- Window Navigation --
|
||||
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-k>"] = { "<C-w>k", desc = "Move to above 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-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-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-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-l>"] = { "<Cmd>wincmd l<cr>", desc = "Terminal right window navigation" }
|
||||
-- Window Navigation --
|
||||
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-k>"] = { "<C-w>k", desc = "Move to above 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-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-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-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-l>"] = { "<Cmd>wincmd l<cr>", desc = "Terminal right window navigation" }
|
||||
|
||||
-- Plugin Manager --
|
||||
maps.n["<Leader>p"] = M.sections.p
|
||||
maps.n["<Leader>ph"] = {
|
||||
-- Plugin Manager --
|
||||
maps.n["<Leader>p"] = M.sections.p
|
||||
maps.n["<Leader>ph"] = {
|
||||
function()
|
||||
require("lazy").home()
|
||||
end,
|
||||
desc = "Home",
|
||||
}
|
||||
maps.n["<Leader>pi"] = {
|
||||
}
|
||||
maps.n["<Leader>pi"] = {
|
||||
function()
|
||||
require("lazy").install()
|
||||
end,
|
||||
desc = "Install",
|
||||
}
|
||||
maps.n["<Leader>pu"] = {
|
||||
}
|
||||
maps.n["<Leader>pu"] = {
|
||||
function()
|
||||
require("lazy").update()
|
||||
end,
|
||||
desc = "Update",
|
||||
}
|
||||
maps.n["<Leader>ps"] = {
|
||||
}
|
||||
maps.n["<Leader>ps"] = {
|
||||
function()
|
||||
require("lazy").sync()
|
||||
end,
|
||||
desc = "Sync",
|
||||
}
|
||||
maps.n["<Leader>px"] = {
|
||||
}
|
||||
maps.n["<Leader>px"] = {
|
||||
function()
|
||||
require("lazy").clean()
|
||||
end,
|
||||
desc = "Clean",
|
||||
}
|
||||
maps.n["<Leader>pc"] = {
|
||||
}
|
||||
maps.n["<Leader>pc"] = {
|
||||
function()
|
||||
require("lazy").check()
|
||||
end,
|
||||
desc = "Check",
|
||||
}
|
||||
maps.n["<Leader>pl"] = {
|
||||
}
|
||||
maps.n["<Leader>pl"] = {
|
||||
function()
|
||||
require("lazy").log()
|
||||
end,
|
||||
desc = "Log",
|
||||
}
|
||||
maps.n["<Leader>pr"] = {
|
||||
}
|
||||
maps.n["<Leader>pr"] = {
|
||||
function()
|
||||
require("lazy").restore()
|
||||
end,
|
||||
desc = "Restore",
|
||||
}
|
||||
maps.n["<Leader>pp"] = {
|
||||
}
|
||||
maps.n["<Leader>pp"] = {
|
||||
function()
|
||||
require("lazy").profile()
|
||||
end,
|
||||
desc = "Profile",
|
||||
}
|
||||
maps.n["<Leader>pd"] = {
|
||||
}
|
||||
maps.n["<Leader>pd"] = {
|
||||
function()
|
||||
require("lazy").debug()
|
||||
end,
|
||||
desc = "Debug",
|
||||
}
|
||||
maps.n["<Leader>p?"] = {
|
||||
}
|
||||
maps.n["<Leader>p?"] = {
|
||||
function()
|
||||
require("lazy").help()
|
||||
end,
|
||||
desc = "Help",
|
||||
}
|
||||
}
|
||||
|
||||
if f.is_available("bufferline.nvim") then
|
||||
if f.is_available("bufferline.nvim") then
|
||||
maps.n["<S-l>"] = {
|
||||
function()
|
||||
require("bufferline").cycle(1)
|
||||
|
|
@ -228,9 +229,9 @@ if f.is_available("bufferline.nvim") then
|
|||
end,
|
||||
desc = "By tabs",
|
||||
}
|
||||
end
|
||||
end
|
||||
|
||||
if f.is_available("Comment.nvim") then
|
||||
if f.is_available("Comment.nvim") then
|
||||
maps.n["<Leader>/"] = {
|
||||
function()
|
||||
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>",
|
||||
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["]g"] = {
|
||||
function()
|
||||
|
|
@ -311,9 +312,9 @@ if f.is_available("gitsigns.nvim") then
|
|||
end,
|
||||
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["E"] = {
|
||||
function()
|
||||
|
|
@ -340,13 +341,13 @@ if f.is_available("taolf") then
|
|||
end,
|
||||
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" }
|
||||
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>lS"] = {
|
||||
function()
|
||||
|
|
@ -354,9 +355,9 @@ if f.is_available("aerial.nvim") then
|
|||
end,
|
||||
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>g"] = M.sections.g
|
||||
maps.n["<Leader>gb"] = {
|
||||
|
|
@ -490,9 +491,9 @@ if f.is_available("telescope.nvim") then
|
|||
end,
|
||||
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
|
||||
if vim.fn.executable("lazygit") == 1 then
|
||||
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["<C-z>"] = { "<Cmd>ToggleTerm<cr>", desc = "Toggle terminal" }
|
||||
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()
|
||||
vim.ui.input({ prompt = "Condition: " }, function(condition)
|
||||
if condition then
|
||||
|
|
@ -709,9 +710,9 @@ if f.is_available("nvim-dap") then
|
|||
desc = "Debugger Hover",
|
||||
}
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
if f.is_available("nvim-ufo") then
|
||||
if f.is_available("nvim-ufo") then
|
||||
maps.n["zR"] = {
|
||||
function()
|
||||
require("ufo").openAllFolds()
|
||||
|
|
@ -742,8 +743,22 @@ if f.is_available("nvim-ufo") then
|
|||
end,
|
||||
desc = "Peek fold",
|
||||
}
|
||||
end
|
||||
return maps
|
||||
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
|
||||
|
|
|
|||
|
|
@ -1,7 +1,21 @@
|
|||
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
|
||||
|
|
|
|||
|
|
@ -3,11 +3,13 @@
|
|||
#
|
||||
# TODO: detect existing repos and automatically modify config file accordingly
|
||||
# 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!");
|
||||
exit;
|
||||
print("This shit ain't done yet!\n");
|
||||
# exit;
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
|
|
@ -150,9 +152,6 @@ sub read_conf() {
|
|||
# █ ████ ██ ████ ██ ██ ███ █
|
||||
# ████████████████████████████████████████
|
||||
|
||||
# TODO: Handle cloning
|
||||
# TODO: Handle pulling
|
||||
# TODO: Trigger hooks on clone/pull
|
||||
|
||||
read_conf();
|
||||
|
||||
|
|
@ -179,12 +178,10 @@ foreach my $i ( keys @{ $conf{plugins} } ) {
|
|||
$_ = `printf "$_"`;
|
||||
}
|
||||
foreach my $j ( keys @{ $plugin{targets} } ) {
|
||||
|
||||
# FIX: $_[$j] is empty
|
||||
$last_handle++;
|
||||
$handles[$last_handle]{plugin} = $i;
|
||||
print("$plugin{api_url}/$_[$j]/$plugin{endpoint}\n");
|
||||
set_curl( $last_handle, "$plugin{api_url}/$_[$j]/$plugin{endpoint}",
|
||||
print("$plugin{api_url}/$plugin{targets}[$j]/$plugin{endpoint}\n");
|
||||
set_curl( $last_handle, "$plugin{api_url}/$plugin{targets}[$j]/$plugin{endpoint}",
|
||||
$plugin{extra_headers} );
|
||||
add_callback( $last_handle, \&dump );
|
||||
add_callback( $last_handle, \&json_decode );
|
||||
Loading…
Add table
Add a link
Reference in a new issue