-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathgeneral.vim
184 lines (167 loc) · 7.89 KB
/
general.vim
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
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
" __
" __ __ /\_\ ___ ___ _ __ ___
" /\ \/\ \\/\ \ /' __` __`\/\`'__\/'___\
" __\ \ \_/ |\ \ \/\ \/\ \/\ \ \ \//\ \__/
" /\_\\ \___/ \ \_\ \_\ \_\ \_\ \_\\ \____\
" \/_/ \/__/ \/_/\/_/\/_/\/_/\/_/ \/____/
"
"
" Author: Robbie Smith
" repo : https://github.com/zoqaeski/vimfiles
"
""""""""""""""""""""""""""""""""""""""""
" General
""""""""""""""""""""""""""""""""""""""""
"
" General configuration options for most editor behaviours.
"
""""""""""""""""""""""""""""""""""""""""
" Behaviour {{{
" ---------
set nowrap " No wrap by default
set linebreak " Break long lines at 'breakat'
set breakat=\ \ ;:,!? " Long lines break chars
set nostartofline " Cursor in same column for few commands
set whichwrap+=h,l,<,>,[,],~ " Move to following line on certain keys
set splitbelow splitright " Splits open bottom right
set switchbuf=useopen,usetab " Jump to the first open window in any tab
set switchbuf+=vsplit " Switch buffer behavior to vsplit
set backspace=indent,eol,start " Intuitive backspacing in insert mode
set diffopt=filler,iwhite " Diff mode: show fillers, ignore white
set tags=.git/tags,tags
set showfulltag " Show tag and tidy search in completion
set complete=. " No wins, buffs, tags, include scanning
set completeopt=menuone " Show menu even for one item
set completeopt+=noselect " Do not select a match in the menu
set virtualedit=block " Position cursor anywhere in visual block
set report=0 " Always report changes for ':' commands
set magic " Always use magic regex
set modeline " Use modelines for file-specific settings
set modelines=5 " Look for mode lines in top- and bottommost five lines
set mouse=a " Enable mouse in all places
set mousehide " hide when characters are typed
set hidden " Allow buffer switching without saving
set autoread " Auto reload if file saved externally
set fileformats+=unix,dos,mac " Add mac to auto-detection of file format line endings
set nrformats=octal,hex,alpha " Consider octal, hexadecimal and alphanumeric as numbers
set shortmess+=c
" Disable sounds
set noerrorbells
set novisualbell
" }}}
" Tabs, Indentation, and Whitespace {{{
" ---------------------------------
set textwidth=0 " Text width maximum chars before wrapping
set tabstop=4 " The number of spaces a tab is
set softtabstop=4 " While performing editing operations
set shiftwidth=4 " Number of spaces to use in auto(indent)
set smarttab " Tab insert blanks according to 'shiftwidth'
set autoindent " Use same indenting on new lines
set smartindent " Smart autoindenting on new lines
set noexpandtab " Don't expand tabs to spaces.
set shiftround " Round indent to multiple of 'shiftwidth'
set nolist " Highlight whitespace
" }}}
" Timing {{{
" ------
set timeout ttimeout
set timeoutlen=1000 " Time out on mappings
set updatetime=500 " Idle time to write swap and trigger CursorHold
set ttimeoutlen=-1 " Keycode timeout
" }}}
" Searching {{{
" ---------
set hlsearch " Highlight searches
set incsearch " Incremental searching
set ignorecase " Ignore case for searching
set smartcase " Do case-sensitive if there's a capital letter
set wrapscan " Searches wrap around the end of files
set showmatch " Jump to matching bracket
set matchpairs+=<:> " Add HTML brackets to pair matching
set matchtime=1 " Tenths of a second to show the matching paren
set cpoptions-=m " showmatch will wait 0.5s or until a char is typed
" }}}
" Wildmenu {{{
" --------
if has('wildmenu')
set wildmenu " show list for autocomplete
set wildmode=list:longest,full
set wildoptions=tagfile
set wildignorecase
set wildignore+=.hg,.git,.svn " Version control
set wildignore+=*.aux,*.out " LaTeX intermediate files
set wildignore+=*.jpg,*.bmp,*.gif,*.png,*.jpeg " binary images
set wildignore+=*.o,*.obj,*.exe,*.dll,*.manifest " compiled object files
set wildignore+=*.spl " compiled spelling word lists
" set wildignore+=*.sw? " Don't ignore Vim swap files
set wildignore+=.DS_Store " OS X
set wildignore+=*.luac " Lua byte code
set wildignore+=*.pyc " Python byte code
endif
" }}}
" Session Saving {{{
" --------------
set sessionoptions-=blank
set sessionoptions-=options
set sessionoptions-=globals
set sessionoptions-=help
set sessionoptions+=tabpages
" What to save for views
set viewoptions-=options
set viewoptions-=unix,slash
" }}}
" History Saving {{{
" --------------
set history=1000 " number of command lines to remember
" Remember things between sessions
" '20 - remember marks for 20 previous files
" \"50 - save 50 lines for each register
" :50 - remember 50 items in command-line history
set viminfo='20,\"50,:50,/50
if exists('+shada')
set shada='100,f1,<50,:100,s100
endif
" }}}
" Vim Directories {{{
" ---------------
set swapfile
set directory=$VARPATH/swap//
set viewdir=$VARPATH/view/
set nospell spellfile=$CONFIGPATH/spell/en.utf-8.add
" persistent undo
if exists('+undofile')
set undodir=$VARPATH/undo//
set undofile
set undolevels=1000
set undoreload=10000
au BufWritePre /tmp/* setlocal noundofile
endif
" Turn Backup off: reduces clutter
if exists('+backup')
set backupdir=$VARPATH/backup/
set nobackup
set nowritebackup
set backupskip+=/tmp
set backupskip+=/private/tmp " OS X /tmp
" Skip backups of Git files
set backupskip+=*.git/COMMIT_EDITMSG,*.git/MERGE_MSG,*.git/TAG_EDITMSG
set backupskip+=*.git/modules/*/COMMIT_EDITMSG,*.git/modules/*/MERGE_MSG
set backupskip+=*.git/modules/*/TAG_EDITMSG,git-rebase-todo
" Skip backups of SVN commit files
set backupskip+=svn-commit*.tmp
au BufWritePre * let &bex = '-' . strftime("%Y%m%d-%H%M%S") . '.vimbackup'
endif
" Write swap file to disk after every 50 characters
set updatecount=50
" }}}
if executable('ag')
set grepprg=ag\ --nogroup\ --column\ --smart-case\ --nocolor\ --follow
set grepformat=%f:%l:%c:%m
elseif executable('ack')
set grepprg=ack\ --nogroup\ --column\ --smart-case\ --nocolor\ --follow\ $*
set grepformat=%f:%l:%c:%m
elseif executable('rg')
set grepprg=rg\ --vimgrep\ --no-heading\ --smart-case
set grepformat=%f:%l:%c:%m
endif
" vim: ft=vim fdm=marker ts=2 sts=2 sw=2 fdl=0 :