1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
|
if &term =~# '^screen'
let &t_8f = "\<Esc>[38;2;%lu;%lu;%lum"
let &t_8b = "\<Esc>[48;2;%lu;%lu;%lum"
set termguicolors " overwrite terminal theme
endif
so $HOME/dotfiles/.pluggins.vim " source pluggins
let mapleader = ' '
syntax enable
set hidden
set noswapfile
set nocompatible
filetype plugin indent on " add specific rules for certain file type
set number relativenumber
" browse list with tab
set wildmode=longest,list,full
set wildmenu
set path+=** " for recursive :find
" more intuitif split opening
set splitbelow
set splitright
set fcs+=vert:\ " split separator
" easier split navigation
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>
" spit resizing
nnoremap zh <C-W>>
nnoremap zl <C-W><
nnoremap zj <C-W>-
nnoremap zk <C-W>+
" tab to space
set expandtab
set tabstop=4
set shiftwidth=4
set smarttab
set autoindent
set smartindent
" search
set ignorecase
set smartcase
set hlsearch
set incsearch
" other
set ruler
set laststatus=2 " always a statusline
set scrolloff=2 " 2 line above scroll
set showcmd
set cursorline " highlight current line
set noshowmode " unnecessary with status bar"
set autoread " reload files when changes happen outside vim
" where to place the .swp files
set backupdir=~/.vim-tmp,~/.tmp,~/tmp,~/var/tmp
set directory=~/.vim-tmp,~/.tmp,~/tmp,~/var/tmp
" directory to ignore when searching in file tree (works with ctrlp)
set wildignore=*/tmp/*,*.o,*.so,*.swp,*.zip,*/node_modules/*,*/vendor/*,.bundle/*,bin/*,.git/*
" ctrlp ignore all stuff in the .gitignore
let g:ctrlp_user_command = ['.git', 'cd %s && git ls-files -co --exclude-standard']
" ALE
highlight clear ALEErrorSign
highlight clear ALEWarningSign
let g:ale_sign_error = '>'
let g:ale_sign_warning = '-'
let g:ale_lint_on_text_changed = 'never'
let g:ale_lint_on_enter = 0
let g:ale_echo_msg_error_str = 'E'
let g:ale_echo_msg_warning_str = 'W'
let g:ale_echo_msg_format = '[%linter%] %s [%severity%]'
let g:ale_linters = {
\ 'python': ['flake8']
\ }
let g:ale_fixers = {
\ 'python': ['autopep8']
\ }
" let g:gruvbox_italic=1
let g:gruvbox_contrast_dark="hard"
colorscheme gruvbox
set background=dark
let g:lightline = {}
let g:lightline.colorscheme = 'jellybeans'
" let g:lightline.component_expand = {
" \ 'linter_checking': 'lightline#ale#checking',
" \ 'linter_warnings': 'lightline#ale#warnings',
" \ 'linter_errors': 'lightline#ale#errors',
" \ 'linter_ok': 'lightline#ale#ok',
" \ }
" let g:lightline.component_type = {
" \ 'linter_checking': 'left',
" \ 'linter_warnings': 'warning',
" \ 'linter_errors': 'error',
" \ 'linter_ok': 'left',
" \ }
" let g:lightline.active = { 'right': [[ 'linter_checking', 'linter_errors', 'linter_warnings', 'linter_ok' ]] }
let base16colorspace=256
" NERDTree shortcut
map <Leader>d :NERDTreeToggle<CR>
map <Leader>f :NERDTreeFocus<CR>
" Global copy and paste
vnoremap <C-l> "+y
noremap <C-m> "+P
" 'Y' yank to the end of the line
:noremap Y y$
" remove trailing white space on save
autocmd BufWritePre * %s/\s\+$//e
" solves annoying delay went exiting insert mode
imap <ESC> <C-C>
imap jj <ESC>
" remove visual mode keybinding
map Q <ESC>
" c source and header files comment formats for vim-commentary
" autocmd Filetype c setlocal commentstring=// %s
" autocmd Filetype h setlocal commentstring=// %s
set encoding=utf-8
set textwidth=89 " when line wrap occurs
|