Created
June 4, 2017 22:15
-
-
Save chenyanzhe/b79e001c1fb9e7e6f16973300d8b3c0c to your computer and use it in GitHub Desktop.
Dot Files
This file contains 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
# Setting the prefix from C-b to C-a | |
set -g prefix C-a | |
# Free the original Ctrl-b prefix keybinding | |
unbind C-b | |
# Setting the delay between prefix and command | |
set -s escape-time 1 | |
# Set the base index for windows to 1 instead of 0 | |
set -g base-index 1 | |
# Set the base index for panes to 1 instead of 0 | |
setw -g pane-base-index 1 | |
# Define Prefix b to reload the configuration | |
bind r source-file ~/.tmux.conf \; display "Configuration Reloaded!" | |
# Ensure that we can send Ctrl-a to other apps | |
bind C-a send-prefix | |
# Splitting panes with | and - | |
bind | split-window -h | |
bind - split-window -v | |
# Moving between panes with Prefix h,j,k,l | |
bind h select-pane -L | |
bind j select-pane -D | |
bind k select-pane -U | |
bind l select-pane -R | |
# Quick window selection | |
# Use Prefix C-h and Prefix C-l to cycle through the windows | |
bind -r C-h select-window -t :- | |
bind -r C-l select-window -t :+ | |
# Pane resizing with Prefix H,J,K,L | |
bind -r H resize-pane -L 3 | |
bind -r J resize-pane -D 3 | |
bind -r K resize-pane -U 3 | |
bind -r L resize-pane -R 3 | |
# Mouse support - set to on if you want to use the mouse | |
set -g mouse off | |
# Set colors for the status line | |
set -g status-style 'fg=white,bold,bg=#5b8ec5' | |
# Set colors for the active window | |
setw -g window-status-current-style 'fg=white,bold,bg=#f8864d' | |
# Set colors for command / message line | |
set -g message-style 'fg=white,bold,bg=#f8864d' | |
# Set colors for pane borders | |
setw -g pane-border-style 'fg=#8ec089,bg=#162721' | |
#setw -g pane-active-border-style 'fg=#f8864d,bg=#162721' | |
# Set the correct term for 24-bit color | |
set -ga terminal-overrides ",xterm-256color:Tc" | |
# Status line left side to show session:window:pane | |
set -g status-left-length 40 | |
set -g status-left ' [#S]:[#I].[#P]' | |
# Status line right side to show time and date | |
set -g status-right '%d %b %R ' | |
# Center the window list in the status line | |
set -g status-justify centre | |
# Enable activity alerts | |
setw -g monitor-activity on | |
set -g visual-activity on | |
setw -g window-status-activity-style 'bg=#8ec089' | |
# Remap vim-like copy and paste keys | |
bind Escape copy-mode | |
bind -t vi-copy 'v' begin-selection | |
bind -t vi-copy 'y' copy-selection | |
unbind p | |
bind p paste-buffer | |
# Using macOS clipboard commands | |
set -g default-command "reattach-to-user-namespace -l zsh" | |
bind C-c run "tmux save-buffer - | reattach-to-user-namespace pbcopy" | |
bind -t vi-copy y copy-pipe "reattach-to-user-namespace pbcopy" | |
bind C-v run "reattach-to-user-namespace pbpaste | tmux load-buffer - \; paste-buffer -d" | |
# Shortcut for synchronize-panes toggle | |
bind C-s set-window-option synchronize-panes | |
# Change the default shell to zsh | |
set -g default-shell /bin/zsh | |
# Smart pane switching with awareness of Vim splits | |
#is_vim="ps -o state= -o comm= -t '#{pane_tty}' \ | |
# | grep -iqE '^[^TXZ ]+ +(\\S+\\/)?g?(view|n?vim?x?)(diff)?$'" | |
#bind-key C-h if-shell "$is_vim" "send-keys C-h" "select-pane -L" | |
#bind-key C-j if-shell "$is_vim" "send-keys C-j" "select-pane -D" | |
#bind-key C-k if-shell "$is_vim" "send-keys C-k" "select-pane -U" | |
#bind-key C-l if-shell "$is_vim" "send-keys C-l" "select-pane -R" | |
#bind-key C-\ if-shell "$is_vim" "send-keys C-\\" "select-pane -l" | |
# Restoring clear screen and clear line | |
# bind C-l send-keys "C-l" | |
# bind C-k send-keys "C-k" |
This file contains 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
call plug#begin('~/.config/nvim/plugged') | |
" Theme | |
" ============================================================================== | |
Plug 'mhartington/oceanic-next' | |
" Icons | |
" ============================================================================== | |
Plug 'ryanoasis/vim-devicons' | |
" Indent Line | |
" ============================================================================== | |
Plug 'Yggdroot/indentLine' | |
" Tree Explorer | |
" ============================================================================== | |
Plug 'scrooloose/nerdtree' | |
Plug 'tiagofumo/vim-nerdtree-syntax-highlight' | |
" Surroundings | |
" ============================================================================== | |
Plug 'tpope/vim-surround' | |
" Comments | |
" ============================================================================== | |
Plug 'tpope/vim-commentary' | |
" Formatter | |
" ============================================================================== | |
Plug 'Chiel92/vim-autoformat' | |
" Status Line | |
" ============================================================================== | |
Plug 'vim-airline/vim-airline' | |
" Searching | |
" ============================================================================== | |
Plug 'ctrlpvim/ctrlp.vim' | |
Plug 'mileszs/ack.vim' | |
" Git | |
" ============================================================================== | |
Plug 'tpope/vim-fugitive' | |
Plug 'airblade/vim-gitgutter' | |
" EasyMotion | |
" ============================================================================== | |
Plug 'easymotion/vim-easymotion' | |
" YouCompleteMe | |
" ============================================================================== | |
Plug 'Valloric/YouCompleteMe' | |
" YCM-Generator | |
" ============================================================================== | |
Plug 'rdnetto/YCM-Generator', { 'branch': 'stable' } | |
" Languanges | |
" ============================================================================== | |
Plug 'othree/yajs.vim' | |
Plug 'othree/html5.vim' | |
Plug 'HerringtonDarkholme/yats.vim' | |
Plug 'octol/vim-cpp-enhanced-highlight' | |
Plug 'fatih/vim-go', { 'do': ':GoInstallBinaries' } | |
Plug 'chase/vim-ansible-yaml' | |
Plug 'stephpy/vim-yaml' | |
call plug#end() | |
" General | |
" ============================================================================== | |
set noshowmode | |
set noswapfile | |
filetype on | |
set relativenumber number | |
set tabstop=4 shiftwidth=4 expandtab | |
set conceallevel=0 | |
set virtualedit= | |
set wildmenu | |
set laststatus=2 | |
set wrap linebreak nolist | |
set wildmode=full | |
set hidden | |
set autowrite | |
let mapleader = ',' | |
" Remember cursor position between vim sessions | |
" ============================================================================== | |
autocmd BufReadPost * | |
\ if line("'\"") > 0 && line ("'\"") <= line("$") | | |
\ exe "normal! g'\"" | | |
\ endif | |
" center buffer around cursor when opening files | |
autocmd BufRead * normal zz | |
" Appearance | |
" ============================================================================== | |
syntax enable | |
set termguicolors | |
set guifont=Sauce\ Code\ Pro\ Nerd\ Font\ Complete:h14 | |
colorscheme OceanicNext | |
hi CursorLineNR guifg=#ffffff | |
" Mappings | |
" ============================================================================== | |
nnoremap Q <nop> | |
map q <nop> | |
vnoremap <c-c> "*y<cr> | |
vnoremap y "*y<cr> | |
nnoremap Y "*Y<cr> | |
noremap H ^ | |
noremap L g_ | |
noremap J 5j | |
noremap K 5k | |
map <esc> :noh<cr> | |
nnoremap <silent> <c-j> <c-w><c-j> | |
nnoremap <silent> <c-k> <c-w><c-k> | |
nnoremap <silent> <c-l> <c-w><c-l> | |
nnoremap <silent> <c-h> <c-w><c-h> | |
map <c-n> :cnext<cr> | |
map <c-m> :cprevious<cr> | |
" Plug Configurations (BEGIN) | |
" ============================================================================== | |
" Plug 'Yggdroot/indentLine' | |
let g:indentLine_char='│' | |
" Plug 'scrooloose/nerdtree' | |
map <silent> <c-e> :NERDTreeToggle<cr> | |
let NERDTreeShowBookmarks = 1 | |
let NERDTreeIgnore = | |
\ ['\.idea', '\.iml', '\.pyc', '\~$', '\.swo$', '\.git', '\.hg', '\.svn', '\.bzr', '\.DS_Store', 'tmp', 'gin-bin'] | |
let NERDTreeShowHidden = 1 | |
let NERDTreeChDirMode = 2 | |
let NERDTreeMouseMode = 2 | |
let g:NERDTreeAutoDeleteBuffer = 1 | |
" Plug 'vim-airline/vim-airline' | |
let g:airline#extensions#tabline#enabled = 1 | |
let g:airline#extensions#tabline#fnamemod = ':t' | |
let g:airline#extensions#tabline#show_tab_nr = 1 | |
let g:airline_powerline_fonts = 1 | |
let g:airline_theme='oceanicnext' | |
let g:airline#extensions#tabline#buffer_idx_mode = 1 | |
" Plug 'octol/vim-cpp-enhanced-highlight' | |
let g:cpp_class_scope_highlight = 1 | |
let g:cpp_concepts_highlight = 1 | |
" Plug 'fatih/vim-go', { 'do': ':GoInstallBinaries' } | |
let g:go_list_type = "quickfix" | |
"let g:go_fmt_command = "goimports" | |
let g:go_highlight_types = 1 | |
let g:go_highlight_fields = 1 | |
let g:go_highlight_functions = 1 | |
let g:go_highlight_methods = 1 | |
let g:go_highlight_operators = 1 | |
let g:go_highlight_extra_types = 1 | |
let g:go_highlight_build_constraints = 1 | |
let g:go_highlight_generate_tags = 1 | |
let g:go_auto_type_info = 1 | |
"let g:go_auto_sameids = 1 | |
" run :GoBuild or :GoTestCompile based on the go file | |
function! s:build_go_files() | |
let l:file = expand('%') | |
if l:file =~# '^\f\+_test\.go$' | |
call go#cmd#Test(0, 1) | |
elseif l:file =~# '^\f\+\.go$' | |
call go#cmd#Build(0) | |
endif | |
endfunction | |
autocmd FileType go nmap <leader>b :<c-u>call <sid>build_go_files()<cr> | |
autocmd FileType go nmap <leader>r <Plug>(go-run) | |
autocmd FileType go nmap <leader>t <Plug>(go-test) | |
autocmd FileType go nmap <leader>c <Plug>(go-coverage-toggle) | |
autocmd Filetype go command! -bang A call go#alternate#Switch(<bang>0, 'edit') | |
autocmd Filetype go command! -bang AV call go#alternate#Switch(<bang>0, 'vsplit') | |
autocmd Filetype go command! -bang AS call go#alternate#Switch(<bang>0, 'split') | |
autocmd Filetype go command! -bang AT call go#alternate#Switch(<bang>0, 'tabe') | |
nmap <C-g> :GoDecls<cr> | |
imap <C-g> <esc>:<C-u>GoDecls<cr> | |
" Plug 'ctrlpvim/ctrlp.vim' | |
set wildignore+=*/tmp/*,*.so,*.swp,*.zip | |
let g:ctrlp_custom_ignore = '\v[\/]\.(git|hg|svn)$' | |
let g:ctrlp_custom_ignore = { | |
\ 'dir': '\v[\/]\.(git|hg|svn)$', | |
\ 'file': '\v\.(exe|so|dll)$', | |
\ 'link': 'some_bad_symbolic_links', | |
\ } | |
let g:ctrlp_user_command = ['.git', 'cd %s && git ls-files -co --exclude-standard'] | |
" Plug 'mileszs/ack.vim' | |
let g:ackprg = 'ag --vimgrep' | |
" Plug 'easymotion/vim-easymotion' | |
" Disable default mappings | |
let g:EasyMotion_do_mapping = 0 | |
" Jump to anywhere you want with minimal keystrokes, with just one key binding. | |
nmap s <Plug>(easymotion-overwin-f) | |
" Turn on case insensitive feature | |
let g:EasyMotion_smartcase = 1 | |
" JK motions: Line motions | |
map <Leader>j <Plug>(easymotion-j) | |
map <Leader>k <Plug>(easymotion-k) | |
" Plug 'Valloric/YouCompleteMe' | |
let g:ycm_confirm_extra_conf = 0 | |
nnoremap <leader>jd :YcmCompleter GoTo<CR> | |
" Plug Configurations (END) | |
" ============================================================================== | |
" Temporary fix for airline status bar not showing webdevicons | |
" https://github.com/ryanoasis/vim-devicons/issues/175 | |
" ============================================================================== | |
function! AirlineWebDevIcons(...) | |
let w:airline_section_x = get(w:, 'airline_section_x', g:airline_section_x) | |
let w:airline_section_x .= ' %{WebDevIconsGetFileTypeSymbol()} ' | |
if g:webdevicons_enable_airline_statusline_fileformat_symbols | |
let w:airline_section_y = ' %{&fenc . " " . WebDevIconsGetFileFormatSymbol()} ' | |
endif | |
endfunction | |
call airline#add_statusline_func('AirlineWebDevIcons') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment