dotfiles

Config files from my daily system
Index Commits Files Refs README
.vimrc (3813B)
   1     source    ~/.config/vim/autoload/plug.vim
   2     call plug#begin('~/.config/vim/plugged')
   3     
   4     " Plug 'flw-cn/vim-nerdtree-l-open-h-close'
   5     Plug 'christoomey/vim-tmux-navigator'
   6     Plug 'justinmk/vim-syntax-extra'
   7     Plug 'tpope/vim-commentary'
   8     Plug 'tpope/vim-surround'
   9     Plug 'jiangmiao/auto-pairs'
  10     Plug 'preservim/nerdtree'
  11     Plug 'morhetz/gruvbox'
  12     Plug 'alvan/vim-closetag'
  13     Plug 'hankchiutw/nerdtree-ranger.vim'
  14 
  15     call plug#end()
  16 
  17 " Basic settings
  18     syntax on
  19     set nocompatible
  20     set encoding=utf-8
  21     set tabstop=4
  22     set shiftwidth=4
  23     set viminfo+=n~/.config/vim/viminfo
  24     set path+=./**
  25     set incsearch
  26     set smartcase
  27     set smartindent
  28     set number
  29     set cursorline
  30     set relativenumber
  31     set ruler
  32     set mouse+=a
  33     if &term =~ 'xterm-256color'
  34         " tmux knows the extended mouse mode
  35         set ttymouse=xterm2
  36     endif
  37 
  38     set undofile
  39     set undodir=~/.config/vim/undodir
  40     set clipboard=unnamedplus
  41     set nobackup
  42     set nowritebackup
  43     set noswapfile
  44     " set noshowmode
  45     set backupdir=~/.config/vim/tmp/backup
  46 
  47     " This fixs the delay in the cursor shape when switching mode
  48     set ttimeout
  49     set ttimeoutlen=1
  50     set listchars=tab:>-,trail:~,extends:>,precedes:<,space:.
  51     set ttyfast
  52     set scrolloff=5
  53 
  54 " Keys remap
  55     let mapleader = ' '
  56 
  57     " Open file tree;
  58     map <leader>f :NERDTreeToggle<CR>
  59 
  60     " Focus file tree;
  61     map <leader>F :NERDTreeFocus<CR>
  62 
  63     " Open current dir in NERDTree
  64     map <leader>r :NERDTreeFind<CR>
  65 
  66     " Toggle Goyo
  67     map <leader>g :Goyo<CR>
  68 
  69     " Disable ex-mode keybinding (type visual thing)
  70     map Q <NOP>
  71 
  72     " Improves indenting chunks of code with '<' '>' keys
  73     vnoremap < <gv
  74     vnoremap > >gv
  75 
  76     " Move between windows with Ctrl + hjkl
  77     noremap <C-h> <C-w>h
  78     noremap <C-j> <C-w>j
  79     noremap <C-k> <C-w>k
  80     noremap <C-l> <C-w>l    
  81 
  82     " Change cursor shape with modes
  83     " if exists('$TMUX')
  84     "     let &t_SI = "\<Esc>Ptmux;\<Esc>\<Esc>[6 q\<Esc>\\"
  85     "     let &t_SR = "\<Esc>Ptmux;\<Esc>\<Esc>[4 q\<Esc>\\"
  86     "     let &t_EI = "\<Esc>Ptmux;\<Esc>\<Esc>[2 q\<Esc>\\"
  87     "     autocmd VimLeave * silent !echo -ne "\033Ptmux;\033\033[0 q\033\\"
  88     " else
  89     "     let &t_SI = "\<Esc>[6 q"
  90     "     let &t_SR = "\<Esc>[4 q"
  91     "     let &t_EI = "\<Esc>[2 q"
  92     " endif    
  93     
  94 " Enable blinking together with different cursor shapes for insert/command mode, and cursor highlighting:
  95     let &t_SI = "\<Esc>[5 q"
  96     let &t_SR = "\<Esc>[3 q"
  97     let &t_EI = "\<Esc>[1 q"
  98 
  99     " NetRW config
 100     let g:netrw_banner=0
 101     let g:netrw_winsize = 25
 102     let g:netrw_browse_split=2
 103     let g:netrw_altv=1
 104     let g:netrw_liststyle=3
 105     let g:netrwJ_list_hide=netrw_gitignore#Hide()
 106     let g:netrw_dirhistmax = 0    " Disable history
 107 
 108     " Goyo settings
 109     let g:goyo_linenr = 1
 110     let g:goyo_width = 100
 111     let g:goyo_height = 100
 112     autocmd! User GoyoLeave
 113 
 114     " Exit Vim if NERDTree is the only window remaining in the only tab.
 115     autocmd BufEnter * if tabpagenr('$') == 1 && winnr('$') == 1 && exists('b:NERDTree') && b:NERDTree.isTabTree() | quit | endif
 116 
 117     " This fixes the cursor shape at vim start
 118     normal! i
 119 
 120     " Set colorscheme and transparent background
 121     let g:gruvbox_transparent_bg = '1'
 122     let g:gruvbox_contrast_dark = 'hard'
 123     set bg=dark
 124 
 125     colorscheme gruvbox
 126     " colorscheme dracula
 127 
 128     function! AdaptColorscheme()
 129         hi clear CursorLine
 130         hi Normal guibg=NONE ctermbg=NONE
 131         hi LineNr guibg=NONE ctermbg=NONE
 132         hi Folded guibg=NONE ctermbg=NONE
 133         " hi EndOfBuffer guibg=NONE ctermbg=NONE
 134         hi EndOfBuffer ctermfg=12 guibg=NONE ctermbg=NONE
 135         hi SpecialKey guibg=NONE ctermbg=NONE
 136         hi VertSplit guibg=NONE ctermbg=NONE
 137         hi SignColumn guibg=NONE ctermbg=NONE
 138 
 139         hi TabLineSel ctermfg=LightGreen ctermbg=NONE
 140         hi TabLineFill ctermfg=Gray ctermbg=NONE
 141         hi Title ctermfg=LightBlue ctermbg=NONE
 142 
 143         hi CursorLine cterm=NONE ctermbg=235
 144     endfunction
 145 
 146     call AdaptColorscheme()
 147 
 148     " Set the split window separator (not the pipe char)
 149     set fillchars+=vert:\▏
 150     highlight VertSplit cterm=NONE
 151 
 152 
 153     autocmd! User GoyoLeave call AdaptColorscheme()