-
Notifications
You must be signed in to change notification settings - Fork 0
/
.vimrc
180 lines (129 loc) · 3.36 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
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
" Terminal Mode Maps
tnoremap <Esc><Esc> <C-\><C-n>
" Normal Mode Maps
nnoremap <silent> <Leader>t :tabs<CR>
nnoremap <silent> <Leader>w :up<CR>
nnoremap <silent> <Leader>h :noh<CR>
nnoremap <silent> <Leader>l :set list!<CR>
nnoremap <silent> <Leader>s :set spell!<CR>
nnoremap <silent> <Leader>j :n<CR>
nnoremap <silent> <Leader>k :N<CR>
nnoremap <silent> <Leader>n n
nnoremap <silent> <Leader>N N
nnoremap n nzz
nnoremap N Nzz
" Insert Mode Remaps
inoremap {<Enter> {<Enter><Enter>}<Esc>ki<Tab>
" Commands
command PandocToPDF !pandoc % -o %:r.pdf -V geometry:margin=6em -V fontsize=12pt
command SaveSesh mksession! ~/.vim/sesh.vim
command RemoveTrailing %s/\s\+$//g
command W w
" Splitting Preferences
set splitright
set splitbelow
" Folding Stuff
set foldenable
set foldmethod=indent
set foldcolumn=0
set foldtext=FoldText()
function! FoldText()
" Pre-body
let num_lines = v:foldend - v:foldstart + 1
let pre_body = '< ' . num_lines . ' > '
" Post-body
let level = v:foldlevel
let post_body = ' (' . level . ') '
" Body
let len_body = winwidth(0) - (len(pre_body) + len(post_body))
let body = repeat(' ', len_body)
" Body with line
"let len_body = winwidth(0) - (len(pre_body) + len(post_body))
"let line = getline(v:foldstart)
"if (len(line) > len_body)
" let body = line[0:(len_body - 4)] . '...'
"else
" let body = line . repeat(' ', len_body - len(line))
"endif
" Return
return pre_body . body . post_body
endfunction
" Number of milliseconds to wait for a key sequence
set timeout
set timeoutlen=400
" Tab bar verbosity
set showtabline=0
" Status bar verbosity
set laststatus=1
" Enables/disables changed buffers to be hidden
set hidden
" Adds 6 lines of context when scrolling
set scrolloff=6
" Show prompt when closing unsaved file
set confirm
" Enables/disables swap file
set noswapfile
" For fear of madness
set belloff=all
" Inserts spaces in lieu of tabs
set expandtab
" The number of spaces used to represent a tab
set tabstop=4
" The number of spaces inserted for indentation
set shiftwidth=4
" Set auto-indent for standard files
set autoindent
" Enables text wrapping
set wrap
" Disables automatic new line (text width)
set tw=0
" Wrap on breatat character
set linebreak
" Enable Backspace
set bs=2
" This sets custom white-space characters
set listchars=tab:>-,trail:-,extends:>,precedes:<
" Shows white-space
set list
" Shows the command as it is written
set showcmd
" Changes the language to proper English
set spelllang=en_gb
" Activates/deactivates spell-check
set spell
" Activates/deactivates highlighting search results
set hlsearch
" Wildmenu
set wildmode=longest,list
set wildmenu
" Underlines current line
"set cursorline
" Activates/deactivates ruler
set ruler
" Activates/deactivates line numbers
set nonumber
" Set syntax highlighting
syntax on
" UI dependant settings
if has('gui_running')
" Remove tool-bar
set go-=T
" Remove menu-bar
set go-=m
" Remove scroll-bar
set go-=r
" Sets font
set guifont=Monospace\ 17
" Set the size
set lines=40 columns=90
" Sets colorsheme
colorscheme peachpuff
else
" Let there be colour!
colorscheme ron
" Creates a 'ruler' to be used as guide at column 80
set colorcolumn=80
endif
" Colours
highlight ColorColumn ctermbg=0 guibg=lightgrey
highlight Folded ctermbg=NONE guibg=NONE