-
Notifications
You must be signed in to change notification settings - Fork 0
/
.vimrc-min
116 lines (101 loc) · 3.39 KB
/
.vimrc-min
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
" === Basic settings === "
set nocompatible "not vi-compatible mode
filetype off
filetype plugin indent on "enable filetype plugin
syntax on "syntax highlighting on
colorscheme desert
let mapleader=','
set number
set autochdir "switch to the current file directory
set backspace=indent,eol,start "make backspace more flexible
set fileformats=unix,dos,mac "support all three in specified order
set hidden "change buffers without saving
set iskeyword-=_ " `_` symbol breaks the word
set noerrorbells "no error sound
set novisualbell "no visual blinking
set wrap linebreak textwidth=0 "wrap lines at word boundaries
set autoindent "copy indent from current line
set smartindent "smart indent
set scrolloff=5 "5 lines of context around cursor
set ruler "show cursor position all the time
set cmdheight=2 "command bar height
set showcmd "show the command being typed
set hlsearch "highligh search matches
set showmatch "show matching brackets
set matchtime=2 "how long to blink matching bracket
set whichwrap=<,>,h,l "wrapping when navigating
set incsearch "incremental search
set nobackup "turn off backup
set nowritebackup "turn off backup
set textwidth=78 "text width
set expandtab "spaces instead of tab
set tabstop=4 "number of spaces in tab
set shiftwidth=4 "spaces for indent
set softtabstop=4 "number of spaces in tab when editing
set laststatus=2 "allways show status line
set statusline=%<%f%h%m%r%=%{&ff}\ %l,%c%V\ %P
set completeopt=longest,menuone "autocompletion settings
set modeline "read modeline
set nostartofline "do not change cursor position when jumping to other line
set wildmenu "show list instead of completing command
set wildmode=list:longest,full "command completion order
set nolist
set listchars=eol:$,tab:»·,trail:.
let &sbr = nr2char(8618).' ' " Show ↪ at the beginning of wrapped lines
set runtimepath^=~/.vim/ctrlp.vim
set splitbelow "split down
set splitright "split to the right
if v:version > 703
set colorcolumn=80
set undofile
set undodir=~/.vim/tmp/undo//
endif
set ttyfast
set history=1000
set backup
set backupdir=~/.vim/tmp/backup//
set noswapfile
set shell=/bin/bash\ --login
set showbreak=↪
set fillchars=diff:⣿,vert:│
set autowrite
set autoread
set title
set noignorecase
set gdefault
set fo-=t
set complete=.,w,b,u,t
"=== Functions ==="
"--- Trailing whitespace ---"
fun! <SID>StripTrailingWhitespaces()
let l = line(".")
let c = col(".")
%s/\s\+$//e
call cursor(l, c)
endfun
"=== Auto commands ==="
"--- Autosource ---"
augroup autosourcegroup
autocmd!
autocmd BufWritePost .vimrc source %
augroup END
"--- Python ---"
augroup pythongroup
autocmd!
autocmd BufRead *.py set smartindent cinwords=if,elif,else,for,while,try,except,finally,def,class
autocmd FileType python autocmd BufWritePre <buffer> :call <SID>StripTrailingWhitespaces()
augroup END
"=== Mappings ==="
"--- Autocompletion ---"
inoremap <expr> <cr> pumvisible() ? "\<c-y>" : "\<c-g>u\<cr>"
inoremap <expr> <c-n> pumvisible() ? "\<lt>c-n>" : "\<lt>c-n>\<lt>c-r>=pumvisible() ? \"\\<lt>down>\" : \"\"\<lt>cr>"
inoremap <expr> <m-;> pumvisible() ? "\<lt>c-n>" : "\<lt>c-x>\<lt>c-o>\<lt>c-n>\<lt>c-p>\<lt>c-r>=pumvisible() ? \"\\<lt>down>\" : \"\"\<lt>cr>"
"--- Tab navigation ---"
nmap <C-Tab> :tabnext<CR>
nmap <C-Insert> :tabnew<CR>
nmap <C-Delete> :tabclose<CR>
"--- Tags ---"
map <C-t> :CtrlPBufTag<CR>
"--- Misc ---"
nmap ,<space> :nohlsearch<CR>
nnoremap <F5> :buffers<CR>:buffer<Space>