-
Notifications
You must be signed in to change notification settings - Fork 0
/
vimrc
145 lines (124 loc) · 4.59 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
" vim: set ts=4 sw=4 expandtab:
" Use pathogen to easily modify the runtime path to include all plugins under
" the ~/.vim/bundle directory
filetype off " force reloading *after* pathogen loaded
call pathogen#infect()
call pathogen#helptags()
filetype plugin indent on " enable detection, plugins and indenting in one step
" change the mapleader from \ to ,
let mapleader=","
if v:lang =~ "utf8$" || v:lang =~ "UTF-8$"
set fileencodings=utf-8,latin1
endif
set nocompatible " Use Vim defaults (much better!)
set bs=2 " allow backspacing over everything in insert mode
set ai " always set autoindenting on
"set backup " keep a backup file
set viminfo='20,\"50 " read/write a .viminfo file, don't store more
" than 50 lines of registers
set history=1000 " keep 1000 lines of command line history
set undolevels=1000 " keep 1000 levels of undo history
set ruler " show the cursor position all the time
set linebreak " don't linebreak words
set nowrap " don't wrap lines at all
set laststatus=2 " always show the status line
set ts=2 " a tab-character should be represented as 4 spaces
set sw=2 " indent is 4 spaces
set expandtab " insert spaces instead of tabs
set sta " enable smart tab handling
set showmatch " show matching parenthesis etc
set number " show line numbers
set incsearch " incremental search
set scrolloff=8 " have cursor 8 lines from top or bottom when scrollnig
set wildmenu " show menu when tab completing commands
set shiftround " round indent (using > and <) to multiple of 'shiftwidth'
set wildignore=*.o,*.obj,*.class,.git,.svn
set ww=<,>,[,],b,s
set clipboard^=unnamedplus " use regular clipboard as default register
" Only do this part when compiled with support for autocommands
if has("autocmd")
" In text files, always limit the width of text to 78 characters
autocmd BufRead *.txt set tw=78
" When editing a file, always jump to the last cursor position
autocmd BufReadPost *
\ if line("'\"") > 0 && line ("'\"") <= line("$") |
\ exe "normal g'\"" |
\ endif
endif
" Switch syntax highlighting on, when the terminal has colors
" Also switch on highlighting the last used search pattern.
if &t_Co > 2 || has("gui_running")
syntax on
set hlsearch
endif
if &term=="xterm"
set t_Co=8
set t_Sb=[4%dm
set t_Sf=[3%dm
endif
" Set colorscheme
if &t_Co >= 256
colorscheme mustang
set cursorline
else
colorscheme desert
endif
" Reset SignColumn in case colorscheme changed it
highlight clear SignColumn
" Configure tags
set tags=./tags;/
map <A-]> :vsp <CR>:wincmd w<CR>:exec("tag ".expand("<cword>"))<CR>
" Clear status line
set statusline=
" Truncation point (%<), filename (%f), help mode (%h), modified (%m), readonly (%r)
set statusline+=%<%f\ %h%m%r
" Left/right alignment separator
set statusline+=%=
" Paste mode
set statusline+=%{&paste?'PASTE\ ':''}
" File format information (newline format, encoding, unicode byte order mark)
set statusline+=%{'['.&fileformat.',\ '.(&fenc==''?&enc:&fenc).((exists('+bomb')\ &&\ &bomb)?',B':'').']\ '}
" Line (%l), column (%c), virtual column (%V), percentage through file (%P)
set statusline+=%-13.(%l,%c%V%)\ %P
" Prevent the Perforce plugin to mess with the statusbar
let g:p4EnableActiveStatus = 0
" localvimrc should not ask before loading a .lvimrc
let g:localvimrc_ask = 0
" allow 30000 files for command-t
let g:CommandTMaxFiles = 30000
" tell ack where to find the ack command
let g:ackprg="ack-grep -H --nocolor --nogroup --column"
" always show sign column in git repos
let g:gitgutter_sign_column_always = 1
" Misc keybindings
nmap <silent> <leader>/ :nohlsearch<CR> " hide current search matches
nmap <leader>u :GundoToggle<CR> " toggle gundo window
nmap <A-Left> <C-O> " jump back
nmap <A-Right> <C-I> " jump forward
nmap <C-P> :FZF<CR>
" Toggle paste mode
function! TogglePaste()
if &paste
set nopaste
else
set paste
endif
endfunction
nnoremap <leader>pp :call TogglePaste()<CR>
" Vertical movement in wrapped lines
nnoremap k gk
nnoremap j gj
nnoremap <Up> gk
inoremap <Up> <C-O>gk
nnoremap <Down> gj
inoremap <Down> <C-O>gj
" Invisible characters
nmap <leader>l :set list!<CR>
set listchars=tab:▸\ ,eol:¬
" Repeat last action in visual mode
vnoremap . :norm.<CR>
" Easier split navigations
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>