-
Notifications
You must be signed in to change notification settings - Fork 1
/
.vimrc
119 lines (96 loc) · 2.96 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
" general config
call pathogen#infect()
call pathogen#helptags()
set t_Co=256
colorscheme molokai
" Clear filetype flags before changing runtimepath to force
" Vim to reload them
filetype off
filetype plugin indent off
set runtimepath+=$GOROOT/misc/vim
syntax on
filetype plugin indent on
let mapleader=","
set tabstop=4
set shiftwidth=4
set expandtab
" show a visual line under the cursor's current line
set cursorline
" show the matching part of the pair for [] {} and ()
set showmatch
" auto strip trailing whitespaces
fun! <SID>StripTrailingWhitespaces()
let l = line(".")
let c = col(".")
%s/\s\+$//e
call cursor(l, c)
endfun
autocmd FileType c,cpp,java,php,ruby,python autocmd BufWritePre <buffer> :call <SID>StripTrailingWhitespaces()
" powerline stuff
set laststatus=2
" Ctrl-P stuff
:let g:ctrlp_map = '<Leader>t'
:let g:ctrlp_match_window_bottom = 0
:let g:ctrlp_match_window_reversed = 0
:let g:ctrlp_custom_ignore = '\v\~$|\.(o|swp|pyc|wav|mp3|ogg|blend)$|(^|[/\\])\.(hg|git|bzr)($|[/\\])|__init__\.py'
:let g:ctrlp_working_path_mode = 0
:let g:ctrlp_dotfiles = 0
:let g:ctrlp_switch_buffer = 0
" plugins key mapping
nmap <F8> :TagbarToggle<CR>
nmap ; :CtrlPBuffer<CR>
nmap <Leader>e :NERDTreeToggle<CR>
" key mappings
nmap j gj
nmap k gk
nmap <C-n> :bnext<CR>
nmap <C-p> :bprev<CR>
nmap <Leader>l :setlocal number!<CR>
nmap <Leader>o :set paste!<CR>
nmap <Leader>r :set relativenumber!<CR>
:imap jj <Esc>
nmap \t :set expandtab tabstop=4 shiftwidth=4 softtabstop=4<CR>
nmap \T :set expandtab tabstop=8 shiftwidth=8 softtabstop=4<CR>
nmap \M :set noexpandtab tabstop=8 softtabstop=4 shiftwidth=4<CR>
nmap \m :set expandtab tabstop=2 shiftwidth=2 softtabstop=2<CR>
cnoremap <C-a> <Home>
cnoremap <C-b> <Left>
cnoremap <C-f> <Right>
cnoremap <C-d> <Delete>
cnoremap <M-b> <S-Left>
cnoremap <M-f> <S-Right>
cnoremap <M-d> <S-right><Delete>
cnoremap <Esc>b <S-Left>
cnoremap <Esc>f <S-Right>
cnoremap <Esc>d <S-right><Delete>
cnoremap <C-g> <C-c>
" search
set incsearch
set ignorecase
set smartcase
set hlsearch
nmap <Leader>q :nohlsearch<CR>
nmap <F7> :% !xmllint % --format --recover 2>/dev/null<CR>
" -----------------------------------------------------------------------------
" language specifics
" -----------------------------------------------------------------------------
" javascript
let g:javascript_enable_domhtmlcss = 1
" python
autocmd FileType python set sw=4
autocmd FileType python set ts=4
autocmd FileType python set sts=4
autocmd FileType python set autoindent
autocmd FileType python set smartindent
autocmd FileType python nnoremap <leader>y :0,$!yapf<Cr><C-o>
let python_highlight_all = 1
" markdown preview
let vim_markdown_preview_github=1
let vim_markdown_preview_hotkey='<C-m>'
" surround helpers for markdown
" code bloc
autocmd FileType markdown let b:surround_{char2nr('-')} = "```\n\r\n```"
" italic
autocmd FileType markdown let b:surround_{char2nr('i')} = "*\r*"
" bold
autocmd FileType markdown let b:surround_{char2nr('b')} = "**\r**"