-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy path.vimrc
112 lines (86 loc) · 3.33 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
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" This file contains my personal configuration of vim.
" It is optimized for Python and LaTeX using Danish keyboard layout.
"
" Author: Bo Tranberg
" Contact: http://tberg.dk
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" Load plugins
source ~/.vim/plugins.vim
" Basics
set spell " Spell check
set spelllang=en_us " American English
set nocp " Enables a lot of features
set number " Show line numbers
set textwidth=80 " Define point of line break
set ruler " Shows ruler for cursor
set sc " Show command
set wildmenu " Show the wild menu
set showmatch " Show matching brackets
" gruvbox color scheme
syntax enable " Enable syntax highlighting
let g:gruvbox_guisp_fallback = "bg" " Fix spell checking highlight
let g:gruvbox_contrast_dark = "hard" " Set contrast
colo gruvbox " Select gruvbox
" Type :colo <tab> for a selection of built-in color schemes.
" Fixing colors in gruvbox
if !has("gui_running")
let g:gruvbox_italic=0
endif
set background=dark " dark background
" Indentation and stuff
filetype indent on " Automatic indentation
set tabstop=4 " Size of tab
set expandtab " Insert space in stead of tab
set shiftwidth=4 " Indentation of text
" Special indentation
autocmd BufRead *.yml set tabstop=2 shiftwidth=2
autocmd BufRead *.tf set tabstop=2 shiftwidth=2
" Python stuff
" Indentation for Python
autocmd BufRead *.py set smartindent cinwords=if,elif,else,for,while,try,except,finally,def,class
" Disable spelling in .py files
autocmd BufRead *.py set nospell
" LaTeX stuff
" This makes vim invoke Latex-Suite when you open a tex file.
filetype plugin on
" To install LaTeX-suite:
" aptitude install vim-latexsuite
" sudo vim-addons -w install latex-suite
" Make Latex-Suite compile .tex files to pdf
let g:Tex_DefaultTargetFormat = 'pdf'
" IMPORTANT: grep will sometimes skip displaying the file name if you
" search in a singe file. This will confuse Latex-Suite. Set your grep
" program to always generate a file-name.
set grepprg=grep\ -nH\ $*
" Starting with Vim 7, the filetype of empty .tex files defaults to
" 'plaintex' instead of 'tex', which results in vim-latex not being loaded.
" The following changes the default filetype back to 'tex':
let g:tex_flavor='latex'
" If you write your \label's as \label{fig:something}, then if you
" type in \ref{fig: and press <C-n> you will automatically cycle through
" all the figure labels. Very useful!
set iskeyword+=:
" Disable folding in latex-suite
autocmd Filetype tex setlocal nofoldenable
" Enable wrapping but without linebreak in .tex files
autocmd Filetype tex set wrap linebreak nolist textwidth=0 wrapmargin=0 formatoptions+=l
" Key mappings
" Go to first tab on tg, like gt goes to next tab
:nmap tg :tabprevious<Enter>
" Jump by paragraph with a Danish keyboard layout
:nmap å {
:nmap ø }
" Jump by word in insert mode
:inoremap <C-H> <C-\><C-O>b
:inoremap <C-L> <C-\><C-O>w
" Nerdtree
map <C-n> :NERDTreeToggle<CR>
" Remove trailing whitespaces on saving
fun! <SID>StripTrailingWhitespaces()
let l = line(".")
let c = col(".")
%s/\s\+$//e
call cursor(l, c)
endfun
autocmd BufWritePre * :call <SID>StripTrailingWhitespaces()