-
Notifications
You must be signed in to change notification settings - Fork 0
/
vimrc
141 lines (106 loc) · 3.4 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
set nocompatible
"run local .vimrcs
set exrc
set secure
"map the leader key to komma
let mapleader = ","
"enable pathogen
execute pathogen#infect()
filetype plugin indent on
"allow differences for file types
filetype plugin on
filetype on
"avoid having to save every time I want to switch buffers
set hidden
"enable clipboard yanking
set clipboard=unnamedplus
"eye candy
set rtp+=/usr/lib/python3.6/site-packages/powerline/bindings/vim
set laststatus=2
set t_Co=256
syntax on
colorscheme thaumaturge
highlight Normal ctermbg=none
"repeat for each line in selection with .
vnoremap . :normal .<CR>
"file related stuff
noremap <Leader>e :hide edit
noremap <Leader>f :hide find
noremap <Leader>b :b
"display line numbers
set number
set cursorline "show current cursor line
"don't wrap words
set tw=0
"toggle relative numbers with ,l
noremap <Leader>l :set relativenumber!<CR>
"toggle line numbers with ,n
noremap <Leader>n :set number!<CR>
"save quicker
noremap <Leader>w :w<CR>
"make quicker
noremap <Leader>m :call LoadLocalVimrc()<CR>:make<CR><CR>
noremap <Leader>r :call LoadLocalVimrc()<CR>:make run<CR><CR>
function g:LoadLocalVimrc()
if filereadable($PWD . "/.vimrc")
source $PWD/.vimrc
endif
endfunction
"be able to search case insensitive, unless capital letters are used
set ignorecase
set smartcase
"nicer linewrap
set linebreak
"nicer search
set incsearch
"search into subfolders
set path=,,**
"display all files in tab complete
set wildmenu
"use 4 tabs
set tabstop=4
set softtabstop=4
set shiftwidth=4
set expandtab "use soft tabs
"auto indent new lines to last lines indent
set autoindent
" file is large from 7mb
let g:LargeFile = 1024 * 1024 * 7
augroup LargeFile
autocmd BufReadPre * let f=getfsize(expand("<afile>")) | if f > g:LargeFile || f == -2 | call LargeFile() | endif
augroup END
function LargeFile()
" no syntax highlighting etc
set eventignore+=FileType
" save memory when other file is viewed
setlocal bufhidden=unload
" is read-only (write with :w new_filename)
setlocal buftype=nowrite
" no undo possible
setlocal undolevels=-1
" display message
autocmd VimEnter * echo "The file is larger than " . (g:LargeFile / 1024 / 1024) . " MB, so some options are changed (see .vimrc for details)."
endfunction
"<++> is used as a marker to jump to
nnoremap <Enter> <Esc>/<++><Enter>"_4s
"RUST SPECIFIC
"a macro for generating a function in rust
autocmd FileType rust inoremap ;fn fn<Space><++>(<++>)<Space><++>{<Esc>o}<Esc>O<++><Esc>kI
"a macro for generating a for loop in rust
autocmd FileType rust inoremap ;for for<Space><Space>in<Space><++><Space>{<Esc>o}<Esc>O<++><Esc>k$2bhi
"a macro for generating an if in rust
autocmd FileType rust inoremap ;if if<Space><Space>{<Esc>o}<Esc>O<++><Esc>k$hi
"RUST SPECIFIC END
"STUDENT GRADING SPECIFIC
autocmd FileType comments.txt nnoremap ;a10 IA1:<Space>0P.<Esc>
autocmd FileType comments.txt nnoremap ;a11 IA1:<Space>1P.<Esc>
autocmd FileType comments.txt nnoremap ;a12 IA1:<Space>2P.<Esc>
autocmd FileType comments.txt nnoremap ;a13 IA1:<Space>3P.<Esc>
autocmd FileType comments.txt nnoremap ;a20 IA2:<Space>0P.<Esc>
autocmd FileType comments.txt nnoremap ;a21 IA2:<Space>1P.<Esc>
autocmd FileType comments.txt nnoremap ;a22 IA2:<Space>2P.<Esc>
autocmd FileType comments.txt nnoremap ;a23 IA2:<Space>3P.<Esc>
autocmd FileType comments.txt nnoremap ;ka IKeine<Space>Abgabe.<Esc>
"STUDENT GRADING SPECIFIC END
"LATEX SPECIFIC
"LATEX SPECIFIC END