-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathvimrc
165 lines (144 loc) · 4.76 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
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
" {{{
" Maintainer: Johannes Steudle
" .vimrc
" for Unix and macOS: ~/.vimrc
" }}}
syntax on
set hidden " Allow switching edited buffers without saving
set title " Show filename
" {{{ Layout
" set termencoding=utf-8
set encoding=utf-8 " Use UTF-8 as the default buffer encoding
" scriptencoding utf-8
" }}}
" {{{ Behavior
" set nocompatible
set autoread " Read open files again when changed outside Vim
set switchbuf=useopen " reveal already opened files from the
" quickfix window instead of opening new
" buffers
set nostartofline " Keep cursor in current column when using page commands
set autochdir " Automatically set current directory to directory of last opened file
set visualbell " Set visual bell instead of acustic
set mouse=a " Enable the use of the mouse
set number norelativenumber " hybrid relative numbers
set matchtime=4 " Jump to matching bracket for n/10 seconds
set nospell
set nojoinspaces " Insert only one space when joining lines
set magic " Use magic escaping
set completeopt=menu,menuone,longest,preview " Insert mode completion options
set backspace=indent,eol,start
" }}}
" {{{ Show some invisible characters
" Display tabs and trailing spaces visually
set list listchars=tab:\ \ ,trail:·
" }}}
" {{{ Indentation
set autoindent " copy indent from current line
set shiftround " shift to nearest indent
" }}}
" {{{ Tab settings
set tabstop=4 " Tab size
set shiftwidth=4 " Shift width
set expandtab " Tabs to spaces
" set softtabstop=4
" set smarttab
" }}}
" {{{ Handle long lines
set wrap
set textwidth=79
set formatoptions=qrn1
set linebreak
set display+=lastline
" }}}
" {{{ Search See http://stevelosh.com/blog/2010/09/coming-home-to-vim/
set hlsearch " Highlight search
set incsearch " incremental searching
set ignorecase smartcase " Case-insensitive searching
set showmatch " When a bracket is inserted, briefly jump to a matching one
nnoremap <tab> %
vnoremap <tab> %
" }}}
" {{{ Scrolling
set scrolloff=8
set sidescrolloff=15
set sidescroll=1
" }}}
" {{{ Wildmenu
set wildmenu " Use menu to show command-line completion (in 'full' case)
set wildmode=list:longest,full " set command-line completion mode:
" - on first <Tab>, when more than one match, list all matches and complete the longest common string
" - on second <Tab>, complete the next full match and show menu
" Ignore these filenames during enhanced command line completion.
set wildignore+=*/.idea/*,*/.project/* " ignore IDE project files
set wildignore+=*/.git/*,*/.hg/*,*/.svn/* " ignore version control files
set wildignore+=*.aux,*.out,*.toc " LaTeX intermediate files
set wildignore+=*.jpg,*.bmp,*.gif " binary images
set wildignore+=*.luac " Lua byte code
set wildignore+=*.o,*.obj,*.exe,*.dll,*.manifest,*.so,*.zip " compiled object files
set wildignore+=*.pyc " Python byte code
set wildignore+=*.spl " compiled spelling word lists
set wildignore+=*.sw? " Vim swap files
set wildignore+=.DS_Store " Mac files
set wildignore+=*/tmp/* " MacOSX/Linux
set wildignore+=*\\tmp\\* " Windows
" }}}
" {{{ PlugIn-Configuration
call plug#begin('$HOME/.vim/plugged')
so ~/.vim/settings/plugins.vim
call plug#end()
" }}}
" {{{ Colorscheme
if has('gui_running')
colorscheme sonokai
elseif &t_Co < 256
colorscheme default
set nocursorline " Looks bad in this mode
else
colorscheme sonokai
endif
" Highlight current line, but only in active window
augroup CursorLineOnlyInActiveWindow
autocmd!
autocmd VimEnter,WinEnter,BufWinEnter * setlocal cursorline
autocmd WinLeave * setlocal nocursorline
augroup END
" }}}
let g:ale_disable_lsp = 1
" {{{ Source settings
so ~/.vim/settings/keymap.vim
so ~/.vim/settings/statusline.vim
so ~/.vim/settings/ale.vim
so ~/.vim/settings/python.vim
so ~/.vim/settings/ctrlp.vim
so ~/.vim/settings/vim-expand-region.vim
so ~/.vim/settings/plantuml-previewer.vim
so ~/.vim/settings/markdown.vim
so ~/.vim/settings/jenkins.vim
" }}}
" {{{ Special filetypes and encoding
if has('autocmd')
"autocmd BufEnter * cd %:p:h
filetype plugin indent on
endif
" }}}
" {{{ Encoding
" Always check for UTF-8 when trying to determine encodings
if &fileencodings !~? 'utf-8'
set fileencodings+=utf-8
endif
" Make sure we have a sane fallback for encoding detection
set fileencodings+=default
set fileformats=unix,dos,mac
" }}}
" {{{ Set some nice diff options
if has('nvim-0.3.2') || has('patch-8.1.0360')
set diffopt=filler,internal,algorithm:histogram,indent-heuristic
endif
" }}}
" {{{ Load local vim config
let $LOCALFILE=expand('~/.vimrc_local')
if filereadable($LOCALFILE)
source $LOCALFILE
endif
" }}}