Last active
November 9, 2017 12:02
-
-
Save jenglamlow/c66540fd5ab4d6b26e5dd895f412c8f4 to your computer and use it in GitHub Desktop.
My configuration
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Smart pane switching with awareness of Vim splits. | |
| # See: https://github.com/christoomey/vim-tmux-navigator | |
| is_vim="ps -o state= -o comm= -t '#{pane_tty}' \ | |
| | grep -iqE '^[^TXZ ]+ +(\\S+\\/)?g?(view|n?vim?x?)(diff)?$'" | |
| # Change prefix key | |
| unbind C-b | |
| set -g prefix C-a | |
| bind C-a send-prefix | |
| # set tmux to render vim colorschene | |
| set -g default-terminal "xterm-256color" | |
| # set tmux style like vi | |
| set-window-option -g mode-keys vi | |
| # vim style selection | |
| bind-key -t vi-copy 'v' begin-selection | |
| bind-key -t vi-copy 'y' copy-selection | |
| # enable mouse to resize panes (Latest tmux has mouse enable) | |
| set -g mouse on | |
| # powerline | |
| run-shell "powerline-daemon -q" | |
| source ~/.local/lib/python2.7/site-packages/powerline/bindings/tmux/powerline.conf | |
| set-option -g default-terminal "screen-256color" | |
| # tmux-resurrect | |
| # for vim | |
| set -g @resurrect-strategy-vim 'session' | |
| # for neovim | |
| set -g @resurrect-strategy-nvim 'session' | |
| # Key binding | |
| bind-key -n C-h if-shell "$is_vim" "send-keys C-h" "select-pane -L" | |
| bind-key -n C-j if-shell "$is_vim" "send-keys C-j" "select-pane -D" | |
| bind-key -n C-k if-shell "$is_vim" "send-keys C-k" "select-pane -U" | |
| bind-key -n C-l if-shell "$is_vim" "send-keys C-l" "select-pane -R" | |
| bind-key -n C-\ if-shell "$is_vim" "send-keys C-\\" "select-pane -l" | |
| bind-key -T copy-mode-vi C-h select-pane -L | |
| bind-key -T copy-mode-vi C-j select-pane -D | |
| bind-key -T copy-mode-vi C-k select-pane -U | |
| bind-key -T copy-mode-vi C-l select-pane -R | |
| bind-key -T copy-mode-vi C-\ select-pane -l | |
| bind | split-window -h -c "#{pane_current_path}" | |
| bind - split-window -v -c "#{pane_current_path}" | |
| # List of plugins | |
| set -g @plugin 'tmux-plugins/tpm' | |
| set -g @plugin 'tmux-plugins/tmux-sensible' | |
| set -g @plugin 'tmux-plugins/tmux-resurrect' | |
| # Initialize TMUX plugin manager (keep this line at the very bottom of tmux.conf) | |
| run '~/.tmux/plugins/tpm/tpm' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| syntax enable " enable syntax processing | |
| set tabstop=4 " number of visual spaces per TAB | |
| set softtabstop=4 " number of spaces in tab when editing | |
| set shiftwidth=4 " indent also with 4 spaces | |
| set expandtab " tabs are spaces | |
| set number " show line numbers | |
| set showcmd " show command in bottom bar | |
| set cursorline " highlight current line | |
| filetype indent on " load filetype-specific indent files | |
| set wildmenu " visual autocomplete for command menu | |
| set lazyredraw " redraw only when we need to. | |
| set showmatch " highlight matching [{()}] | |
| set incsearch " search as characters are entered | |
| set hlsearch " highlight matches | |
| " For easy copy-paste from other application | |
| set clipboard=unnamed | |
| " turn off search highlight | |
| nnoremap <enter> :nohlsearch<CR> | |
| " Folding | |
| set foldenable " enable folding | |
| set foldlevelstart=10 " open most folds by default | |
| set foldnestmax=10 " 10 nested fold max | |
| " space open/closes folds | |
| nnoremap <space> za | |
| " move vertically by visual line | |
| nnoremap j gj | |
| nnoremap k gk | |
| let mapleader="," " leader is comma | |
| " Cycle through listed buffers | |
| nnoremap <Tab> :bnext<CR> | |
| nnoremap <S-Tab> :bprevious<CR> | |
| " Block Cursor | |
| let &t_ti.="\e[1 q" | |
| let &t_SI.="\e[5 q" | |
| let &t_EI.="\e[1 q" | |
| let &t_te.="\e[0 q" | |
| " Split | |
| nnoremap <leader>w <C-w> | |
| nnoremap <silent> vv <C-w>v | |
| nnoremap <silent> vq <C-w>q | |
| " Navigate split | |
| nnoremap <C-J> <C-W><C-J> | |
| nnoremap <C-K> <C-W><C-K> | |
| nnoremap <C-L> <C-W><C-L> | |
| nnoremap <C-H> <C-W><C-H> | |
| " Set vertical split to right and below of the current buffer | |
| set splitright | |
| set splitbelow | |
| " Switch buffer | |
| nnoremap <leader>n :bn<CR> | |
| nnoremap <leader>p :bp<CR> | |
| nnoremap <leader>d :bp<CR>:bd #<CR> | |
| nnoremap <leader>l :ls<CR> | |
| " Tab navigation | |
| nnoremap H gT | |
| nnoremap L gt | |
| execute pathogen#infect() | |
| syntax on | |
| filetype plugin indent on | |
| " Vim Plug | |
| call plug#begin('~/.vim/plugged') | |
| Plug 'junegunn/fzf', { 'dir': '~/.fzf', 'do': './install --all' } | |
| Plug 'junegunn/fzf.vim' | |
| Plug 'morhetz/gruvbox' | |
| Plug 'scrooloose/nerdtree' | |
| Plug 'benmills/vimux' | |
| Plug 'jistr/vim-nerdtree-tabs' | |
| Plug 'bling/vim-airline' | |
| Plug 'tomtom/tcomment_vim' | |
| Plug 'tpope/vim-obsession' | |
| Plug 'tpope/vim-fugitive' | |
| Plug 'christoomey/vim-tmux-navigator' | |
| Plug 'svermeulen/vim-easyclip' | |
| Plug 'tpope/vim-repeat' | |
| call plug#end() | |
| " Color theme setting | |
| colorscheme gruvbox | |
| set background=dark " Setting dark mode | |
| " NERDtree | |
| " autocmd vimenter * NERDTree | |
| " Ctrl+N to toggle NERDTree | |
| map <C-n> <Plug>NERDTreeTabsToggle<CR> | |
| " Close vim if the only window left in a NERDTree | |
| autocmd bufenter * if (winnr("$") == 1 && exists("b:NERDTree") && b:NERDTree.isTabTree()) | q | endif | |
| " Show hidden files in NerdTree | |
| let NERDTreeShowHidden=1 | |
| " vim-airline | |
| " Powerline fonts | |
| let g:airline_powerline_fonts = 1 | |
| " Enable tabline | |
| let g:airline#extensions#tabline#enabled = 1 | |
| " commentary | |
| nmap <leader>c gcc | |
| " vimux | |
| map <Leader>vp :VimuxPromptCommand<CR> | |
| map <Leader>vl :VimuxRunLastCommand<CR> | |
| " For copy tmux pane | |
| map <Leader>vi :VimuxInspectRunner<CR> | |
| " Zoom to tmux pane, <prefix> z to return back to normal | |
| map <Leader>vz :VimuxZoomRunner<CR> | |
| " Neomake | |
| " autocmd! BufEnter,BufWritePost * Neomake | |
| " YouCompleteMe | |
| let g:ycm_global_ycm_extra_conf = "~/.vim/bundle/youcompleteme/third_party/ycmd/cpp/ycm/.ycm_extra_conf.py" | |
| nnoremap <f12> :YcmCompleter GoToDefinition<cr> | |
| " fzf | |
| " Mapping selecting mappings (Show all the key mapping) | |
| nmap <leader><tab> <plug>(fzf-maps-n) | |
| xmap <leader><tab> <plug>(fzf-maps-x) | |
| omap <leader><tab> <plug>(fzf-maps-o) | |
| " Insert mode completion | |
| imap <c-x><c-k> <plug>(fzf-complete-word) | |
| imap <c-x><c-f> <plug>(fzf-complete-path) | |
| imap <c-x><c-j> <plug>(fzf-complete-file-ag) | |
| imap <c-x><c-l> <plug>(fzf-complete-line) | |
| " Mapping searching files and grep | |
| nmap <leader>f :Files<CR> | |
| nmap <leader>g :Rg<CR> | |
| " Advanced customization using autoload functions | |
| inoremap <expr> <c-x><c-k> fzf#vim#complete#word({'left': '15%'}) | |
| " Ag display only file content | |
| command! -bang -nargs=* Ag call fzf#vim#ag(<q-args>, {'options': '--delimiter : --nth 4..'}, <bang>0) | |
| " Ripgrep fzf | |
| command! -bang -nargs=* Rg | |
| \ call fzf#vim#grep( | |
| \ 'rg --column --line-number --no-heading --color=always --fixed-strings --ignore-case --hidden --follow '.shellescape(<q-args>), 1, | |
| \ <bang>0 ? fzf#vim#with_preview({'options': '--delimiter : --nth 4..'},'up:60%') | |
| \ : fzf#vim#with_preview({'options': '--delimiter : --nth 4..'},'right:50%:hidden', '?'), | |
| \ <bang>0) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment