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
146
147
148
149
150
151
152
153
|
" Limit what can be done in the VIMRC
set secure
" Disable syntax for now
syntax off
set background=dark
set t_Co=0
" Set filetype detection on, so that Git and other systems have autowrap
filetype indent plugin on
" Set utf8 as standard encoding and en_US as the standard language
set encoding=utf8
" Use Unix as the standard file type
set ffs=unix,dos,mac
set colorcolumn=250 "Disable formatting past 250 chars
" Turn backup off, since most stuff is in SVN, git etc. anyway...
set nobackup
set nowb
set noswapfile
set shortmess+=I
" 1 tab == 8 spaces
set shiftwidth=8
set tabstop=8
set textwidth=120
set expandtab " Tabs to spaces
" Linebreak on textwidth characters
set lbr
set ai "Auto indent
set si "Smart indent
set wrap "Wrap lines
set shiftround " When shifting lines, round indentation to nearest shiftwidth
" Sets how many lines of history VIM has to remember
set history=100
" Set to auto read when a file is changed from the outside
set autoread
au FocusGained,BufEnter * checktime
" Set text-wrap to 72 chars
autocmd FileType text setlocal textwidth=72
autocmd FileType markdown setlocal textwidth=72
" Set 7 lines to the cursor - when moving vertically using j/k
set so=7
" Avoid garbled characters in Chinese language windows OS
let $LANG='en'
set langmenu=en
"Always show current position
set ruler
" Height of the command bar
set cmdheight=1
" A buffer becomes hidden when it is abandoned
set hid
" Configure backspace so it acts as it should act
set backspace=eol,start,indent
set whichwrap+=<,>,h,l
" Ignore case when searching
set ignorecase
" When searching try to be smart about cases
set smartcase
" Highlight search results
set hlsearch
" Makes search act like search in modern browsers
set incsearch
" Don't redraw while executing macros (good performance config)
set lazyredraw
" For regular expressions turn magic on
set magic
" No annoying sound on errors
set noerrorbells
set novisualbell
set t_vb=
set tm=500
" time waited for key press(es) to complete. It makes for a faster key response
set ttyfast
set ttimeout
set ttimeoutlen=50
" Properly disable sound on errors on MacVim
if has("gui_macvim")
autocmd GUIEnter * set vb t_vb=
endif
" Add a bit extra margin to the left
set foldcolumn=1
" new splits will be at the bottom or to the right side of the screen
set splitbelow
set splitright
set showcmd " Show previous commands
set showmode " Display NORMAL/INSERT/VISUAL mode below statusline
set number " We like line numbers
" Always show the status line
set laststatus=2
" Statusline definition
set statusline=
set statusline+=%7*\[%n] "buffernr
set statusline+=%1*\ %<%t\ "File+path
set statusline+=%3*\ %y\ "FileType
set statusline+=%4*\ %{''.(&fenc!=''?&fenc:&enc).''} "Encoding
set statusline+=%5*\ %{(&bomb?\",BOM\":\"\")}\ "Encoding2
set statusline+=%6*\ %{&ff}\ "FileFormat (dos/unix..)
set statusline+=%7*\ %=\ row:%l/%L\ (%03p%%)\ "Rownumber/total (%)
set statusline+=%9*\ col:%03c\ "Colnr
set statusline+=%0*\ %m%r%w\ "Modified? Readonly? Top/bot.
" Remove the Windows ^M - when the encodings gets messed up
noremap <Leader>m mmHmt:%s/<C-V><cr>//ge<cr>'tzt'm
" Toggle paste mode on and off
map <leader>pp :setlocal paste!<cr>
"set pastetoggle=<F2>
" Disable mouse automatic mode
set mouse-=a
" Enable line numbers toggle
noremap <leader>n :set invnumber<CR>
" Trim whitespace at end of lines
nnoremap <leader>s :%s/\s\+$//e<CR>
" Fix weird JSON quotation issue
let g:vim_json_syntax_conceal = 0
" Look for ctags files
set tags=tags
|