├── .gitconfig ├── .tmux.conf ├── .vimrc └── .zshrc /.gitconfig: -------------------------------------------------------------------------------- 1 | [user] 2 | email = zaitsev.serge@gmail.com 3 | name = Serge A. Zaitsev 4 | [push] 5 | default = simple 6 | [color] 7 | decorate = short 8 | ui = auto 9 | [alias] 10 | ci = commit 11 | [core] 12 | quotepath = false 13 | [credential] 14 | helper = cache --timeout=3000000 15 | -------------------------------------------------------------------------------- /.tmux.conf: -------------------------------------------------------------------------------- 1 | set-option -g default-terminal screen-256color 2 | 3 | # History 4 | set -g history-limit 10000 5 | 6 | # Window numbers from 1, not from 0, renumber if closed 7 | set -g base-index 1 8 | set-option -g renumber-windows on 9 | 10 | # Quick Escape (for vim) 11 | set -s escape-time 0 12 | 13 | # Hotkeys using Alt/Option as a modifier 14 | bind-key -n M-n new-window -c "#{pane_current_path}" 15 | bind-key -n M-1 select-window -t :1 16 | bind-key -n M-2 select-window -t :2 17 | bind-key -n M-3 select-window -t :3 18 | bind-key -n M-4 select-window -t :4 19 | bind-key -n M-5 select-window -t :5 20 | bind-key -n M-6 select-window -t :6 21 | bind-key -n M-7 select-window -t :7 22 | bind-key -n M-8 select-window -t :8 23 | bind-key -n M-9 select-window -t :9 24 | bind-key -n M-0 select-window -t :0 25 | bind-key -n M-. select-window -n 26 | bind-key -n M-, select-window -p 27 | bind-key -n M-< swap-window -t -1 28 | bind-key -n M-> swap-window -t +1 29 | bind-key -n M-X confirm-before "kill-window" 30 | bind-key -n M-- split-window -v -c "#{pane_current_path}" 31 | bind-key -n M-\\ split-window -h -c "#{pane_current_path}" 32 | bind-key -n M-v split-window -h -c "#{pane_current_path}" 33 | bind-key -n M-V split-window -v -c "#{pane_current_path}" 34 | bind-key -n M-R command-prompt -I "#W" "rename-window '%%'" 35 | 36 | bind-key -n M-f resize-pane -Z 37 | bind-key -n M-h select-pane -L 38 | bind-key -n M-l select-pane -R 39 | bind-key -n M-k select-pane -U 40 | bind-key -n M-j select-pane -D 41 | bind-key -n M-Left select-pane -L 42 | bind-key -n M-Right select-pane -R 43 | bind-key -n M-Up select-pane -U 44 | bind-key -n M-Down select-pane -D 45 | bind-key -n "M-H" run-shell 'old=`tmux display -p "#{pane_index}"`; tmux select-pane -L; tmux swap-pane -t $old' 46 | bind-key -n "M-J" run-shell 'old=`tmux display -p "#{pane_index}"`; tmux select-pane -D; tmux swap-pane -t $old' 47 | bind-key -n "M-K" run-shell 'old=`tmux display -p "#{pane_index}"`; tmux select-pane -U; tmux swap-pane -t $old' 48 | bind-key -n "M-L" run-shell 'old=`tmux display -p "#{pane_index}"`; tmux select-pane -R; tmux swap-pane -t $old' 49 | bind-key -n "M-S-Left" run-shell 'old=`tmux display -p "#{pane_index}"`; tmux select-pane -L; tmux swap-pane -t $old' 50 | bind-key -n "M-S-Down" run-shell 'old=`tmux display -p "#{pane_index}"`; tmux select-pane -D; tmux swap-pane -t $old' 51 | bind-key -n "M-S-Up" run-shell 'old=`tmux display -p "#{pane_index}"`; tmux select-pane -U; tmux swap-pane -t $old' 52 | bind-key -n "M-S-Right" run-shell 'old=`tmux display -p "#{pane_index}"`; tmux select-pane -R; tmux swap-pane -t $old' 53 | bind-key -n M-x confirm-before "kill-pane" 54 | 55 | bind-key -n M-/ copy-mode 56 | # linux system clipboard 57 | bind -T copy-mode-vi Enter send-keys -X copy-pipe-and-cancel "xclip -in -selection clipboard" 58 | bind-key -T copy-mode-vi MouseDragEnd1Pane send -X copy-pipe-and-cancel "xclip -in -selection clipboard" 59 | # macOS system clipboard 60 | #bind -T copy-mode-vi Enter send-keys -X copy-pipe-and-cancel "pbcopy" 61 | #bind-key -T copy-mode-vi MouseDragEnd1Pane send -X copy-pipe-and-cancel "pbcopy" 62 | 63 | set -g mouse on 64 | set-option -g status-keys vi 65 | set-option -g set-titles on 66 | set-option -g set-titles-string 'tmux - #W' 67 | set -g bell-action any 68 | set-option -g visual-bell off 69 | set-option -g set-clipboard off 70 | 71 | setw -g mode-keys vi 72 | setw -g monitor-activity on 73 | 74 | # Notifications 75 | set -g visual-activity on 76 | 77 | # Statusbar 78 | set -g status-style fg=colour15 79 | set -g status-justify centre 80 | set -g status-left '' 81 | set -g status-right '' 82 | set -g status-interval 1 83 | 84 | set -g message-style fg=colour0,bg=colour3 85 | setw -g window-status-current-style fg=yellow,bold 86 | setw -g window-status-current-format ' #W ' 87 | setw -g window-status-style fg=colour250 88 | setw -g window-status-format ' #W ' 89 | setw -g window-status-bell-style fg=colour1 90 | 91 | #run-shell ~/.tmux/plugins/tmux-resurrect/resurrect.tmux 92 | #run-shell ~/.tmux/plugins/tmux-continuum/continuum.tmux 93 | -------------------------------------------------------------------------------- /.vimrc: -------------------------------------------------------------------------------- 1 | " -------------- General behaviour ----------------- 2 | " not compatible with old vi 3 | set nocp 4 | " normal backspace behaviour 5 | set backspace=indent,eol,start 6 | " mappings for and (for some terminals) 7 | nnoremap 8 | map 9 | map 10 | " enable escape keys (some cursor and function keys) 11 | set esckeys 12 | " make mouse work 13 | set mouse=a 14 | " silent bell 15 | set novisualbell 16 | set t_vb= 17 | 18 | " remove swap 19 | set noswapfile 20 | 21 | " wrap long lines 22 | set wrap 23 | " ruler can be useful 24 | set ruler 25 | " show incomplete commands 26 | set showcmd 27 | " never make backups (e.g. file~) 28 | set nobackup 29 | 30 | " limit number of open tabs to 100 31 | set tabpagemax=100 32 | 33 | " search as you type, without highlighting 34 | set incsearch 35 | set nohlsearch 36 | set smartcase 37 | 38 | set clipboard^=unnamed 39 | 40 | " --------------- Indents and folding -------------- 41 | " indentation 42 | set autoindent 43 | set smartindent 44 | " default tab size = 2 45 | set shiftwidth=2 46 | set tabstop=2 47 | " auto folding 48 | "set foldmethod=indent 49 | set scrolljump=7 50 | set scrolloff=7 51 | 52 | set fileencodings=utf-8,cp1251,koi8-r,koi8-u 53 | 54 | filetype indent on 55 | filetype plugin on 56 | 57 | " ------------------- Syntax ----------------------- 58 | syntax enable 59 | " highlight parens but don't highlight background 60 | "hi MatchParen term=bold gui=bold ctermfg=white ctermbg=black guifg=white guibg=black 61 | " highlight very long lines 62 | au BufWinEnter *.go,*.java let w:m2=matchadd('ErrorMsg', '\%>120v.\+', -1) 63 | au BufWinEnter *.c,*.cxx,*.h,*.hxx,*.cpp,*.hpp,*.mkd,*.md let w:m2=matchadd('ErrorMsg', '\%>80v.\+', -1) 64 | 65 | " -------------------- Hotkeys --------------------- 66 | " = save 67 | noremap :update 68 | inoremap :update 69 | vnoremap :update 70 | 71 | nnoremap ; : 72 | 73 | " cmdline editing 74 | cnoremap 75 | cnoremap 76 | cnoremap 77 | cnoremap 78 | 79 | noremap 80 | noremap 81 | noremap 82 | noremap 83 | 84 | " Autoclose [, {, " 85 | imap [ [] 86 | imap { {}O 87 | 88 | " 89 | " Langage-specific options 90 | " 91 | augroup C 92 | function C() 93 | iab #i #include 94 | iab #d #define 95 | let g:clang_format#code_style="llvm" 96 | let c_no_curly_error=1 97 | endfun 98 | au! 99 | au BufWinEnter *.c,*.cc,*.cxx,*.cpp,*.h,*.hh,*.hxx,*.hpp call C() 100 | augroup END 101 | 102 | augroup Java 103 | function Java() 104 | iab pu public 105 | iab po protected 106 | iab pr private 107 | iab @o @Override 108 | iab st static 109 | iab S String 110 | let g:JavaImpPaths = $HOME . "/.vim/bundle/javaimp/android.jmplst" 111 | let g:JavaImpSortPkgSep = 1 112 | let g:JavaImpDataDir = $HOME . "/.vim/bundle/javaimp" 113 | let g:JavaImpJarCache = g:JavaImpDataDir . "/cache" 114 | let g:JavaImpClassList = g:JavaImpDataDir . "/JavaImp.txt" 115 | nmap \ai :JavaImpSilent:JavaImpSort 116 | endfun 117 | au! 118 | au BufWinEnter *.java,*.kt,*.scala call Java() 119 | augroup END 120 | 121 | augroup Js 122 | function JavaScript() 123 | iab fn function 124 | endfun 125 | au! 126 | au BufWinEnter *.js,*.es6 call JavaScript() 127 | augroup END 128 | 129 | augroup Markdown 130 | function Markdown() 131 | set ft=markdown 132 | set ai formatoptions=tcroqn2 comments=n:> 133 | syn spell toplevel 134 | syn case ignore 135 | syn sync linebreaks=1 136 | endfun 137 | au! 138 | au BufWinEnter *.md,*.mkd,*.markdown call Markdown() 139 | augroup END 140 | 141 | " ------------ Support local vimrc files ------------ 142 | function SetLocalOptions(fname) 143 | let dirname = fnamemodify(a:fname, ":p:h") 144 | while "/" != dirname 145 | let lvimrc = dirname . "/.lvimrc" 146 | if filereadable(lvimrc) 147 | execute "source " . lvimrc 148 | break 149 | endif 150 | let dirname = fnamemodify(dirname, ":p:h:h") 151 | endwhile 152 | endfunction 153 | 154 | au BufNewFile,BufRead * call SetLocalOptions(bufname("%")) 155 | 156 | if filereadable($HOME . "/.vimrc.local") 157 | source $HOME/.vimrc.local 158 | endif 159 | 160 | " 161 | " Fix insertion 162 | " 163 | function! WrapForTmux(s) 164 | if !exists('$TMUX') 165 | return a:s 166 | endif 167 | let tmux_start = "\Ptmux;" 168 | let tmux_end = "\\\" 169 | return tmux_start . substitute(a:s, "\", "\\", 'g') . tmux_end 170 | endfunction 171 | let &t_SI .= WrapForTmux("\[?2004h") 172 | let &t_EI .= WrapForTmux("\[?2004l") 173 | function! XTermPasteBegin() 174 | set pastetoggle=[201~ 175 | set paste 176 | return "" 177 | endfunction 178 | inoremap [200~ XTermPasteBegin() 179 | 180 | "autocmd FileType javascript set omnifunc=javascriptcomplete#CompleteJS 181 | if has("gui_running") 182 | set guioptions-=T " no toolbar, menu, scrollbars 183 | set guioptions-=m 184 | set guioptions-=l 185 | set guioptions-=r 186 | set guioptions-=b 187 | colorscheme elflord 188 | set guifont=Terminus\ 10 189 | endif 190 | 191 | silent! call pathogen#infect() 192 | 193 | set t_ut= " redraw background in tmux 194 | set background="dark" 195 | silent! colorscheme less 196 | 197 | " Use Ctrl-P instad of Command-T 198 | nmap \t :CtrlP 199 | let g:ctrlp_custom_ignore = { 200 | \ 'dir': '\v[\/]\.(git|hg|svn|gradle)$', 201 | \ 'file': '\v\.(o|so|class|pyc)$', 202 | \ } 203 | 204 | let g:netrw_banner = 0 205 | let g:netrw_liststyle = 3 206 | nmap l :TagbarToggle 207 | let g:tagbar_autofocus = 1 208 | 209 | " NerdCommenter toggle comment, _ is a / in vim 210 | nmap c 211 | vmap c 212 | 213 | " ES6 support 214 | autocmd BufRead,BufNewFile *.es6 setfiletype javascript 215 | let g:javascript_enable_domhtmlcss = 1 216 | 217 | " Golang 218 | let g:go_fmt_command="goimports" 219 | " Rust 220 | let g:rustfmt_autosave = 1 221 | 222 | nmap e :tabedit %:h 223 | -------------------------------------------------------------------------------- /.zshrc: -------------------------------------------------------------------------------- 1 | autoload -U compinit colors vcs_info 2 | colors 3 | compinit 4 | 5 | REPORTTIME=3 6 | HISTFILE=~/.zhistory 7 | HISTSIZE=10000 8 | SAVEHIST=10000 9 | setopt INC_APPEND_HISTORY 10 | setopt EXTENDED_HISTORY 11 | setopt HIST_IGNORE_ALL_DUPS 12 | setopt HIST_IGNORE_SPACE 13 | setopt CORRECT_ALL 14 | 15 | zstyle ':completion:*' completer _complete _correct _approximate 16 | zstyle ':vcs_info:*' stagedstr '%F{green}●%f ' 17 | zstyle ':vcs_info:*' unstagedstr '%F{yellow}●%f ' 18 | zstyle ':vcs_info:git:*' check-for-changes true 19 | zstyle ':vcs_info:git*' formats "%F{blue}%b%f %u%c" 20 | 21 | _setup_ps1() { 22 | vcs_info 23 | GLYPH="▲" 24 | [ "x$KEYMAP" = "xvicmd" ] && GLYPH="▼" 25 | PS1=" %(?.%F{blue}.%F{red})$GLYPH%f %(1j.%F{cyan}[%j]%f .)%F{blue}%~%f %(!.%F{red}#%f .)" 26 | RPROMPT="$vcs_info_msg_0_" 27 | } 28 | _setup_ps1 29 | 30 | # vi mode 31 | zle-keymap-select () { 32 | _setup_ps1 33 | zle reset-prompt 34 | } 35 | zle -N zle-keymap-select 36 | zle-line-init () { 37 | zle -K viins 38 | } 39 | zle -N zle-line-init 40 | bindkey -v 41 | 42 | # Common emacs bindings for vi mode 43 | bindkey '\e[3~' delete-char 44 | bindkey '^A' beginning-of-line 45 | bindkey '^E' end-of-line 46 | bindkey '^R' history-incremental-pattern-search-backward 47 | # Tmux home/end 48 | bindkey '\e[1~' beginning-of-line 49 | bindkey '\e[4~' end-of-line 50 | 51 | # user-friendly command output 52 | export CLICOLOR=1 53 | ls --color=auto &> /dev/null && alias ls='ls --color=auto' 54 | --------------------------------------------------------------------------------