-
Notifications
You must be signed in to change notification settings - Fork 0
/
_vimrc
95 lines (80 loc) · 2.2 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
" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
" General options
" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
if &compatible
set nocompatible " Vi compatibility not needed
endif
if has("syntax")
syntax on
endif
if has("termguicolors")
set termguicolors
" the following is apparently needed sometimes according to :h termguicolors
let &t_8f = "\<Esc>[38;2;%lu;%lu;%lum"
let &t_8b = "\<Esc>[48;2;%lu;%lu;%lum"
endif
filetype plugin indent on
set background=dark
set encoding=utf-8
set showcmd
set ignorecase
set smartcase
set incsearch
set autowrite
set hidden
set mouse=a
set number
set relativenumber
set expandtab
set tabstop=2
set shiftwidth=0
set softtabstop=-1
set autoindent
set textwidth=80
set nowrap
set colorcolumn=+1
set scrolloff=4
set ruler
set backspace=indent,eol,start
set nojoinspaces
set listchars=tab:>·,trail:~,extends:>,precedes:<
set list
set belloff=all
set signcolumn=number
" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
" Key mappings
" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
let mapleader = ' '
" Spell checking
function! ToggleSpell()
if &spell ==# "nospell"
set spell spelllang=de_ch
elseif &spell && &spelllang ==# "de_ch"
set spelllang=en_gb
else
set nospell
endif
endfunction
map <F1> :call ToggleSpell()<CR>
" Run with Python
map <F2> :w !python<CR>
" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
" Autocommands
" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
" When editing a file, always jump to the last known cursor position.
" Don't do it when the position is invalid, when inside an event handler
" (happens when dropping a file on gvim) and for a commit message (it's
" likely a different one than last time).
autocmd BufReadPost *
\ if line("'\"") >= 1 && line("'\"") <= line("$") && &ft !~# 'commit'
\ | exe "normal! g`\""
\ | endif
" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
" Vim-Plug
" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
" Make sure to reload the vimrc and run the :PlugInstall command after adding
" a new Plugin. :PlugUpdate can be used to update all installed plugins.
if ! empty(globpath(&rtp, 'autoload/plug.vim'))
call plug#begin('~/.vim/plugged')
call plug#end()
endif