From 4d6c43b4be29aeaf2793f1c3e9c5f5ce4c99e6f9 Mon Sep 17 00:00:00 2001 From: Brandon Cornejo Date: Tue, 13 Jul 2021 15:14:25 -0500 Subject: [PATCH] tmux maintain directory, bash collapse PWD, vi-mode indicator --- bashrc | 64 +++++++++---------------------------------------------- tmux.conf | 40 ++++------------------------------ vimrc | 22 +++++++++++++------ 3 files changed, 30 insertions(+), 96 deletions(-) diff --git a/bashrc b/bashrc index a7f085e..b24a738 100644 --- a/bashrc +++ b/bashrc @@ -4,22 +4,11 @@ set -o vi # If not running interactively, don't do anything [ -z "$PS1" ] && return -# shopt -s checkwinsize -[ -x /usr/bin/lesspipe ] && eval "$(SHELL=/bin/sh lesspipe)" - -if [ -z "$debian_chroot" ] && [ -r /etc/debian_chroot ]; then - debian_chroot=$(cat /etc/debian_chroot) -fi - -# set a fancy prompt (non-color, unless we know we "want" color) -case "$TERM" in - xterm-color) color_prompt=yes;; -esac # Get our git stuff source ~/code/dotfiles/git-completion.sh source ~/code/dotfiles/git-prompt.sh -force_color_prompt=yes +export PROMPT_DIRTRIM=2 # Prompt colors BGREEN='\[\033[1;32m\]' @@ -39,62 +28,29 @@ NORMAL='\[\033[00m\]' # Prompt vars TIME="\@" HOST="\h" -USER="\u" CWD="\w" PUID="\$" GIT="\$(__git_ps1)" +# Prompt display line +PS1="${BLUE}(${GREEN}${CWD}${BLUE}) ${NORMAL}${HOST}${BRED}${GIT}${NORMAL} [$?${NORMAL}]${GREEN} ${PUID}${NORMAL} " -if [ -n "$force_color_prompt" ]; then - if [ -x /usr/bin/tput ] && tput setaf 1 >&/dev/null; then - color_prompt=yes - else - color_prompt= - fi -fi - -if [ "$color_prompt" = yes ]; then - PS1="${BLUE}(${GREEN}${CWD}${BLUE}) ${NORMAL}${HOST}${BRED}${GIT}${NORMAL} [$?${NORMAL}]${GREEN} ${PUID}${NORMAL} " -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 -CFX --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 +# Set VI mode display in prompt +bind "set vi-cmd-mode-string \"\1\e[1;30m\2:\1\e[0m\2\"" +bind "set vi-ins-mode-string \"\1\e[0;36m\2+\1\e[0m\2\"" +bind "set show-mode-in-prompt on" -# some more ls aliases -alias ll='ls -alF' -alias la='ls -A' -alias l='ls -CF' +alias ls='ls -G' #mah aliases, son -alias atr0phy='ssh br4n@atr0phy.net' +alias atr0phy='ssh -D 3333 -C br4n@atr0phy.net' alias at0rphy='ssh -L 9050:127.0.0.1:9050 br4n@atr0phy.net' alias evoluent='xinput --set-button-map 14 3 1 1 4 5 7 8 9 0 10 11' -alias cls='clear && ls -X --color=auto' +alias cls='clear && ls' alias notes="vim +VimwikiIndex" alias tmpvim="vim /tmp/$(uuid)" alias snip="scrot -s ~/Documents/screenshots/%b%d-%H:%M.png" -# Add an "alert" alias for long running commands. Use like so: -# sleep 10; alert -alias alert='notify-send --urgency=low -i "$([ $? = 0 ] && echo terminal || echo error)" "$(history|tail -n1|sed -e '\''s/^\s*[0-9]\+\s*//;s/[;&|]\s*alert$//'\'')"' - if [ -f /etc/bash_completion ] && ! shopt -oq posix; then . /etc/bash_completion fi diff --git a/tmux.conf b/tmux.conf index 4b33f50..afbb836 100644 --- a/tmux.conf +++ b/tmux.conf @@ -1,5 +1,4 @@ set-option -g prefix C-a -bind-key C-a last-window set -g default-terminal "screen-256color" setw -g alternate-screen on @@ -25,63 +24,32 @@ set -g status-justify left set -g status-bg default set -g status-fg colour12 -#window mode -setw -g mode-bg colour6 -setw -g mode-fg colour0 - # window status setw -g window-status-format " #F#I:#W#F " setw -g window-status-current-format " #F#I:#W#F " setw -g window-status-format "#[fg=magenta]#[bg=black] #I #[bg=cyan]#[fg=colour8] #W " setw -g window-status-current-format "#[bg=brightmagenta]#[fg=colour8] #I #[fg=colour8]#[bg=colour14] #W " -setw -g window-status-current-bg colour0 -setw -g window-status-current-fg colour11 -setw -g window-status-current-attr dim -setw -g window-status-bg green -setw -g window-status-fg black -setw -g window-status-attr reverse # Info on left set -g status-left '' -# The panes { -set -g pane-border-fg colour238 -set -g pane-active-border-fg colour51 -# } - # The statusbar { set -g status-position bottom set -g status-bg colour234 set -g status-fg colour137 -set -g status-attr dim set -g status-left '' set -g status-right '#[fg=colour233,bg=colour241,bold] %d/%m #[fg=colour233,bg=colour245,bold] %H:%M:%S ' set -g status-right-length 50 set -g status-left-length 20 -setw -g window-status-current-fg colour81 -setw -g window-status-current-bg colour238 -setw -g window-status-current-attr bold setw -g window-status-current-format ' #I#[fg=colour250]:#[fg=colour255]#W#[fg=colour50]#F ' -setw -g window-status-fg colour138 -setw -g window-status-bg colour235 -setw -g window-status-attr none setw -g window-status-format ' #I#[fg=colour237]:#[fg=colour250]#W#[fg=colour244]#F ' -setw -g window-status-bell-attr bold -setw -g window-status-bell-fg colour255 -setw -g window-status-bell-bg colour1 - -# } -# The messages { - -set -g message-attr bold -set -g message-fg colour232 -set -g message-bg colour166 - -# } - bind-key -T copy-mode-vi v send-keys -X begin-selection bind-key -T copy-mode-vi y send-keys -X copy-selection bind-key -T copy-mode-vi r send-keys -X rectangle-toggle + +# When splitting a window, maintain directory +bind '"' split-window -c "#{pane_current_path}" +bind % split-window -h -c "#{pane_current_path}" diff --git a/vimrc b/vimrc index 356ea5f..cc71475 100644 --- a/vimrc +++ b/vimrc @@ -11,7 +11,6 @@ set t_vb= " aesthetics -syntax enable " enable syntax processing set scrolloff=4 " always show 5 lines above/below cursor set sidescrolloff=5 " always show 5 chars over set display=lastline " show as much as possible, no @s @@ -47,7 +46,7 @@ set foldmethod=indent " unless told otherwise, fold on indents " set Vundle runtime path and initialize -set rtp+=~/.vim/bundle/vundle +set rtp+=~/.vim/bundle/Vundle.vim call vundle#begin() " Plugins for Vundle to handle @@ -65,12 +64,15 @@ Plugin 'tmhedberg/SimpylFold' Plugin 'w0rp/ale' Plugin 'vimwiki/vimwiki.git' Plugin 'chrisbra/csv.vim' -Plugin 'davidhalter/jedi-vim' +"Plugin 'davidhalter/jedi-vim' +Plugin 'ejholmes/vim-forcedotcom' " end vundle setup call vundle#end() -colorscheme distinguished " such colours +filetype plugin indent on +syntax enable " enable syntax processing +colorscheme distinguished " such colours " autocmd check if has("autocmd") @@ -79,14 +81,22 @@ if has("autocmd") " set filetypes in odd extensions for decent highlighting autocmd BufNewFile,BufRead *.djhtml set filetype=html autocmd BufNewFile,BufRead *.raml set filetype=yaml - autocmd BufNewFile,BufRead *.rst set filetype=rust - autocmd BufNewFile,BufRead *.cls set filetype=apexcode + autocmd BufNewFile,BufRead *.cmp set filetype=html " for rainbow parentheses plugin autocmd VimEnter * RainbowParenthesesToggle autocmd Syntax * RainbowParenthesesLoadRound autocmd Syntax * RainbowParenthesesLoadSquare autocmd Syntax * RainbowParenthesesLoadBraces + + let g:python_recommended_style = 0 + + " swap between line number modes + augroup numbertoggle + autocmd! + autocmd BufEnter,FocusGained,InsertLeave * set relativenumber + autocmd BufLeave,FocusLost,InsertEnter * set norelativenumber + augroup END endif " [COMMANDS]