-
Notifications
You must be signed in to change notification settings - Fork 0
/
.vimrc
105 lines (101 loc) · 2.46 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
" APPEARANCE
" Syntax
syntax on
" Default colors
colorscheme monokai_pro
set background=dark
" Line number settings
set number
set ruler
" Column delimiter settings
set colorcolumn=80
" Italic comments
highlight Comment cterm=italic gui=italic
" Force black background
"highlight Normal guibg=black guifg=white
"set background=dark
" Theme toggle function
let g:LightTheme = 0
function! ToggleTheme()
if g:LightTheme
let g:LightTheme = 0
colorscheme monokai_pro
set background=dark
else
let g:LightTheme = 1
colorscheme PaperColor
set background=light
endif
endfunction
map <F8> :call ToggleTheme()<CR>
" BEHAVIOUR
" Space tab settings
filetype indent plugin on
set tabstop=8 softtabstop=0 expandtab shiftwidth=4 smarttab
" Change tab bindings (alt+j/alt+k)
execute "set <M-j>=\ej"
execute "set <M-k>=\ek"
nnoremap <M-j> :tabp<CR>
nnoremap <M-k> :tabn<CR>
" Is this a good way of exiting?
imap <C-[> <ESC><ESC>
" Auto-close brackets
inoremap ( ()<left>
inoremap [ []<left>
inoremap { {}<left>
inoremap <expr> )
\strpart(getline('.'), col('.')-1, 1) == ")" ? "\<Right>" : ")"
inoremap <expr> ]
\strpart(getline('.'), col('.')-1, 1) == "]" ? "\<Right>" : "]"
inoremap <expr> }
\strpart(getline('.'), col('.')-1, 1) == "}" ? "\<Right>" : "}"
inoremap <expr> "
\strpart(getline('.'), col('.')-1, 1) == "\"" ? "\<Right>" : "\"\"\<Left>"
inoremap <expr> '
\strpart(getline('.'), col('.')-1, 1) == "\'" ? "\<Right>" : "\'\'\<Left>"
" Fix pasting from other application
set pastetoggle=<F2>
" Other
set nowb
set mouse=a
set showcmd
set hlsearch
set nobackup
set incsearch
set smartcase
set noswapfile
set smartindent
set noerrorbells
" NETRW (file menu)
" Appearance
let g:netrw_liststyle = 3
let g:netrw_banner = 0
let g:netrw_browse_split = 3
let g:netrw_winsize = 25
" Netrw toggle function
let g:NetrwIsOpen = 0
function! ToggleNetrw()
if g:NetrwIsOpen
let i = bufnr("$")
while (i >= 1)
if (getbufvar(i, "&filetype") == "netrw")
silent exe "bwipeout " . i
endif
let i-=1
endwhile
let g:NetrwIsOpen=0
else
let g:NetrwIsOpen=1
silent Lexplore
endif
endfunction
map <C-Bslash> :call ToggleNetrw()<CR>
" NOTES
" Find string in files
" :vim foo **/*.js | copen ()
"
" Move current tab to [i]
" :tabm [i]
"
" Filetype specific identation
" set Filetype [TYPE] tabstop=8 softtabstop=0 expandtab shiftwidth=4 smarttab