-
Notifications
You must be signed in to change notification settings - Fork 0
/
vimrc
136 lines (106 loc) · 2.78 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
"=============================
" Appearance
"=============================
" Set Terminal colors to 256
set t_Co=256
" Use dark background for better readability
set background=dark
" Use leo as colorscheme
" Change colorschemes manually with :colo $schemename
" My favourite ones are leo,candycode,desert256,relaxedgreen
colorscheme leo
"=============================
" Coding-Style adjustments
"=============================
" Set 4 whitespaces as tab
set expandtab
set shiftwidth=4
set tabstop=4
"=============================
" Miscellaneous
"=============================
" Turn on UTF-8 encoding
set encoding=utf8
"=============================
" Plugin adjustments
"=============================
" TTrCodeAssistor plugin
" Enable plugin and set tag file
let g:TTrCodeAssistor_AutoStart=1
:set tags=~/.vim/tmp/tags
"=============================
" Usability features
"=============================
" Hide cursor when editing
set mousehide
" Case insensitive matching for search
set ignorecase
" Incremental search
set incsearch
" This shows what you are typing as a command
set showcmd
" Returns to indent of previous line
" Probably this should be turned off for some actions
set autoindent
" Show line numbers
set number
"=============================
" Useful mappings
"=============================
" Switch to matching object and highlight code between
" Example '{' and '}'
" To use press the % key
noremap % v%
" Tlist lists all functions and similar things
" Ctags has to be installed for this feature
" To use press the space key
noremap <space> :Tlist<CR>
" Mappings for window resizing
" To use press Alt + the arrow keys
map <A-Up> <C-w>-
map <A-Down> <C-w>+
map <A-Left> <C-w><
map <A-Right> <C-w>>
" Mappings for window switching
" To use press Ctrl + the arrow keys
map <C-Up> <C-w>k
map <C-Down> <C-w>j
map <C-Left> <C-w>h
map <C-Right> <C-w>l
"=============================
" Useful functions
"=============================
" Function to delete trailing whitespaces
" To use type :call DeleteTrailingWS()
function! DeleteTrailingWS()
%s/\s\+$//ge
endfunction
" Function to replace tabs with four spaces
" To use type :call TabsToSpaces()
function! TabsToSpaces()
%s/\t/ /ge
endfunction
" Function to replace Dos with Unix line endings
" To use type :call Dos2Unix()
function! Dos2Unix()
:%s/\r//ge
endfunction
"=============================
" Statusline adjustments
"=============================
" Always show the statusline
set laststatus=2
" Format the statusline
set statusline=\ %{HasPaste()}%F%m%r%h\ %w\ \ CWD:\ %r%{CurDir()}%h\ \ \ Line:\ %l/%L:%c
" Needed functions for formatting
function! CurDir()
let curdir = getcwd()
return curdir
endfunction
function! HasPaste()
if &paste
return 'PASTE MODE '
else
return ''
endif
endfunction