From 7ad4baa14c3fb5a38a5e1c584197c0905536b881 Mon Sep 17 00:00:00 2001 From: Sarthak Jain Date: Thu, 12 Mar 2026 19:26:49 +0530 Subject: [PATCH] Zshrc fixes for mac --- .zshrc | 12 ++-- 2q | 174 ---------------------------------------------------- sh_personal | 44 ------------- 3 files changed, 6 insertions(+), 224 deletions(-) delete mode 100644 2q diff --git a/.zshrc b/.zshrc index 7e3ee5b..92a22d7 100644 --- a/.zshrc +++ b/.zshrc @@ -70,7 +70,7 @@ COMPLETION_WAITING_DOTS="true" # Custom plugins may be added to $ZSH_CUSTOM/plugins/ # Example format: plugins=(rails git textmate ruby lighthouse) # Add wisely, as too many plugins slow down shell startup. -plugins=(git zsh-autosuggestions starship) +plugins=(git starship) source $ZSH/oh-my-zsh.sh @@ -82,11 +82,11 @@ source $ZSH/oh-my-zsh.sh # export LANG=en_US.UTF-8 # Preferred editor for local and remote sessions -# if [[ -n $SSH_CONNECTION ]]; then -# export EDITOR='vim' -# else -# export EDITOR='nvim' -# fi +if [[ -n $SSH_CONNECTION ]]; then + export EDITOR='vim' +else + export EDITOR='nvim' +fi # Compilation flags # export ARCHFLAGS="-arch $(uname -m)" diff --git a/2q b/2q deleted file mode 100644 index 317f1d4..0000000 --- a/2q +++ /dev/null @@ -1,174 +0,0 @@ -local map = vim.keymap.set -local opts = { noremap = true, silent = true } - -map("n", "", "nohlsearch") - --- Diagnostic keymaps --- map("n", "q", vim.diagnostic.setloclist, { desc = "Open diagnostic [Q]uickfix list" }) - --- Exit terminal mode in the builtin terminal with a shortcut that is a bit easier --- for people to discover. Otherwise, you normally need to press , which --- is not what someone will guess without a bit more experience. --- --- NOTE: This won't work in all terminal emulators/tmux/etc. Try your own mapping --- or just use to exit terminal mode -map("t", "", "", { desc = "Exit terminal mode" }) -map("n", "-", "Oil ", { desc = "Open parent directory" }) - --- Create a new buffer -map("n", "b", " enew ", { desc = "new buffer" }) - -map("n", "U", " Telescope undo", { desc = "Telescope Undo" }) --- Toggle comment -map("n", "/", function() - require("Comment.api").toggle.linewise.current() -end, { desc = "Toggle comment line" }) - -map("n", "cb", function() - require("Comment.api").toggle.blockwise.current() -end, { desc = "Toggle comment block" }) - -map( - "v", - "/", - "lua require('Comment.api').toggle.linewise(vim.fn.visualmode())", - { desc = "Toggle comment line" } -) - - --- ============================================ --- GitHub Copilot Keybindings --- ============================================ - --- Copilot suggestions (in insert mode) --- Note: These are handled by the plugin config above, but listed here for reference --- Accept suggestion (Alt+l) --- Next suggestion (Alt+]) --- Previous suggestion (Alt+[) --- Dismiss suggestion (Ctrl+]) - --- Copilot Chat - Quick Actions -map("n", "jj", "CopilotChatToggle", { desc = "Toggle Copilot Chat" }) -map("n", "jo", "CopilotChat", { desc = "Open Copilot Chat" }) -map("n", "jx", "CopilotChatClose", { desc = "Close Copilot Chat" }) -map("n", "jr", "CopilotChatReset", { desc = "Reset Chat History" }) - --- Copilot Chat - Code Actions (work in normal and visual mode) -map({ "n", "v" }, "je", "CopilotChatExplain", { desc = "Explain Code" }) -map({ "n", "v" }, "jt", "CopilotChatTests", { desc = "Generate Tests" }) -map({ "n", "v" }, "jf", "CopilotChatFix", { desc = "Fix Code" }) -map({ "n", "v" }, "jO", "CopilotChatOptimize", { desc = "Optimize Code" }) -map({ "n", "v" }, "jd", "CopilotChatDocs", { desc = "Generate Documentation" }) -map({ "n", "v" }, "jv", "CopilotChatReview", { desc = "Review Code" }) - --- Copilot Chat - Git Integration -map("n", "jc", "CopilotChatCommit", { desc = "Generate Commit Message" }) -map("n", "jC", "CopilotChatCommitStaged", { desc = "Commit Message (Staged)" }) - --- Copilot Chat - Quick Question -map("n", "jq", function() - local input = vim.fn.input("Quick Chat: ") - if input ~= "" then - require("CopilotChat").ask(input) - end -end, { desc = "Quick Question to Copilot" }) - --- Copilot Chat - Visual Mode -map("v", "jv", ":CopilotChatVisual ", { desc = "Chat with Selection" }) -map("v", "ji", ":CopilotChatInline", { desc = "Inline Chat" }) - --- Copilot Chat - Buffer Context -map("n", "jb", function() - local input = vim.fn.input("Ask Copilot (Buffer Context): ") - if input ~= "" then - require("CopilotChat").ask(input, { selection = require("CopilotChat.select").buffer }) - end -end, { desc = "Ask About Entire Buffer" }) - --- Copilot Chat - Diagnostic Help -map("n", "jD", function() - require("CopilotChat").ask("Help with diagnostics", { - selection = require("CopilotChat.select").diagnostics, - }) -end, { desc = "Fix Diagnostics with Copilot" }) - --- Copilot Panel Toggle (alternative suggestion view) -map("n", "jp", "Copilot panel", { desc = "Open Copilot Panel" }) - --- line numbers -map("n", "nn", " set nu! ", { desc = "Toggle line number" }) -map("n", "nr", " set rnu! ", { desc = "Toggle relative number" }) - --- TIP: Disable arrow keys in normal mode -map("n", "", 'echo "Use h to move!!"') -map("n", "", 'echo "Use l to move!!"') -map("n", "", 'echo "Use k to move!!"') -map("n", "", 'echo "Use j to move!!"') - -map("n", "wk", "WhichKey", { desc = "Which-Key all keymaps" }) -map("n", "wK", function() - local input = vim.fn.input("WhichKey: ") - vim.cmd("WhichKey" .. input) -end, { desc = "Which-Key query lookup" }) -map("n", "gs", "Git status", { desc = "Git status" }) - --- Keybinds to make split navigation easier. --- Use CTRL+ to switch between windows --- --- See `:help wincmd` for a list of all window commands -map("n", "", "", { desc = "Move focus to the left window" }) -map("n", "", "", { desc = "Move focus to the right window" }) -map("n", "", "", { desc = "Move focus to the lower window" }) -map("n", "", "", { desc = "Move focus to the upper window" }) -map("n", "", function() - require("nvchad.tabufline").prev() -end, opts) -map("n", "", function() - require("nvchad.tabufline").next() -end, opts) -map("n", "q", function() - require("nvchad.tabufline").close_buffer() -end, opts) - -map("n", "", ":m .+1==", opts) -map("n", "", ":m .-2==", opts) -map("i", "", ":m .+1==gi", opts) -map("i", "", ":m .-2==gi", opts) -map("v", "", ":m '>+1gv=gv", opts) -map("v", "", ":m '<-2gv=gv", opts) -map("n", "cc", function() - local ok, start = require("indent_blankline.utils").get_current_context( - vim.g.indent_blankline_context_patterns, - vim.g.indent_blankline_use_treesitter_scope - ) - if ok then - vim.api.nvim_win_set_cursor(vim.api.nvim_get_current_win(), { start, 0 }) - vim.cmd([[normal! _]]) - end -end, { desc = "Jump to current context" }) - -map("n", "cr, "cc -o % %.c ", {desc = "Run C program"}) --- greatest remap ever -map("x", "p", [["_dP]]) - -map("n", "xx", "!chmod +x %", { silent = true }) -map("i", "", "", opts) --- next greatest remap ever : asbjornHaland -map({ "n", "v" }, "y", [["+y]]) -vim.keymap.set("n", "Q", "") -vim.keymap.set("n", "Q!", "") -vim.keymap.set("n", "Wq", "") -map("n", "Y", [["+Y]]) -map("n", "C", " Cheat ") -map("n", "fa", " lua require('fzf-lua').files() ", { desc = "FZF find files" }) -map("n", "ff", " lua require('fzf-lua').files() ", { desc = "FZF find files" }) -map("n", "fq", " lua require('fzf-lua').quickfix() ", { desc = "FZF quickfix" }) -map("n", "fb", " lua require('fzf-lua').buffers() ", { desc = "FZF find buffers" }) -map("n", "fZ", " lua require('fzf-lua').lgerp_curbuf() ", { desc = "FZF Live grep current buffer" }) -map("n", "fd", " lua require('fzf-lua').oldfiles() ", { desc = "FZF opened files history" }) -map("n", "fm", " lua require('fzf-lua').marks() ", { desc = "FZF marks" }) -map("n", "fw", " lua require('fzf-lua').live_grep() ", { desc = "FZF live grep" }) -map("n", "fg", " lua require('fzf-lua').git_Commits() ", { desc = "FZF Git commits" }) -map("n", "fG", " lua require('fzf-lua').git_bcommits() ", { desc = "FZF Git commits" }) -map("n", "fs", " lua require('fzf-lua').git_status() ", { desc = "FZF Git commits" }) -map("n", "fp", " lua require('fzf-lua').manpages() ", { desc = "FZF Manpages" }) diff --git a/sh_personal b/sh_personal index 7763fe1..dc7d6c7 100644 --- a/sh_personal +++ b/sh_personal @@ -42,50 +42,6 @@ case "$TERM" in xterm-color|*-256color) color_prompt=yes;; esac -# uncomment for a colored prompt, if the terminal has the capability; turned -# off by default to not distract the user: the focus in a terminal window -# should be on the output of commands, not on the prompt -#force_color_prompt=yes - -if [ -n "$force_color_prompt" ]; then - if [ -x /usr/bin/tput ] && tput setaf 1 >&/dev/null; then - # We have color support; assume it's compliant with Ecma-48 - # (ISO/IEC-6429). (Lack of such support is extremely rare, and such - # a case would tend to support setf rather than setaf.) - color_prompt=yes - else - color_prompt= - fi -fi - -if [ "$color_prompt" = yes ]; then - PS1='${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\$ ' -else - PS1='${debian_chroot:+($debian_chroot)}\u@\h:\w\$ ' -fi -unset color_prompt force_color_prompt - -# If this is an xterm set the title to user@host:dir -case "$TERM" in -xterm*|rxvt*) - PS1="\[\e]0;${debian_chroot:+($debian_chroot)}\u@\h: \w\a\]$PS1" - ;; -*) - ;; -esac - -# enable color support of ls and also add handy aliases -if [ -x /usr/bin/dircolors ]; then - test -r ~/.dircolors && eval "$(dircolors -b ~/.dircolors)" || eval "$(dircolors -b)" - alias ls='ls --color=auto' - #alias dir='dir --color=auto' - #alias vdir='vdir --color=auto' - - alias grep='grep --color=auto' - alias fgrep='fgrep --color=auto' - alias egrep='egrep --color=auto' -fi - # colored GCC warnings and errors #export GCC_COLORS='error=01;31:warning=01;35:note=01;36:caret=01;32:locus=01:quote=01'