-
Notifications
You must be signed in to change notification settings - Fork 1
/
vimrc
145 lines (111 loc) · 2.97 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
138
139
140
141
142
143
144
145
set nocompatible " be iMproved
filetype off " required!
" includes
source ~/.vim/config/plugins.vim
"
"common
"
" Use filetype plugins, e.g. for PHP
filetype plugin on
let mapleader = ","
let maplocalleader = ","
" %% maps to current directory
cnoremap %% <C-R>=expand('%:h').'/'<cr>
" hide gutter
map <Leader>h :sign unplace *<CR>
" remove trailing whitespace
autocmd BufWritePre * :%s/\s\+$//e
" folding toggle to space
nnoremap <Space> za
vnoremap <Space> za
" Set colors
if v:version >= 800
set termguicolors
else
set t_Co=256
endif
" clearing uses background color
" important if running in tmux and
" them bg color differs from terminal bg color
set t_ut=
let g:CSApprox_attr_map = { 'bold' : 'bold', 'italic' : '', 'sp' : '' }
colorscheme nord
syntax enable
set synmaxcol=400 " only syntax highlight shorter lines (major performance impact) - e.g. excludes giant js, xml, ... file containing one line only
set lazyredraw " performance
set nopaste
set ignorecase
set smartcase
set hlsearch
set encoding=utf-8
" display filename
set modeline
set ls=2
" file autocomplete
set wildmenu
set wildmode=list:longest
set pastetoggle=<F2>
set cursorline
" automatically reindent on vim paste
nnoremap <silent><Leader>p p=`]
nnoremap <silent><Leader>P P=`]
" modify files when changing instead of overwriting them
" important e.g. for webpack watch, sass, nfs, ...
set backupcopy=yes
set tags+=.tags,.tags-src,.tags-vendors
" open reference in new tab
nnoremap <silent><Leader><C-]> <C-w><C-]><C-w>T
" backup files not needed
set nobackup
set nowritebackup
set noswapfile
set number
set linebreak breakindent breakindentopt=shift:-2
command XmlFormat %!xmllint --format -
"
" indentation
"
filetype indent on
set autoindent
set tabstop=4
set shiftwidth=4
set softtabstop=4
set expandtab
let g:html_indent_inctags = "html,body,head,tbody"
let g:html_indent_script1 = "inc"
let g:html_indent_style1 = "inc"
"
" folding
"
set foldenable
set foldlevel=99
set foldnestmax=4
set foldmethod=indent
" Create directory on save if it does not exist
" http://stackoverflow.com/questions/4292733/vim-creating-parent-directories-on-save
augroup BWCCreateDir
au!
autocmd BufWritePre * if expand("<afile>")!~#'^\w\+:/' && !isdirectory(expand("%:h")) | execute "silent! !mkdir -p ".shellescape(expand('%:h'), 1) | redraw! | endif
augroup END
"
"fzf
"
nnoremap ; :Buffers<CR>
nnoremap <leader>f :Files<CR>
nnoremap <leader>fg :GitFiles<CR>
nnoremap <leader>ft :Tags<CR>
nmap <leader>fw :call fzf#vim#files('', {'options': '-q '.shellescape(expand('<cword>'))})<CR>
command FZFPreview :call fzf#vim#gitfiles('', fzf#vim#with_preview('right'))
"
" airline
"
let g:airline#extensions#tabline#enabled = 1
let g:airline#extensions#branch#enabled = 1
let g:airline#extensions#tabline#show_buffers = 0
let g:Powerline_symbols='fancy'
let g:airline_powerline_fonts = 1
let g:airline_theme='nord'
source ~/.vim/config/script.rename.vim
if filereadable(expand("~/.vimrc.local"))
source ~/.vimrc.local
endif