From b8568952b4559dcf681fce9b8838e932d1d8636c Mon Sep 17 00:00:00 2001 From: DeveloperDurp Date: Wed, 12 Mar 2025 05:09:03 -0500 Subject: [PATCH] update --- .config/nvim/lua/config/autocmds.lua | 11 ++- .config/nvim/lua/config/keymaps.lua | 133 +++++++++++++++++++++++---- .config/nvim/stylua.toml | 2 +- .config/shell/functions.zsh | 8 +- .config/tmux/tmux.conf | 18 +++- 5 files changed, 144 insertions(+), 28 deletions(-) diff --git a/.config/nvim/lua/config/autocmds.lua b/.config/nvim/lua/config/autocmds.lua index 5b9bf50..817b3bf 100644 --- a/.config/nvim/lua/config/autocmds.lua +++ b/.config/nvim/lua/config/autocmds.lua @@ -19,12 +19,19 @@ autocmd("FileType", { function FormatGoCurrentLine() 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)") local lines = vim.split(formatted_line, "\n") -- Ensure the last parameter has a comma if #lines > 2 and not lines[#lines - 1]:match(",$") then lines[#lines - 1] = lines[#lines - 1] .. "," 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 diff --git a/.config/nvim/lua/config/keymaps.lua b/.config/nvim/lua/config/keymaps.lua index 8d45b66..8e2cd4f 100644 --- a/.config/nvim/lua/config/keymaps.lua +++ b/.config/nvim/lua/config/keymaps.lua @@ -4,28 +4,103 @@ local map = vim.keymap.set -- map("i", "jk", "") -- Tmux -map("", "", " TmuxNavigateLeft", { desc = "window left" }) -map("", "", " TmuxNavigateRight", { desc = "window right" }) -map("", "", " TmuxNavigateDown", { desc = "window down" }) +map( + "", + "", + " TmuxNavigateLeft", + { desc = "window left" } +) +map( + "", + "", + " TmuxNavigateRight", + { desc = "window right" } +) +map( + "", + "", + " TmuxNavigateDown", + { desc = "window down" } +) map("", "", " TmuxNavigateUp", { desc = "window up" }) -- Resize -map("", "", " vertical resize -5", { desc = "Resize Left" }) -map("", "", " vertical resize +5", { desc = "Resize Right" }) -map("", "", " horizontal resize -5", { desc = "Resize Down" }) -map("", "", " horizontal resize +5", { desc = "Resize Up" }) +map( + "", + "", + " vertical resize -5", + { desc = "Resize Left" } +) +map( + "", + "", + " vertical resize +5", + { desc = "Resize Right" } +) +map( + "", + "", + " horizontal resize -5", + { desc = "Resize Down" } +) +map( + "", + "", + " horizontal resize +5", + { desc = "Resize Up" } +) -- Go -map("", "gsj", " GoTagAdd json ", { desc = "Add json struct tags" }) -map("", "gsy", " GoTagAdd yaml ", { desc = "Add yaml struct tags" }) -map("", "gse", " GoTagAdd env ", { desc = "Add env struct tags" }) +map( + "", + "gsj", + " GoTagAdd json ", + { desc = "Add json struct tags" } +) +map( + "", + "gsy", + " GoTagAdd yaml ", + { desc = "Add yaml struct tags" } +) +map( + "", + "gse", + " GoTagAdd env ", + { desc = "Add env struct tags" } +) -- Dap -map("", "db", " DapToggleBreakpoint ", { desc = "Add breakpoint at line" }) -map("", "dc", " DapContinue ", { desc = "Start Debugging" }) -map("", "dt", " DapTerminate ", { desc = "Stop Debugging" }) -map("", "dso", " DapStepOver ", { desc = "Step Over" }) -map("", "dsi", " DapStepInto ", { desc = "Step Into" }) +map( + "", + "db", + " DapToggleBreakpoint ", + { desc = "Add breakpoint at line" } +) +map( + "", + "dc", + " DapContinue ", + { desc = "Start Debugging" } +) +map( + "", + "dt", + " DapTerminate ", + { desc = "Stop Debugging" } +) +map( + "", + "dso", + " DapStepOver ", + { desc = "Step Over" } +) +map( + "", + "dsi", + " DapStepInto ", + { desc = "Step Into" } +) map("", "dst", " DapStepOut ", { desc = "Step Out" }) map("", "dus", function() local widgets = require("dap.ui.widgets") @@ -48,11 +123,26 @@ map("n", "P", function() end, { noremap = true }) -- CodeCopmanion -map("", "Ca", "CodeCompanionActions ", { desc = "CodeCompanion Actions" }) -map("", "Cc", "CodeCompanionChat ", { desc = "CodeCompanion Chat" }) +map( + "", + "Ca", + "CodeCompanionActions ", + { desc = "CodeCompanion Actions" } +) +map( + "", + "Cc", + "CodeCompanionChat ", + { desc = "CodeCompanion Chat" } +) -- Custom -map("", "rw", '"hy:%s/h//g', { noremap = true, silent = true, desc = "Replace Word" }) +map( + "", + "rw", + '"hy:%s/h//g', + { noremap = true, silent = true, desc = "Replace Word" } +) map("", "rt", ":VtrSendLinesToRunner", { noremap = true, @@ -60,4 +150,9 @@ map("", "rt", ":VtrSendLinesToRunner", { desc = "Send selected text to tmux pane", }) -map("", "rp", ":VtrAttachToPane", { noremap = true, silent = true, desc = "Attach to tmux pane" }) +map( + "", + "rp", + ":VtrAttachToPane", + { noremap = true, silent = true, desc = "Attach to tmux pane" } +) diff --git a/.config/nvim/stylua.toml b/.config/nvim/stylua.toml index 5d6c50d..ae31b3b 100644 --- a/.config/nvim/stylua.toml +++ b/.config/nvim/stylua.toml @@ -1,3 +1,3 @@ indent_type = "Spaces" indent_width = 2 -column_width = 120 \ No newline at end of file +column_width = 70 diff --git a/.config/shell/functions.zsh b/.config/shell/functions.zsh index 838e392..46ff4be 100644 --- a/.config/shell/functions.zsh +++ b/.config/shell/functions.zsh @@ -12,10 +12,16 @@ lockbw () } 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 local name=$(basename "$dir") + + if [[ $name == .* ]]; then + name=${name#.} + fi + tmux new-session -d -s "$name" -c "$dir" RIGHT_PANE_WIDTH=60 diff --git a/.config/tmux/tmux.conf b/.config/tmux/tmux.conf index 08d6119..a8cc6c1 100644 --- a/.config/tmux/tmux.conf +++ b/.config/tmux/tmux.conf @@ -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-remote-cwd "true" -# Use Alt-arrow keys without prefix key to switch panes -bind -n M-H resize-pane -L 5 -bind -n M-L resize-pane -R 5 -bind -n M-K resize-pane -U 5 -bind -n M-J resize-pane -D 5 +# resize windows +bind -n C-M-h resize-pane -L 5 +bind -n C-M-l resize-pane -R 5 +bind -n C-M-k resize-pane -U 5 +bind -n C-M-j resize-pane -D 5 # Shift arrow to switch windows 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 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'