-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathvimrc-project
73 lines (61 loc) · 2.33 KB
/
vimrc-project
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
vim9script
# Per project vimrc. Can be copied into the project root folder and is
# sourced by Vim after the main configuration. This is an example with
# all per project configurations I've collected over the years. Not
# every projects needs all configuration.
# =====================================================================
# A light theme is better when writing text.
set background=light
# The ability to freely position the cursor is sometimes nice.
# It breaks assumptions around virtual text and conceal, though.
set virtualedit=all
# Don't sort the entires in the tagbar. This can be usefull when working
# with structured text documents like Markdown or LaTeX.
g:tagbar_sort = 0
# Don't generate tags for the local .vimrc and spellchecker wordlists.
g:gutentags_ctags_exclude = [ '.vimrc', '.spell/*' ]
# This generated tags from user defined tags given in markdown files.
# Each tag starts with +. An example, abusing YAML frontmatters:
#
# ----
# Title: A Novel
# Author: Donald Duck
# Tags: +prose +stormywinternight
# ----
g:gutentags_ctags_extra_args = [
'--langdef=mdtags',
'--languages=mdtags',
'--langmap=mdtags:.md',
'--kinddef-mdtags=t,tag,tags',
'--_tabledef-mdtags=toplevel',
'--_mtable-regex-mdtags=toplevel/(^|[[:space:]])\+([a-zA-Z0-9][^[:space:]]*)/\2/t/{mgroup=1}{tenter=toplevel}',
'--_mtable-regex-mdtags=toplevel/.//'
]
# =====================================================================
# A distinct spell checker dictionary for this project.
var spellfile: string = expand('<sfile>:p:h') .. '/.spell/dict.utf-8.add'
def AddSpellfile()
if filereadable(spellfile)
&l:spellfile = spellfile
endif
enddef
# The standard foldings for Markdown are rather slow, because they
# support the alternative header syntax which needs back references
# throughout the whole file. Define alternative foldings which are
# limited to the normal header syntax but way faster.
def MarkdownLevel(): any
var header: string = matchstr(getline(v:lnum), '^#\+')
if empty(header)
return "="
else
return ">" .. len(header)
endif
enddef
# Add the functions above as autocommands, triggered when necessary.
augroup local
# The dictionary.
autocmd BufEnter * call AddSpellfile()
# Faster foldings for markdown.
autocmd FileType markdown setlocal foldexpr=MarkdownLevel()
autocmd FileType markdown setlocal foldmethod=expr
augroup END