-
Notifications
You must be signed in to change notification settings - Fork 0
/
vimrc
137 lines (106 loc) · 4.15 KB
/
vimrc
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
132
133
134
135
136
137
" vim: set cc=80:
"
" NOTE: http://marcgg.com/blog/2016/03/01/vimrc-example
" NOTE: https://github.com/sd65/MiniVim
" NOTE: Bitbake has a set of files that can be used goto bitbake/contrib/vim
" NOTE: this one is really good !
" http://stevelosh.com/blog/2010/09/coming-home-to-vim/
" Navigation: http://vim.wikia.com/wiki/All_the_right_moves
nmap <silent> <C-k> :wincmd k<CR>
nmap <silent> <C-j> :wincmd j<CR>
nmap <silent> <C-h> :wincmd h<CR>
nmap <silent> <C-l> :wincmd l<CR>
" Fix most common typos
abbr Wq wq
abbr Q q
abbr W w
" General settings
syntax on " Enable syntax highlighting
colorscheme lvbdark " Use custom colorscheme
set mouse=a " Enable mouse all the time
set scrolloff=7 " Set minimal number of lines above and below the cursor
set ruler " Always show line and column of the cursor position
set cursorline " Highlight cursor line
" set cursorcolumn " Highlight cursor column
set clipboard=unnamedplus
set pastetoggle=<leader>p
set ttyfast " Set fast tty
set ttymouse=xterm2 " Fix unable to resize window in tmux
let &showbreak="\u21aa " " Show a left arrow when wrapping text
set showmatch " When a bracket is inserted, briefly jump to the matching one
set matchtime=3 " ... during this time
set guifont=Terminess\ Powerline\ 10
" Allow project specific vimrc files
set exrc
set secure
" Configure backspace so it acts as it should act
set backspace=eol,start,indent
set whichwrap+=<,>,h,l
" Add leader to have more combinations
let mapleader='\' " default is to \
let g:mapleader='\'
" Auto complete
set wildmenu " Enalbing better command-line completion
set wildmode=longest,list " Set command-line completion options
set completeopt=menu,longest " Set insert-mode completion options
" Swapfiles
set updatetime=1000 " Save swapfile to disk every 1000ms
set dir=~/.cache
set wildignore+=*.o,*.pyc
" Search
set hlsearch " Highlight found words
set incsearch " Set incremental search
set nowrapscan " Do not wrap arround
" Tab control
set noexpandtab " insert tabs rather than spaces for <Tab>
set smarttab " tab respects 'tabstop', 'shiftwidth', and 'softtabstop'
set tabstop=8 " the visible width of tabs
set softtabstop=8 " edit as if the tabs are 8 characters wide
set shiftwidth=8 " number of spaces to use for indent and unindent
set shiftround " round indent to a multiple of 'shiftwidth'
set smartindent " Smart indent...
set autoindent " indent on new lines
let g:pyindent_open_paren=4
" Encoding
set encoding=utf-8 " The encoding displayed.
set fileencoding=utf-8 " The encoding written to file.
" Spell check
set spelllang=en
set spellfile=~/.vim/spell/en.utf-8.add
" Case Sensitivity
set ignorecase " Ignore case in search patterns
set smartcase " override ignorecase if search pattern contains upper case chars
" Prevent lag when hitting escape
set ttimeoutlen=0
set timeoutlen=1000
au InsertEnter * set timeout
au InsertLeave * set notimeout
" Custom commands
" delete all eol whitespaces
command! Nws execute "%s/\\s\\+$//g | noh"
" include other files
execute 'runtime!' 'plugin/airline.vim'
execute 'runtime!' 'plugin/plugins.vim'
execute 'runtime!' 'plugin/remap.vim'
" file type specific options
autocmd FileType sh,bash setlocal tabstop=4 softtabstop=4 shiftwidth=4 noexpandtab
autocmd FileType c,cpp,h setlocal tabstop=8 softtabstop=8 shiftwidth=8 noexpandtab
autocmd FileType py,python setlocal tabstop=4 softtabstop=4 shiftwidth=4 expandtab
autocmd FileType rst,meson setlocal tabstop=4 softtabstop=4 shiftwidth=4 expandtab cc=80 tw=80
autocmd FileType yaml setlocal tabstop=2 softtabstop=2 shiftwidth=2 expandtab cc=80 tw=80
autocmd FileType gitcommit setlocal spell
autocmd FileType diff setlocal ft=gitsendemail
autocmd BufRead *defconfig setlocal ft=config
if exists('vimpager')
if !exists('g:vimpager')
let g:vimpager = {}
endif
if !exists('g:less')
let g:less = {}
endif
let g:less.enabled = 0
set readonly
autocmd FileType man set laststatus=0
highlight LessStatusLine ctermbg=NONE ctermfg=DarkMagenta guibg=NONE guifg=DarkMagenta
nnoremap <nowait> <silent> <buffer> q :qa<CR>
endif