forked from prakash09/vimrc
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.vimrc
150 lines (101 loc) · 3.47 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
" set nocompatible
filetype plugin on
filetype on
" Automatic reloading of .vimrc
autocmd! bufwritepost .vimrc source %
:set laststatus=2
" Better copy & paste
" When you want to paste large blocks of code into vim, press F2 before you
" paste. At the bottom you should see ``-- INSERT (paste) --``.
set pastetoggle=<F2>
set clipboard=unnamedplus
:set guioptions-=m "remove menu bar
:set guioptions-=T "remove toolbar
:set guioptions-=r "remove right-hand scroll bar
:set guioptions-=L "remove left-hand scroll bar
set noswapfile
" Mouse and backspace
" set mouse=a " on OSX press ALT and click
" set bs=2 " make backspace behave like normal again
" Rebind <Leader> key
" I like to have it here becuase it is easier to reach than the default and
" it is next to ``m`` and ``n`` which I use for navigating between tabs.
let mapleader = ","
" bind Ctrl+<movement> keys to move aroClassNameund the windows, instead of using Ctrl+w + <movement>
" Every unnecessary keystroke that can be saved is good for your health :)
map <c-j> <c-w>j
map <c-k> <c-w>k
map <c-l> <c-w>l
map <c-h> <c-w>h
" easier moving of code blocks
" Try to go into visual mode (v), thenselect several lines of code here and
" then press ``>`` several times.
vnoremap < <gv " better indentation
vnoremap > >gv " better indentation
" Show whitespace
" MUST be inserted BEFORE the colorscheme command
autocmd ColorScheme * highlight ExtraWhitespace ctermbg=red guibg=red
au InsertLeave * match ExtraWhitespace /\s\+$/
"status line
:so ~/.vim/scripts/statusline.vim
" Showing line numbers and length
set number " show line numbers
set tw=79 " width of document (used by gd)
set nowrap " don't automatically wrap on load
set fo-=t " don't automatically wrap text when typing
set colorcolumn=80
highlight ColorColumn ctermbg=233
" easier formatting of paragraphs
vmap Q gq
nmap Q gqap
" Useful settings
set history=700
set undolevels=700
" Real programmers don't use TABs but spaces
set tabstop=4
set softtabstop=4
set shiftwidth=4
set shiftround
set expandtab
" Make search case insensitive
set hlsearch
set incsearch
set ignorecase
set smartcase
if exists("+undofile")
" undofile - This allows you to use undos after exiting and restarting
" This, like swap and backups, uses .vim-undo first, then ~/.vim/undo
" :help undo-persistence
" This is only present in 7.3+
if isdirectory($HOME . '/Documents/undo') == 0
:silent !mkdir -p ~/Documents/undo > /dev/null 2>&1
endif
set undodir=./.vim-undo//
set undodir+=~/Documents/undo//
set undofile
endif
autocmd InsertEnter * :set invrelativenumber | :set number
autocmd InsertLeave * :set relativenumber
" :map <F9> :!sh run.sh %
syntax on
" colorscheme black_angus
" colorscheme vividchalk
colorscheme vividchalk
filetype plugin indent on
map! jj <Esc> " map jj to Esc
set showcmd showmode fdm=indent noerrorbells
set nofoldenable "folds open by default
nnoremap <Space> za " for toggling folds in vim
execute pathogen#infect()
" showing function arguments
let g:jedi#show_call_signatures = "1"
set runtimepath^=~/.vim/bundle/ctrlp.vim
set guifont=Monospace\ 12
au Filetype cpp source ~/.vim/scripts/cpp.vim
au Filetype java source ~/.vim/scripts/cpp.vim
au Filetype python source ~/.vim/scripts/python.vim
" for opening jedi-vim's docstring window at the bottom of the screen
set splitbelow
:silent !~/.vim/esc_capslock_swap.sh off
au VimLeave * call system('~/.vim/esc_capslock_swap.sh on')
" au VimLeave * call system('')