diff --git a/tmux/tmux.conf b/tmux/tmux.conf index 7e2616a..e88b9b9 100644 --- a/tmux/tmux.conf +++ b/tmux/tmux.conf @@ -1,32 +1,12 @@ # Plugins set-environment -g TMUX_PLUGIN_MANAGER_PATH "$TMUX_PLUGINS" -set -g @plugin 'tmux-plugins/tpm' -set -g @plugin 'tmux-plugins/tmux-prefix-highlight' -set -g @prefix_highlight_prefix_prompt 'Pre' -set -g @prefix_highlight_fg 'yellow' -set -g @prefix_highlight_bg 'default' -set -g @plugin 'tmux-plugins/tmux-copycat' -set -g @plugin 'tmux-plugins/tmux-yank' +if "test -f ~/.config/tmux/plugins.conf" { + source-file ~/.config/tmux/plugins.conf +} -# Integration with vim-tmux-navigator & fzf -is_vim="ps -o state= -o comm= -t '#{pane_tty}' \ -| grep -iqE '^[^TXZ ]+ +(\\S+\\/)?g?(view|n?vim?x?)(diff)?$'" -is_fzf="ps -o state= -o comm= -t '#{pane_tty}' \ -| grep -iqE '^[^TXZ ]+ +(\\S+\\/)?fzf$'" -bind -n C-M-Left run "($is_vim && tmux send-keys C-h) \ - || tmux select-pane -L" -bind -n C-M-Down run "($is_vim && tmux send-keys C-j) \ - || ($is_fzf && tmux send-keys C-j) \ - || tmux select-pane -D" -bind -n C-M-Up run "($is_vim && tmux send-keys C-k) \ - || ($is_fzf && tmux send-keys C-k) \ - || tmux select-pane -U" -bind -n C-M-Right run "($is_vim && tmux send-keys C-l) \ - || tmux select-pane -R" -bind-key -T copy-mode-vi 'C-M-Left' select-pane -L -bind-key -T copy-mode-vi 'C-M-Down' select-pane -D -bind-key -T copy-mode-vi 'C-M-Up' select-pane -U -bind-key -T copy-mode-vi 'C-M-Right' select-pane -R +if "test -f ~/.config/tmux/early.conf" { + source-file ~/.config/tmux/early.conf +} set-option -g prefix C-a set-option -g set-titles on @@ -69,5 +49,9 @@ bind - last-window \; swap-pane -s tmux-zoom.0 \; kill-window -t tmux-zoom # prefix + / to search bind-key / copy-mode \; send-key ? +if "test -f ~/.config/tmux/late.conf" { + source-file ~/.config/tmux/late.conf +} + # Initialize TMUX plugin manager (keep this line at the very bottom of tmux.conf) run -b "$TMUX_PLUGINS/tpm/tpm" diff --git a/vimrc b/vimrc index bad40ec..4427084 100644 --- a/vimrc +++ b/vimrc @@ -289,10 +289,10 @@ if has_key(plugs, 'coc.nvim') && executable("node") xmap / (coc-codeaction-selected) " rename symbol - nnoremap rn (coc-rename) + nmap rn (coc-rename) " goto definition / references - nnoremap gd (coc-definition) - nnoremap gr (coc-references) + nmap gd (coc-definition) + nmap gr (coc-references) " Use tab for trigger completion with characters ahead and navigate. " NOTE: Use command ':verbose imap ' to make sure tab is not mapped by @@ -367,11 +367,21 @@ if has_key(plugs, 'fzf.vim') \ fzf#vim#files(, fzf#vim#with_preview({'source': 'rg --files --hidden --glob "!**/.git/**" ' }), 0) endif - nnoremap :Rg + nnoremap :Rg + nnoremap :Rg! + nnoremap :Rg + nnoremap :Rg! endif - nnoremap :Files - nnoremap :Buffers + nnoremap :Files + nnoremap :Files! + nnoremap :Files + nnoremap :Files! + + nnoremap :Buffers + nnoremap :Buffers! + nnoremap :Buffers + nnoremap :Buffers! endif " Vim Tmux unified movement diff --git a/zshrc b/zshrc index ecd9dc8..fcc3dc7 100755 --- a/zshrc +++ b/zshrc @@ -15,7 +15,10 @@ typeset -U PATH path fpath path=( /bin /sbin /usr/bin /usr/sbin $path ) [[ -d ~/bin ]] && path=( ~/bin $path ) +# sdkman support [[ -f ~/.sdkman/bin/sdkman-init.sh ]] && source ~/.sdkman/bin/sdkman-init.sh + +# nvm [[ -f /usr/share/nvm/init-nvm.sh ]] && source /usr/share/nvm/init-nvm.sh # jaesve support @@ -148,25 +151,26 @@ source $PSOXIZSH/zsh-custom/zshnip/zshnip.zsh ( which nvim &>/dev/null ) && export EDITOR='nvim' # Set zsh tmux config path -if which tmux &>/dev/null; then - for tmux_config in {~/.config/tmux,~/.tmux,/etc/tmux}; do - if [ -d "$tmux_config" ]; then - TMUX_PATH="$tmux_config" - break - fi - done +if which tmux &>/dev/null +then [ -z "$TMUX_PATH" ] && TMUX_PATH=~/.config/tmux - export TMUX_PATH=$TMUX_PATH - [ -d "$TMUX_PATH" ] && [ -d "$TMUX_PATH/plugins" ] || { mkdir -vp $TMUX_PATH && cp -r $PSOXIZSH/tmux/. $TMUX_PATH } - # If a .conf is detected override the default zsh tmux path - [ -f "$TMUX_PATH/tmux.conf" ] && export ZSH_TMUX_CONFIG="$TMUX_PATH/tmux.conf" + # Bootstrap the user's plugin directory, if required + [ -d "$TMUX_PATH/plugins" ] || { mkdir -vp "$TMUX_PATH/plugins" && cp -r "$PSOXIZSH/tmux/plugins" "$TMUX_PATH/plugins" } - export TMUX_PLUGINS="$TMUX_PATH/plugins" + # Both tmux and TPM are very opininated about where configs must live, + # and TPM will only expand one layer of source-file directives, so we + # symlink the base config to the user local config file, if it doesn't + # exist. + [ ! -f ~/.tmux.conf ] && ln -s $PSOXIZSH/tmux/tmux.conf ~/.tmux.conf + [ ! -f "$TMUX_PATH/plugins.conf" ] && ln -s "$PSOXIZSH/tmux/fragment/plugins.conf" "$TMUX_PATH/plugins.conf" + + export TMUX_PATH=$TMUX_PATH TMUX_PLUGINS="$TMUX_PATH/plugins" TMUX_CONFIG=~/.tmux.conf fi -if which fzf &>/dev/null; then +if which fzf &>/dev/null +then # Press ? inside a C-r search to get a preview window, useful for long commands export FZF_CTRL_R_OPTS="--preview 'echo {}' --preview-window down:3:hidden:wrap --bind '?:toggle-preview'" which tmux &> /dev/null && export FZF_TMUX=1 @@ -203,7 +207,8 @@ setopt no_bang_hist cdable_vars auto_name_dirs # Finally, make sure the terminal is in application mode, when zle is # active. Only then are the values from $terminfo valid. -if (( ${+terminfo[smkx]} )) && (( ${+terminfo[rmkx]} )); then +if (( ${+terminfo[smkx]} )) && (( ${+terminfo[rmkx]} )) +then function zle-line-init () { echoti smkx }