-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathvimrc
83 lines (62 loc) · 2.92 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
" server vim config
set nocompatible " full vim
syntax enable " enable syntax highlighting
set encoding=utf8 " utf8 default encoding
noremap , \
set scrolloff=3 " show 3 lines of context around the cursor
set autoread " set to auto read when a file is changed from the outside
set autowrite
set showcmd " show typed commands
set wildmenu " turn on WiLd menu
set wildmode=list:longest,list:full " activate TAB auto-completion for file paths
set wildignore+=*.o,.git,.svn
set ruler " always show current position
set backspace=indent,eol,start " set backspace config, backspace as normal
set hlsearch " highlight search things
set incsearch " go to search results as typing
set smartcase " but case-sensitive if expression contains a capital letter.
set ignorecase " ignore case when searching
set gdefault " assume global when searching or substituting
set magic " set magic on, for regular expressions
set showmatch " show matching brackets when text indicator is over them
set lazyredraw " don't redraw screen during macros, faster
set ttyfast " improves redrawing for newer computers
set fileformats=unix,mac,dos
set nobackup " prevent backups of files, since using vcs
set nowritebackup
set noswapfile
set shiftwidth=2 " set tab width
set softtabstop=2
set tabstop=2
set smarttab
set expandtab " use spaces, not tabs
set autoindent " set automatic code indentation
set hidden " allow background buffers w/out writing
set nowrap " don't wrap lines
set list " show hidden characters
set listchars=tab:\ \ ,trail:· " show · for trailing space, \ \ for trailing tab
set laststatus=2 " always hide the last status
" map Y to match C and D behavior
nnoremap Y y$
" ignore lines when going up or down
nnoremap j gj
nnoremap k gk
" auto complete {} indent and position the cursor in the middle line
inoremap {<CR> {<CR>}<Esc>O
inoremap (<CR> (<CR>)<Esc>O
inoremap [<CR> [<CR>]<Esc>O
" cycle between buffers
map <leader>. :b#<cr>
" indent visual selected code without unselecting and going back to normal mode
vmap > >gv
vmap < <gv
" clear highlight
nnoremap <leader><space> :noh<cr>
" allow saving when you forgot sudo
cmap w!! w !sudo tee % >/dev/null
" open in last edit place
au BufReadPost * if line("'\"") > 0 && line("'\"") <= line("$") | exe "normal g'\"" | endif
au QuickFixCmdPost *grep* cwindow
let g:netrw_liststyle=3 " use tree style for netrw
" python
au FileType python set noexpandtab