-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy path.vimrc
140 lines (116 loc) · 3.86 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
filetype off
" Let pathogen install plugins
execute pathogen#infect()
let mapleader=","
set shiftwidth=2
set backspace=2 " Backspace deletes like most programs in insert mode
set nobackup
set nowritebackup
set noswapfile " http://robots.thoughtbot.com/post/18739402579/global-gitignore#comment-458413287
set history=50
set ruler " show the cursor position all the time
set showcmd " display incomplete command
set incsearch " do incremental searching
set laststatus=2 " Always display the status line
set autowrite " Automatically :write before running commands
set autoread " Reload files changted outside vim
" Allow usage of mouse in iTerm
set ttyfast
set mouse=n
" set ttymouse=iterm2
" Softtabs, 2 spaces
set tabstop=2
set shiftwidth=2
set shiftround
set expandtab
" Display extra whitespace
" set list listchars=tab:»·,trail:·,nbsp:·
" Make it obvious where 80 characters is
set textwidth=80
" Numbers
set number
set numberwidth=5
" Scrolling
set scrolloff=8 "Start scrolling when we're 8 lines away from margins
set sidescrolloff=15
set sidescroll=1
"Toggle relative numbering, and set to absolute on loss of focus or insert
"mode
set rnu
function! ToggleNumbersOn()
set nu!
set rnu
endfunction
function! ToggleRelativeOn()
set rnu!
set nu
endfunction
autocmd FocusLost * call ToggleRelativeOn()
autocmd FocusGained * call ToggleRelativeOn()
autocmd InsertEnter * call ToggleRelativeOn()
autocmd InsertLeave * call ToggleRelativeOn()
" Syntactics
filetype plugin indent on
" Set the default theme to Monokai-Refined
set t_Co=256
syntax on
packadd! dracula
syntax enable
colorscheme dracula
" Toggle Nerdtree
map <C-n> :NERDTreeMirrorToggle<CR>
map <C-l> :tabn<CR>
map <C-h> :tabp<CR>
map <C-k> :tabnew<CR>
nmap <C-m> :NERDTreeFind<CR>
let g:nerdtree_tabs_smart_startup_focus = 0
let NERDTreeQuitOnOpen = 1
let g:NERDTreeShowHidden = 1
let NERDTreeDirArrows=0
" CtrlP
set runtimepath^=~/.vim/bundle/ctrlp.vim
" Airline
let g:airline#extensions#tabline#enabled = 1
let g:airline_theme='powerlineish'
" Allow NerdCommenter to execute in insert mode
imap <D-/> <esc>,c<space>
" Multiple Cursors
let g:multi_cursor_next_key='<C-g>'
let g:multi_cursor_prev_key='<C-p>'
let g:multi_cursor_skip_key='<C-x>'
let g:multi_cursor_quit_key='<Esc>'
" Paste properly without using :set paste
" http://superuser.com/questions/437730/always-use-set-paste-is-it-a-good-idea
function! WrapForTmux(s)
if !exists('$TMUX')
return a:s
endif
let tmux_start = "\<Esc>Ptmux;"
let tmux_end = "\<Esc>\\"
return tmux_start . substitute(a:s, "\<Esc>", "\<Esc>\<Esc>", 'g') . tmux_end
endfunction
let &t_SI .= WrapForTmux("\<Esc>[?2004h")
let &t_EI .= WrapForTmux("\<Esc>[?2004l")
function! XTermPasteBegin()
set pastetoggle=<Esc>[201~
set paste
return ""
endfunction
inoremap <special> <expr> <Esc>[200~ XTermPasteBegin()
" Added a debugger. type ,hi and get the actual vim highlight name
map ,hi :echo "hi<" . synIDattr(synID(line("."),col("."),1),"name") . '> trans<'
\ . synIDattr(synID(line("."),col("."),0),"name") . "> lo<"
\ . synIDattr(synIDtrans(synID(line("."),col("."),1)),"name") . ">"<CR>
" GitGutter
nmap <Leader>ha <Plug>GitGutterStageHunk
nmap <Leader>hr <Plug>GitGutterRevertHunk
"Code Folding
set foldmethod=indent "fold based on indent
set foldnestmax=10 "deepest fold is 10 levels
set nofoldenable "dont fold by default
set foldlevel=1 "this is just what i use
" Auto Remove white spaces
autocmd BufWritePre * %s/\s\+$//e
" Show hidden files in NERDTree
" https://stackoverflow.com/questions/5057359/how-can-i-show-hidden-files-starting-with-period-in-nerdtree#:~:text=Press%20I%20(%20Shift%20%2B%20i%20),in%20the%20NERDTree%20explorer%20window.&text=For%20more%20detail%2C%20access%20the,and%20search%20for%20%22hidden%22.&text=And%20to%20hide%20hidden%20files,NERDTreeShowHidden%3D0%20into%20your%20vimrc.
let NERDTreeShowHidden=1