-
Notifications
You must be signed in to change notification settings - Fork 0
/
.vimrc
159 lines (158 loc) · 4.49 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
146
147
148
149
150
151
152
153
154
155
156
157
158
159
"use vim settings instead of vi
if &compatible
set nocompatible
endif
filetype off
"color scheme
colors drosile
set background=dark
set scrolloff=2
set showmatch
set showmode
set showcmd
set ruler
set title
set wildmenu
set wildignore=*.o,*.obj,*.bak,*.exe,*.py[co],*.swp,*~,*.pyc,.svn
set laststatus=2
set matchtime=2
set matchpairs+=<:>
"editor settings
set esckeys
set ignorecase
set smartcase
set smarttab
set magic
set bs=indent,eol,start
set tabstop=2
set shiftwidth=2
set expandtab
set fileformat=unix
"system settings
set lazyredraw
set confirm
set nobackup
set viminfo='20,\"500,:20,%,n~/.viminfo
set hidden
set history=50
set mouse=v
set foldmethod=indent
set foldnestmax=2
set foldminlines=8
xnoremap "+y y:call system("wl-copy", @")<cr>
nnoremap <space> za
vnoremap <space> zf
highlight RedundantWhitespace ctermbg=red guibg=red
match RedundantWhitespace /\s\+$/
"highlight HardTabs ctermbg=red guibg=red
"match HardTabs /\t/
"match Error /\s\+$\|\t/
match Error /\s\+$/
set wildmode=longest,list,full
"color settings (if supported)
if &t_Co > 2 || has("gui_running")
syntax on
endif
set nohlsearch
set incsearch
"NERDtree
nnoremap <Leader>f :NERDTreeToggle<Enter>
nnoremap <silent> <Leader>v :NERDTreeFind<CR>
let NERDTreeQuitOnOpen = 1
let NERDTreeAutoDeleteBuffer = 1
let NERDTreeMinimalUI = 1
let NERDTreeDirArrows = 1
let NERDTreeMapActivateMode = '<space>'
"jj exit insert mode
inoremap jj <Esc>
"jk exit insert mode
inoremap jk <Esc>
nnoremap JJJJ <Nop>
"slimux bindings
map <C-c><C-c> :SlimuxREPLSendLine<CR>
vmap <C-c><C-c> :SlimuxREPLSendSelection<CR>
"clipboard
let g:clipbrdDefaultReg = '+'
"close a tab, remove buffer
set nohidden
highlight MatchParen ctermbg=4
"paste mode toggle
map <F10> :set paste<CR>
map <F11> :set nopaste<CR>
imap <F10> <C-O>:set paste<CR>
imap <F11> <nop>
set pastetoggle=<F11>
filetype plugin indent on
if has("autocmd")
let bash_is_sh=1
"change to directory of current file automatically
autocmd BufEnter * lcd %:p:h
augroup mysettings
au FileType xsit,xml,css,html,xhtml,javascript,sh,config,c,cpp,docbook set smartindent shiftwidth=4 softtabstop=4 expandtab
au FileType tex set wrap shiftwidth=2 softtabstop=2 expandtab
au FileType python set tabstop=4 softtabstop=4 expandtab shiftwidth=4 cinwords=if,elif,else,for,while,try,except,finally,def,class
au FileType python set colorcolumn=80
au FileType javascript,ruby set tabstop=2 softtabstop=2 shiftwidth=2 colorcolumn=90
augroup END
autocmd BufReadPost *
\ if line("'\''") > 0 && line("'\''") <= line("$") |
\ exe "normal g'\''" |
\ endif
" restore cursor to previous position on file open
function! ResCur()
if line("'\"") <= line("$")
normal! g`"
return 1
endif
endfunction
augroup resCur
autocmd!
autocmd BufWinEnter * call ResCur()
augroup END
autocmd FileType * let b:comment = "#"
autocmd FileType asm let b:comment = ";"
autocmd FileType nasm let b:comment = ";"
autocmd FileType vim let b:comment = "\""
autocmd FileType c let b:comment = "\/\/"
autocmd FileType cc let b:comment = "\/\/"
autocmd FileType cpp let b:comment = "\/\/"
autocmd FileType js let b:comment = "\/\/"
autocmd FileType jsx let b:comment = "\/\/"
"block commenting; - to comment, _ to uncomment
nmap <expr> - AddComment()
nmap <expr> _ RemoveComment()
vmap <expr> - AddComment()
vmap <expr> _ RemoveComment()
func AddComment()
return ':s/^\(\s*\)/\1' . b:comment . "/\r:nohl\r"
endfunc
func RemoveComment()
return ':s/^\(\s*\)' . b:comment . "/\\1/\r:nohl\r"
endfunc
endif
map Q gq
set shiftround
"plugin-specific options
au VimEnter * RainbowParenthesesToggle
au Syntax * RainbowParenthesesLoadRound
au Syntax * RainbowParenthesesLoadSquare
au Syntax * RainbowParenthesesLoadBraces
let g:rbpt_colorpairs = [
\ ['brown', 'RoyalBlue3'],
\ ['Darkblue', 'SeaGreen3'],
\ ['darkgray', 'DarkOrchid3'],
\ ['darkgreen', 'firebrick3'],
\ ['darkcyan', 'RoyalBlue3'],
\ ['darkred', 'SeaGreen3'],
\ ['darkmagenta', 'DarkOrchid3'],
\ ['brown', 'firebrick3'],
\ ['gray', 'RoyalBlue3'],
\ ['darkmagenta', 'DarkOrchid3'],
\ ['Darkblue', 'firebrick3'],
\ ['darkgreen', 'RoyalBlue3'],
\ ['darkcyan', 'SeaGreen3'],
\ ['darkred', 'DarkOrchid3'],
\ ['red', 'firebrick3'],
\ ]
let g:syntastic_mode_map = {
\ "mode": "passive" }