update
This commit is contained in:
parent
d1caa253db
commit
b8568952b4
5 changed files with 144 additions and 28 deletions
|
|
@ -19,12 +19,19 @@ autocmd("FileType", {
|
||||||
|
|
||||||
function FormatGoCurrentLine()
|
function FormatGoCurrentLine()
|
||||||
local line = vim.api.nvim_get_current_line()
|
local line = vim.api.nvim_get_current_line()
|
||||||
local formatted_line = line:gsub("%(", "(\n"):gsub(",%s*", ",\n"):gsub("%)", ",\n)")
|
local formatted_line =
|
||||||
|
line:gsub("%(", "(\n"):gsub(",%s*", ",\n"):gsub("%)", ",\n)")
|
||||||
formatted_line = formatted_line:gsub(",\n%)", "\n)")
|
formatted_line = formatted_line:gsub(",\n%)", "\n)")
|
||||||
local lines = vim.split(formatted_line, "\n")
|
local lines = vim.split(formatted_line, "\n")
|
||||||
-- Ensure the last parameter has a comma
|
-- Ensure the last parameter has a comma
|
||||||
if #lines > 2 and not lines[#lines - 1]:match(",$") then
|
if #lines > 2 and not lines[#lines - 1]:match(",$") then
|
||||||
lines[#lines - 1] = lines[#lines - 1] .. ","
|
lines[#lines - 1] = lines[#lines - 1] .. ","
|
||||||
end
|
end
|
||||||
vim.api.nvim_buf_set_lines(0, vim.fn.line(".") - 1, vim.fn.line("."), false, lines)
|
vim.api.nvim_buf_set_lines(
|
||||||
|
0,
|
||||||
|
vim.fn.line(".") - 1,
|
||||||
|
vim.fn.line("."),
|
||||||
|
false,
|
||||||
|
lines
|
||||||
|
)
|
||||||
end
|
end
|
||||||
|
|
|
||||||
|
|
@ -4,28 +4,103 @@ local map = vim.keymap.set
|
||||||
-- map("i", "jk", "<ESC>")
|
-- map("i", "jk", "<ESC>")
|
||||||
|
|
||||||
-- Tmux
|
-- Tmux
|
||||||
map("", "<C-h>", "<cmd> TmuxNavigateLeft<CR>", { desc = "window left" })
|
map(
|
||||||
map("", "<C-l>", "<cmd> TmuxNavigateRight<CR>", { desc = "window right" })
|
"",
|
||||||
map("", "<C-j>", "<cmd> TmuxNavigateDown<CR>", { desc = "window down" })
|
"<C-h>",
|
||||||
|
"<cmd> TmuxNavigateLeft<CR>",
|
||||||
|
{ desc = "window left" }
|
||||||
|
)
|
||||||
|
map(
|
||||||
|
"",
|
||||||
|
"<C-l>",
|
||||||
|
"<cmd> TmuxNavigateRight<CR>",
|
||||||
|
{ desc = "window right" }
|
||||||
|
)
|
||||||
|
map(
|
||||||
|
"",
|
||||||
|
"<C-j>",
|
||||||
|
"<cmd> TmuxNavigateDown<CR>",
|
||||||
|
{ desc = "window down" }
|
||||||
|
)
|
||||||
map("", "<C-k>", "<cmd> TmuxNavigateUp<CR>", { desc = "window up" })
|
map("", "<C-k>", "<cmd> TmuxNavigateUp<CR>", { desc = "window up" })
|
||||||
|
|
||||||
-- Resize
|
-- Resize
|
||||||
map("", "<A-h>", "<cmd> vertical resize -5<CR>", { desc = "Resize Left" })
|
map(
|
||||||
map("", "<A-l>", "<cmd> vertical resize +5<CR>", { desc = "Resize Right" })
|
"",
|
||||||
map("", "<A-j>", "<cmd> horizontal resize -5<CR>", { desc = "Resize Down" })
|
"<A-h>",
|
||||||
map("", "<A-k>", "<cmd> horizontal resize +5<CR>", { desc = "Resize Up" })
|
"<cmd> vertical resize -5<CR>",
|
||||||
|
{ desc = "Resize Left" }
|
||||||
|
)
|
||||||
|
map(
|
||||||
|
"",
|
||||||
|
"<A-l>",
|
||||||
|
"<cmd> vertical resize +5<CR>",
|
||||||
|
{ desc = "Resize Right" }
|
||||||
|
)
|
||||||
|
map(
|
||||||
|
"",
|
||||||
|
"<A-j>",
|
||||||
|
"<cmd> horizontal resize -5<CR>",
|
||||||
|
{ desc = "Resize Down" }
|
||||||
|
)
|
||||||
|
map(
|
||||||
|
"",
|
||||||
|
"<A-k>",
|
||||||
|
"<cmd> horizontal resize +5<CR>",
|
||||||
|
{ desc = "Resize Up" }
|
||||||
|
)
|
||||||
|
|
||||||
-- Go
|
-- Go
|
||||||
map("", "<leader>gsj", "<cmd> GoTagAdd json <CR>", { desc = "Add json struct tags" })
|
map(
|
||||||
map("", "<leader>gsy", "<cmd> GoTagAdd yaml <CR>", { desc = "Add yaml struct tags" })
|
"",
|
||||||
map("", "<leader>gse", "<cmd> GoTagAdd env <CR>", { desc = "Add env struct tags" })
|
"<leader>gsj",
|
||||||
|
"<cmd> GoTagAdd json <CR>",
|
||||||
|
{ desc = "Add json struct tags" }
|
||||||
|
)
|
||||||
|
map(
|
||||||
|
"",
|
||||||
|
"<leader>gsy",
|
||||||
|
"<cmd> GoTagAdd yaml <CR>",
|
||||||
|
{ desc = "Add yaml struct tags" }
|
||||||
|
)
|
||||||
|
map(
|
||||||
|
"",
|
||||||
|
"<leader>gse",
|
||||||
|
"<cmd> GoTagAdd env <CR>",
|
||||||
|
{ desc = "Add env struct tags" }
|
||||||
|
)
|
||||||
|
|
||||||
-- Dap
|
-- Dap
|
||||||
map("", "<leader>db", "<cmd> DapToggleBreakpoint <CR>", { desc = "Add breakpoint at line" })
|
map(
|
||||||
map("", "<leader>dc", "<cmd> DapContinue <CR>", { desc = "Start Debugging" })
|
"",
|
||||||
map("", "<leader>dt", "<cmd> DapTerminate <CR>", { desc = "Stop Debugging" })
|
"<leader>db",
|
||||||
map("", "<leader>dso", "<cmd> DapStepOver <CR>", { desc = "Step Over" })
|
"<cmd> DapToggleBreakpoint <CR>",
|
||||||
map("", "<leader>dsi", "<cmd> DapStepInto <CR>", { desc = "Step Into" })
|
{ desc = "Add breakpoint at line" }
|
||||||
|
)
|
||||||
|
map(
|
||||||
|
"",
|
||||||
|
"<leader>dc",
|
||||||
|
"<cmd> DapContinue <CR>",
|
||||||
|
{ desc = "Start Debugging" }
|
||||||
|
)
|
||||||
|
map(
|
||||||
|
"",
|
||||||
|
"<leader>dt",
|
||||||
|
"<cmd> DapTerminate <CR>",
|
||||||
|
{ desc = "Stop Debugging" }
|
||||||
|
)
|
||||||
|
map(
|
||||||
|
"",
|
||||||
|
"<leader>dso",
|
||||||
|
"<cmd> DapStepOver <CR>",
|
||||||
|
{ desc = "Step Over" }
|
||||||
|
)
|
||||||
|
map(
|
||||||
|
"",
|
||||||
|
"<leader>dsi",
|
||||||
|
"<cmd> DapStepInto <CR>",
|
||||||
|
{ desc = "Step Into" }
|
||||||
|
)
|
||||||
map("", "<leader>dst", "<cmd> DapStepOut <CR>", { desc = "Step Out" })
|
map("", "<leader>dst", "<cmd> DapStepOut <CR>", { desc = "Step Out" })
|
||||||
map("", "<leader>dus", function()
|
map("", "<leader>dus", function()
|
||||||
local widgets = require("dap.ui.widgets")
|
local widgets = require("dap.ui.widgets")
|
||||||
|
|
@ -48,11 +123,26 @@ map("n", "<leader>P", function()
|
||||||
end, { noremap = true })
|
end, { noremap = true })
|
||||||
|
|
||||||
-- CodeCopmanion
|
-- CodeCopmanion
|
||||||
map("", "<leader>Ca", "<cmd>CodeCompanionActions <CR>", { desc = "CodeCompanion Actions" })
|
map(
|
||||||
map("", "<leader>Cc", "<cmd>CodeCompanionChat <CR>", { desc = "CodeCompanion Chat" })
|
"",
|
||||||
|
"<leader>Ca",
|
||||||
|
"<cmd>CodeCompanionActions <CR>",
|
||||||
|
{ desc = "CodeCompanion Actions" }
|
||||||
|
)
|
||||||
|
map(
|
||||||
|
"",
|
||||||
|
"<leader>Cc",
|
||||||
|
"<cmd>CodeCompanionChat <CR>",
|
||||||
|
{ desc = "CodeCompanion Chat" }
|
||||||
|
)
|
||||||
|
|
||||||
-- Custom
|
-- Custom
|
||||||
map("", "<leader>rw", '"hy:%s/<C-r>h//g<left><left>', { noremap = true, silent = true, desc = "Replace Word" })
|
map(
|
||||||
|
"",
|
||||||
|
"<leader>rw",
|
||||||
|
'"hy:%s/<C-r>h//g<left><left>',
|
||||||
|
{ noremap = true, silent = true, desc = "Replace Word" }
|
||||||
|
)
|
||||||
|
|
||||||
map("", "<leader>rt", ":VtrSendLinesToRunner<CR>", {
|
map("", "<leader>rt", ":VtrSendLinesToRunner<CR>", {
|
||||||
noremap = true,
|
noremap = true,
|
||||||
|
|
@ -60,4 +150,9 @@ map("", "<leader>rt", ":VtrSendLinesToRunner<CR>", {
|
||||||
desc = "Send selected text to tmux pane",
|
desc = "Send selected text to tmux pane",
|
||||||
})
|
})
|
||||||
|
|
||||||
map("", "<leader>rp", ":VtrAttachToPane<CR>", { noremap = true, silent = true, desc = "Attach to tmux pane" })
|
map(
|
||||||
|
"",
|
||||||
|
"<leader>rp",
|
||||||
|
":VtrAttachToPane<CR>",
|
||||||
|
{ noremap = true, silent = true, desc = "Attach to tmux pane" }
|
||||||
|
)
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,3 @@
|
||||||
indent_type = "Spaces"
|
indent_type = "Spaces"
|
||||||
indent_width = 2
|
indent_width = 2
|
||||||
column_width = 120
|
column_width = 70
|
||||||
|
|
|
||||||
|
|
@ -12,10 +12,16 @@ lockbw ()
|
||||||
}
|
}
|
||||||
|
|
||||||
tmux-new () {
|
tmux-new () {
|
||||||
local dir=$(find $HOME/Documents/gitlab -mindepth 1 -maxdepth 1 -type d| awk -F/ '{print $(NF-1)"/"$NF " " $0}' | fzf --with-nth=1 | awk '{print $2}')
|
local dir=${1:-}
|
||||||
|
[ -z "${dir}" ] && local dir=$(find $HOME/Documents/gitlab -mindepth 1 -maxdepth 1 -type d| awk -F/ '{print $(NF-1)"/"$NF " " $0}' | fzf --with-nth=1 | awk '{print $2}')
|
||||||
[ -z "$dir" ] && return 1
|
[ -z "$dir" ] && return 1
|
||||||
|
|
||||||
local name=$(basename "$dir")
|
local name=$(basename "$dir")
|
||||||
|
|
||||||
|
if [[ $name == .* ]]; then
|
||||||
|
name=${name#.}
|
||||||
|
fi
|
||||||
|
|
||||||
tmux new-session -d -s "$name" -c "$dir"
|
tmux new-session -d -s "$name" -c "$dir"
|
||||||
|
|
||||||
RIGHT_PANE_WIDTH=60
|
RIGHT_PANE_WIDTH=60
|
||||||
|
|
|
||||||
|
|
@ -28,11 +28,11 @@ set-option -g @ssh-split-v-key '"'
|
||||||
set-option -g @ssh-split-keep-cwd "true"
|
set-option -g @ssh-split-keep-cwd "true"
|
||||||
set-option -g @ssh-split-keep-remote-cwd "true"
|
set-option -g @ssh-split-keep-remote-cwd "true"
|
||||||
|
|
||||||
# Use Alt-arrow keys without prefix key to switch panes
|
# resize windows
|
||||||
bind -n M-H resize-pane -L 5
|
bind -n C-M-h resize-pane -L 5
|
||||||
bind -n M-L resize-pane -R 5
|
bind -n C-M-l resize-pane -R 5
|
||||||
bind -n M-K resize-pane -U 5
|
bind -n C-M-k resize-pane -U 5
|
||||||
bind -n M-J resize-pane -D 5
|
bind -n C-M-j resize-pane -D 5
|
||||||
|
|
||||||
# Shift arrow to switch windows
|
# Shift arrow to switch windows
|
||||||
bind -n S-Left previous-window
|
bind -n S-Left previous-window
|
||||||
|
|
@ -62,4 +62,12 @@ bind '"' split-window -v -c "#{pane_current_path}"
|
||||||
bind % split-window -h -c "#{pane_current_path}"
|
bind % split-window -h -c "#{pane_current_path}"
|
||||||
bind c new-window -c "#{pane_current_path}"
|
bind c new-window -c "#{pane_current_path}"
|
||||||
|
|
||||||
|
bind C-j display-popup -E "\
|
||||||
|
tmux list-sessions -F '#{?session_attached,,#{session_name}}' |\
|
||||||
|
sed '/^$/d' |\
|
||||||
|
fzf --reverse --header jump-to-session --preview 'tmux capture-pane -pt {}' \
|
||||||
|
--bind 'enter:execute(tmux switch-client -t {})+accept'"
|
||||||
|
|
||||||
|
bind C-g display-popup -E "lazygit"
|
||||||
|
|
||||||
run '~/.tmux/plugins/tpm/tpm'
|
run '~/.tmux/plugins/tpm/tpm'
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue