Update 2024-12-16 19:13 OpenBSD/amd64-t14
This commit is contained in:
parent
6d6f0e9a46
commit
e4b33a77ba
@ -96,7 +96,7 @@ name = ws[6]:6
|
|||||||
name = ws[7]:7
|
name = ws[7]:7
|
||||||
name = ws[8]:8
|
name = ws[8]:8
|
||||||
name = ws[9]:9
|
name = ws[9]:9
|
||||||
name = ws[10]:10
|
name = ws[10]:0
|
||||||
|
|
||||||
workspace_limit = 10
|
workspace_limit = 10
|
||||||
stack_mark_horizontal = 'v'
|
stack_mark_horizontal = 'v'
|
||||||
|
21
.vim/pack/plugins/start/vim-hugo-helper/LICENSE
Normal file
21
.vim/pack/plugins/start/vim-hugo-helper/LICENSE
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
MIT License
|
||||||
|
|
||||||
|
Copyright (c) 2017 Robert Basic
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
of this software and associated documentation files (the "Software"), to deal
|
||||||
|
in the Software without restriction, including without limitation the rights
|
||||||
|
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
copies of the Software, and to permit persons to whom the Software is
|
||||||
|
furnished to do so, subject to the following conditions:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be included in all
|
||||||
|
copies or substantial portions of the Software.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||||
|
SOFTWARE.
|
79
.vim/pack/plugins/start/vim-hugo-helper/README.md
Normal file
79
.vim/pack/plugins/start/vim-hugo-helper/README.md
Normal file
@ -0,0 +1,79 @@
|
|||||||
|
# vim-hugo-helper
|
||||||
|
|
||||||
|
A small Vim plugin to help me with writing posts with [Hugo](https://gohugo.io).
|
||||||
|
|
||||||
|
# Helpers
|
||||||
|
|
||||||
|
The following helpers are available:
|
||||||
|
|
||||||
|
## Draft
|
||||||
|
|
||||||
|
`:HugoHelperDraft` drafts the current post.
|
||||||
|
|
||||||
|
## Undraft
|
||||||
|
|
||||||
|
`:HugoHelperUndraft` undrafts the current post.
|
||||||
|
|
||||||
|
## Date is now
|
||||||
|
|
||||||
|
`:HugoHelperDateIsNow` sets the date and time of the current post to current date and time.
|
||||||
|
|
||||||
|
## Highlight
|
||||||
|
|
||||||
|
`:HugoHelperHighlight language` inserts the `highlight` block for "language" in to the current post.
|
||||||
|
|
||||||
|
## Link
|
||||||
|
|
||||||
|
`:HugoHelperLink` helps with adding links to a document. Visually select the word(s) you want to be a link, enter `:HugoHelperLink https://gohugo.io` and it will turn the selected word(s) to `[selected words](https://gohugo.io)`.
|
||||||
|
|
||||||
|
![link helper in action](http://i.imgur.com/mVPqgXs.gif)
|
||||||
|
|
||||||
|
Probably works only for markdown documents.
|
||||||
|
|
||||||
|
## Spell check
|
||||||
|
|
||||||
|
`:HugoHelperSpellCheck` toggles the spell check for the current language. Running it once, turns the spell check on. Running it again, turns it off.
|
||||||
|
|
||||||
|
You can set the language by setting the following in your `.vimrc` file:
|
||||||
|
|
||||||
|
```
|
||||||
|
let g:hugohelper_spell_check_lang = 'en_us'
|
||||||
|
```
|
||||||
|
|
||||||
|
By default it is set to `en_us`.
|
||||||
|
|
||||||
|
## Title to slug
|
||||||
|
|
||||||
|
`:HugoHelperTitleToSlug` turns the title of the Hugo post to the slug. It assumes the following two lines are present in the frontmatter:
|
||||||
|
|
||||||
|
```
|
||||||
|
+++
|
||||||
|
// frontmatter
|
||||||
|
title = "Title of the post"
|
||||||
|
// frontmatter
|
||||||
|
slug = ""
|
||||||
|
// frontmatter
|
||||||
|
+++
|
||||||
|
```
|
||||||
|
|
||||||
|
It will turn it into:
|
||||||
|
|
||||||
|
```
|
||||||
|
+++
|
||||||
|
// frontmatter
|
||||||
|
title = "Title of the post"
|
||||||
|
// frontmatter
|
||||||
|
slug = "title-of-the-post"
|
||||||
|
// frontmatter
|
||||||
|
+++
|
||||||
|
```
|
||||||
|
|
||||||
|
# Installation
|
||||||
|
|
||||||
|
## [vim-plug](https://github.com/junegunn/vim-plug)
|
||||||
|
|
||||||
|
`Plug 'robertbasic/vim-hugo-helper'`
|
||||||
|
|
||||||
|
## [Vundle](https://github.com/VundleVim/Vundle.vim)
|
||||||
|
|
||||||
|
`PluginInstall 'robertbasic/vim-hugo-helper'`
|
@ -0,0 +1,99 @@
|
|||||||
|
function! hugohelper#SpellCheck()
|
||||||
|
exe "setlocal spell! spelllang=" . g:hugohelper_spell_check_lang
|
||||||
|
endfun
|
||||||
|
|
||||||
|
function! hugohelper#TitleToSlug()
|
||||||
|
normal gg
|
||||||
|
exe '/^title'
|
||||||
|
normal! vi"y
|
||||||
|
exe '/^slug'
|
||||||
|
normal! f"pVu
|
||||||
|
" Not sure why I can't make \%V work here
|
||||||
|
exe ':s/ /-/g'
|
||||||
|
exe 'normal! f-r f-r '
|
||||||
|
endfun
|
||||||
|
|
||||||
|
function! hugohelper#TitleCase()
|
||||||
|
normal gg
|
||||||
|
exe '/^title'
|
||||||
|
normal! vi"u~
|
||||||
|
endfun
|
||||||
|
|
||||||
|
function! hugohelper#Draft()
|
||||||
|
call s:set_key('draft', 'true')
|
||||||
|
endfun
|
||||||
|
|
||||||
|
function! hugohelper#Undraft()
|
||||||
|
call s:set_key('draft', 'false')
|
||||||
|
endfun
|
||||||
|
|
||||||
|
function! hugohelper#DateIsNow()
|
||||||
|
call s:set_key('date', s:hugo_now())
|
||||||
|
endfun
|
||||||
|
|
||||||
|
function! hugohelper#LastmodIsNow()
|
||||||
|
call s:set_key('lastmod', s:hugo_now())
|
||||||
|
endfun
|
||||||
|
|
||||||
|
function! hugohelper#Highlight(language)
|
||||||
|
normal! I{{< highlight language_placeholder >}}
|
||||||
|
exe 's/language_placeholder/' . a:language . '/'
|
||||||
|
normal! o{{< /highlight >}}
|
||||||
|
endfun
|
||||||
|
|
||||||
|
function! hugohelper#Link(link)
|
||||||
|
let l:selection = s:get_visual_selection()
|
||||||
|
exe ':s/\%V\(.*\)\%V\(.\)/[\0]/'
|
||||||
|
exe "normal! gv\ef]a(link_placeholder)\e"
|
||||||
|
exe 's/link_placeholder/' . escape(a:link, '\\/.*^~[]') . '/'
|
||||||
|
exe "normal! gv\ef)"
|
||||||
|
endfun
|
||||||
|
|
||||||
|
function! hugohelper#HasFrontMatter()
|
||||||
|
try
|
||||||
|
call s:front_matter_format()
|
||||||
|
return 1
|
||||||
|
catch
|
||||||
|
endtry
|
||||||
|
return 0
|
||||||
|
endfun
|
||||||
|
|
||||||
|
function! s:get_visual_selection()
|
||||||
|
" From http://stackoverflow.com/a/6271254/794380
|
||||||
|
let [lnum1, col1] = getpos("'<")[1:2]
|
||||||
|
let [lnum2, col2] = getpos("'>")[1:2]
|
||||||
|
let lines = getline(lnum1, lnum2)
|
||||||
|
let lines[-1] = lines[-1][: col2 - (&selection == 'inclusive' ? 1 : 2)]
|
||||||
|
let lines[0] = lines[0][col1 - 1:]
|
||||||
|
return join(lines, "\n")
|
||||||
|
endfun
|
||||||
|
|
||||||
|
function! s:front_matter_format()
|
||||||
|
let l:line = getline(1)
|
||||||
|
if l:line =~ '+++'
|
||||||
|
return 'toml'
|
||||||
|
elseif l:line =~ '---'
|
||||||
|
return 'yaml'
|
||||||
|
else
|
||||||
|
throw "Could not determine Hugo front matter format. Looking for +++ or ---. JSON not supported."
|
||||||
|
endif
|
||||||
|
endfun
|
||||||
|
|
||||||
|
function! s:set_key(key, value)
|
||||||
|
let l:format = s:front_matter_format()
|
||||||
|
if l:format == 'toml'
|
||||||
|
exe '1;/+++/substitute/^' . a:key . '\s*=.*/' . a:key . ' = ' . a:value
|
||||||
|
elseif l:format == 'yaml'
|
||||||
|
exe '1;/---/substitute/^' . a:key . '\s*:.*/' . a:key . ': ' . a:value
|
||||||
|
else
|
||||||
|
throw "Can't set key, value pair for unknown format " . l:format
|
||||||
|
endif
|
||||||
|
endfun
|
||||||
|
|
||||||
|
function! s:hugo_now()
|
||||||
|
" Contrust a time string using the format: 2018-09-18T19:41:32-07:00
|
||||||
|
let l:time = strftime("%FT%T%z")
|
||||||
|
return l:time[:-3] . ':' . l:time[-2:]
|
||||||
|
endfun
|
||||||
|
|
||||||
|
" vim: expandtab shiftwidth=4
|
111
.vim/pack/plugins/start/vim-hugo-helper/plugin/hugohelper.vim
Normal file
111
.vim/pack/plugins/start/vim-hugo-helper/plugin/hugohelper.vim
Normal file
@ -0,0 +1,111 @@
|
|||||||
|
if exists('g:hugohelper_plugin_loaded') || &cp
|
||||||
|
finish
|
||||||
|
endif
|
||||||
|
let g:hugohelper_plugin_loaded = 1
|
||||||
|
|
||||||
|
let g:hugohelper_plugin_path = expand('<sfile>:p:h')
|
||||||
|
|
||||||
|
if !exists('g:hugohelper_spell_check_lang')
|
||||||
|
let g:hugohelper_spell_check_lang = 'en_us'
|
||||||
|
endif
|
||||||
|
|
||||||
|
if !exists('g:hugohelper_update_lastmod_on_write')
|
||||||
|
let g:hugohelper_update_lastmod_on_write = 0
|
||||||
|
endif
|
||||||
|
|
||||||
|
if !exists('g:hugohelper_content_dir')
|
||||||
|
let g:hugohelper_content_dir = 'content'
|
||||||
|
endif
|
||||||
|
|
||||||
|
if !exists('g:hugohelper_site_config')
|
||||||
|
" List of site configuration files vim-hugo-helper uses to detemine
|
||||||
|
" the root of the hugo site.
|
||||||
|
" For more information, see: https://gohugo.io/getting-started/configuration/
|
||||||
|
let g:hugohelper_site_config = [ 'config.toml', 'config.yaml', 'config.json' ]
|
||||||
|
endif
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
command! -nargs=0 HugoHelperSpellCheck call hugohelper#SpellCheck()
|
||||||
|
command! -nargs=0 HugoHelperDraft call hugohelper#Draft()
|
||||||
|
command! -nargs=0 HugoHelperUndraft call hugohelper#Undraft()
|
||||||
|
command! -nargs=0 HugoHelperDateIsNow call hugohelper#DateIsNow()
|
||||||
|
command! -nargs=0 HugoHelperLastmodIsNow call hugohelper#LastmodIsNow()
|
||||||
|
command! -nargs=0 HugoHelperTitleToSlug call hugohelper#TitleToSlug()
|
||||||
|
command! -nargs=0 HugoHelperTitleCase call hugohelper#TitleCase()
|
||||||
|
command! -nargs=1 HugoHelperHighlight call hugohelper#Highlight(<f-args>)
|
||||||
|
command! -range -nargs=1 HugoHelperLink call hugohelper#Link(<f-args>)
|
||||||
|
|
||||||
|
function! HugoHelperFrontMatterReorder()
|
||||||
|
exe 'g/^draft/m 1'
|
||||||
|
exe 'g/^date/m 2'
|
||||||
|
exe 'g/^title/m 3'
|
||||||
|
exe 'g/^slug/m 4'
|
||||||
|
exe 'g/^description/m 5'
|
||||||
|
exe 'g/^tags/m 6'
|
||||||
|
exe 'g/^categories/m 7'
|
||||||
|
" create date taxonomy
|
||||||
|
exe 'g/^date/co 8'
|
||||||
|
exe ':9'
|
||||||
|
exe ':s/.*\(\d\{4\}\)-\(\d\{2\}\).*/\1 = ["\2"]'
|
||||||
|
endfun
|
||||||
|
|
||||||
|
augroup vim-hugo-helper
|
||||||
|
autocmd BufWritePre *.md call s:UpdateLastMod()
|
||||||
|
augroup end
|
||||||
|
|
||||||
|
" Update lastmod on save.
|
||||||
|
function! s:UpdateLastMod()
|
||||||
|
if s:ShouldUpdateLastMod()
|
||||||
|
let save_cursor = getcurpos()
|
||||||
|
call hugohelper#LastmodIsNow()
|
||||||
|
call setpos('.', save_cursor)
|
||||||
|
endif
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
function! s:ShouldUpdateLastMod()
|
||||||
|
if !g:hugohelper_update_lastmod_on_write
|
||||||
|
return v:false
|
||||||
|
endif
|
||||||
|
|
||||||
|
if hugohelper#HasFrontMatter() == 0
|
||||||
|
return v:false
|
||||||
|
endif
|
||||||
|
|
||||||
|
" Only update lastmod in markdown in the content directory. In particular, archetypes
|
||||||
|
" should not be automatically updated.
|
||||||
|
return s:IsFileInHugoContentDirectory(expand('<afile>'))
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
function! s:IsFileInHugoContentDirectory(filepath)
|
||||||
|
let l:mods = ':p:h'
|
||||||
|
let l:dirname = 'dummy'
|
||||||
|
while !empty(l:dirname)
|
||||||
|
let l:path = fnamemodify(a:filepath, l:mods)
|
||||||
|
let l:mods .= ':h'
|
||||||
|
let l:dirname = fnamemodify(l:path, ':t')
|
||||||
|
if l:dirname == g:hugohelper_content_dir
|
||||||
|
" Check if the parent of the content directory contains a config file.
|
||||||
|
let l:parent = fnamemodify(l:path, ":h")
|
||||||
|
if s:HasHugoConfigFile(l:parent)
|
||||||
|
return v:true
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
endwhile
|
||||||
|
|
||||||
|
return v:false
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
function! s:HasHugoConfigFile(dir)
|
||||||
|
" :p adds the final path separator if a:dir is a directory.
|
||||||
|
let l:dirpath = fnamemodify(a:dir, ':p')
|
||||||
|
for config in g:hugohelper_site_config
|
||||||
|
let l:file = l:dirpath . config
|
||||||
|
if filereadable(l:file)
|
||||||
|
return v:true
|
||||||
|
endif
|
||||||
|
endfor
|
||||||
|
return v:false
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
" vim: expandtab shiftwidth=4
|
21
.vim/pack/plugins/start/vim-hugo/LICENSE
Normal file
21
.vim/pack/plugins/start/vim-hugo/LICENSE
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
MIT License
|
||||||
|
|
||||||
|
Copyright (c) 2022 Phelipe Teles da Silva
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
of this software and associated documentation files (the "Software"), to deal
|
||||||
|
in the Software without restriction, including without limitation the rights
|
||||||
|
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
copies of the Software, and to permit persons to whom the Software is
|
||||||
|
furnished to do so, subject to the following conditions:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be included in all
|
||||||
|
copies or substantial portions of the Software.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||||
|
SOFTWARE.
|
42
.vim/pack/plugins/start/vim-hugo/README.md
Normal file
42
.vim/pack/plugins/start/vim-hugo/README.md
Normal file
@ -0,0 +1,42 @@
|
|||||||
|
# vim-hugo
|
||||||
|
|
||||||
|
This is a Vim plugin for web development with the static site generator
|
||||||
|
[Hugo](https://gohugo.io/).
|
||||||
|
|
||||||
|
# HTML
|
||||||
|
|
||||||
|
- syntax highlighting and identation is improved to support the HTML Go
|
||||||
|
template syntax.
|
||||||
|
- `:h path` includes default directories used by Hugo, like `layouts/partials`,
|
||||||
|
which is convenient to start editing files with `:h gf` and friends.
|
||||||
|
- `matchit` patterns are extended to support Go template.
|
||||||
|
- A compiler plugin is made available so you can build your website from inside
|
||||||
|
Vim with `compiler hugo | make`, and build errors will populate the quickfix
|
||||||
|
list.
|
||||||
|
|
||||||
|
# Markdown
|
||||||
|
|
||||||
|
Markdown syntax highlight is also improved to add support for shortcodes and
|
||||||
|
YAML front matter.
|
||||||
|
|
||||||
|
Embedded languages inside the `{{< highlight >}}` shortcode will be
|
||||||
|
highlighted. For example, to highlight Python code, add `let
|
||||||
|
g:markdown_fenced_languages=['python']` to your `.vimrc` or `init.vim`.
|
||||||
|
|
||||||
|
```markdown
|
||||||
|
{{< highlight python >}}
|
||||||
|
import foo
|
||||||
|
{{< /highlight >}}
|
||||||
|
```
|
||||||
|
|
||||||
|
If you want to highlight JavaScript code with `js` as a shorthand, use `let
|
||||||
|
g:markdown_fenced_languages=['js=javascript']`:
|
||||||
|
|
||||||
|
```markdown
|
||||||
|
{{< highlight js >}}
|
||||||
|
import { bar } from './foo'
|
||||||
|
{{< /highlight >}}
|
||||||
|
```
|
||||||
|
|
||||||
|
This is reused from Vim's built-in syntax files for markdown, so it'll also be
|
||||||
|
used for markdown code blocks.
|
@ -0,0 +1,6 @@
|
|||||||
|
if exists('loaded_matchit')
|
||||||
|
let b:match_words=''
|
||||||
|
\.'\%({{<\s*\)\@<=\(\k\+\)\s\+.*>}}:'
|
||||||
|
\.'\%({{<\s*\/\)\@<=\1\s*>}},'
|
||||||
|
\.b:match_words
|
||||||
|
endif
|
37
.vim/pack/plugins/start/vim-hugo/after/syntax/markdown.vim
Normal file
37
.vim/pack/plugins/start/vim-hugo/after/syntax/markdown.vim
Normal file
@ -0,0 +1,37 @@
|
|||||||
|
syn region markdownHugoShortcode start=/{{[<%]/ end=/[>%]}}/ matchgroup=Delimiter keepend
|
||||||
|
|
||||||
|
syn match markdownHugoShortcodeStartDelimiter /{{[<%]/ nextgroup=markdownHugoShortcodeName skipwhite contained containedin=markdownHugoShortcode
|
||||||
|
hi link markdownHugoShortcodeStartDelimiter Delimiter
|
||||||
|
|
||||||
|
syn match markdownHugoShortcodeEndDelimiter /[>%]}}/ contained containedin=markdownHugoShortcode
|
||||||
|
hi link markdownHugoShortcodeEndDelimiter Delimiter
|
||||||
|
|
||||||
|
syn match markdownHugoShortcodeName +/\=\k\++ contained containedin=markdownHugoShortcode
|
||||||
|
hi link markdownHugoShortcodeName Statement
|
||||||
|
|
||||||
|
syn match markdownHugoShortcodeParam /\k\+\ze=\=/ contained containedin=markdownHugoShortcode
|
||||||
|
hi link markdownHugoShortcodeParam Type
|
||||||
|
|
||||||
|
syn region markdownHugoShortcodeString start=/\z([`"]\)/ end=/\z1/ matchgroup=String contained containedin=markdownHugoShortcode
|
||||||
|
hi link markdownHugoShortcodeString String
|
||||||
|
|
||||||
|
syn region markdownHugoShortcodeHighlight
|
||||||
|
\ start='^{{[<%]\s\+highlight.*[>%]}}'ms=s-1
|
||||||
|
\ end='^{{[<%]\s\+\/highlight\s\+[>%]}}'ms=s-1
|
||||||
|
\ keepend
|
||||||
|
\ contains=markdownHugoShortcode,markdownCode
|
||||||
|
|
||||||
|
" [js=javascript, python, r] -> [javascript, python, r]
|
||||||
|
for s:lang in map(copy(get(g:,'markdown_fenced_languages',[])),'matchstr(v:val,"[^=]*$")')
|
||||||
|
exe 'syn region markdownHugoShortcodeHighlight'.s:lang
|
||||||
|
\.' start="^{{[%<]\s\+highlight\s\+'.s:lang.'\s\+.*[>%]}}"ms=s-1'
|
||||||
|
\.' end="^{{[<%]\s\+\/highlight\s\+[>%]}}"ms=s-1'
|
||||||
|
\.' keepend'
|
||||||
|
\.' contains=markdownHugoShortcode,@markdownHighlight'.substitute(s:lang,'\.','','g')
|
||||||
|
endfor
|
||||||
|
|
||||||
|
hi link markdownHugoShortcodeHighlight markdownCode
|
||||||
|
|
||||||
|
unlet! b:current_syntax
|
||||||
|
syntax include @Yaml syntax/yaml.vim
|
||||||
|
syntax region yamlFrontmatter start=/\%^---$/ end=/^---$/ keepend contains=@Yaml
|
15
.vim/pack/plugins/start/vim-hugo/compiler/hugo.vim
Normal file
15
.vim/pack/plugins/start/vim-hugo/compiler/hugo.vim
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
if exists('current_compiler')
|
||||||
|
finish
|
||||||
|
endif
|
||||||
|
let current_compiler = 'hugo'
|
||||||
|
|
||||||
|
if exists(':CompilerSet') != 2 " older Vim always used :setlocal
|
||||||
|
command -nargs=* CompilerSet setlocal <args>
|
||||||
|
endif
|
||||||
|
|
||||||
|
CompilerSet makeprg=hugo
|
||||||
|
CompilerSet errorformat=%.%#file\ \"%f\"\\,\ line\ %l\\,\ col\ %c:%m,
|
||||||
|
\ERROR%.%#\"%f:%l:%c\":\ %m,
|
||||||
|
\ERROR.....................%m,
|
||||||
|
\%-G,
|
||||||
|
\%-G%.%#
|
16
.vim/pack/plugins/start/vim-hugo/ftdetect/html.vim
Normal file
16
.vim/pack/plugins/start/vim-hugo/ftdetect/html.vim
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
function! s:DetectGoTemplate()
|
||||||
|
if findfile('.hugo_build.lock', '.;') !=# ''
|
||||||
|
set ft=htmlhugo
|
||||||
|
elseif search('{{\s*end\s*}}')
|
||||||
|
set ft=htmlhugo
|
||||||
|
elseif search('{{\s*$\k\+\s*:=')
|
||||||
|
set ft=htmlhugo
|
||||||
|
elseif search('{{\s*\.[A-Z]')
|
||||||
|
set ft=htmlhugo
|
||||||
|
endif
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
augroup DetectGoTemplate
|
||||||
|
autocmd!
|
||||||
|
autocmd BufNewFile,BufRead *.html call <SID>DetectGoTemplate()
|
||||||
|
augroup END
|
19
.vim/pack/plugins/start/vim-hugo/ftplugin/htmlhugo.vim
Normal file
19
.vim/pack/plugins/start/vim-hugo/ftplugin/htmlhugo.vim
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
if exists('b:did_ftplugin')
|
||||||
|
finish
|
||||||
|
endif
|
||||||
|
|
||||||
|
runtime! ftplugin/html.vim
|
||||||
|
|
||||||
|
setlocal path+=layouts,resources,content,archetypes,static,data,layouts/_default,layouts/partials
|
||||||
|
setlocal suffixesadd=.html
|
||||||
|
|
||||||
|
setlocal commentstring={{/*%s*/}}
|
||||||
|
|
||||||
|
if exists('loaded_matchit')
|
||||||
|
let b:match_words=b:match_words.','
|
||||||
|
\.'\<\%(define\|block\|with\|range\|if\)\>:'
|
||||||
|
\.'\<else\>:'
|
||||||
|
\.'\<end\>,'
|
||||||
|
endif
|
||||||
|
|
||||||
|
let b:undo_ftplugin = 'setlocal com< path<'
|
51
.vim/pack/plugins/start/vim-hugo/indent/htmlhugo.vim
Normal file
51
.vim/pack/plugins/start/vim-hugo/indent/htmlhugo.vim
Normal file
@ -0,0 +1,51 @@
|
|||||||
|
" Only load this indent file when no other was loaded.
|
||||||
|
if exists('b:did_indent')
|
||||||
|
finish
|
||||||
|
endif
|
||||||
|
|
||||||
|
let b:did_indent = 1
|
||||||
|
|
||||||
|
if &l:indentexpr == ''
|
||||||
|
if &l:cindent
|
||||||
|
let &l:indentexpr = 'cindent(v:lnum)'
|
||||||
|
else
|
||||||
|
let &l:indentexpr = 'indent(prevnonblank(v:lnum-1))'
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
let b:html_indentexpr = &l:indentexpr
|
||||||
|
|
||||||
|
runtime! indent/html.vim
|
||||||
|
|
||||||
|
setlocal indentexpr=GetHugoIndent()
|
||||||
|
setlocal indentkeys+==else,=end,=if,=range,=with,=define,=block
|
||||||
|
|
||||||
|
" Only define the function once.
|
||||||
|
if exists('*GetHugoIndent')
|
||||||
|
finish
|
||||||
|
endif
|
||||||
|
|
||||||
|
function! GetHugoIndent()
|
||||||
|
if exists('*HtmlIndent')
|
||||||
|
let l:ind = HtmlIndent()
|
||||||
|
else
|
||||||
|
let l:ind = HtmlIndentGet(v:lnum)
|
||||||
|
endif
|
||||||
|
|
||||||
|
if exists('*shiftwidth')
|
||||||
|
let l:sw = shiftwidth()
|
||||||
|
else
|
||||||
|
let l:sw = &sw
|
||||||
|
endif
|
||||||
|
|
||||||
|
let l:last_line = getline(v:lnum-1)
|
||||||
|
if l:last_line =~# '^\s*{{-\=\s*\%(if\|else\|range\|with\|define\|block\).*}}' && l:last_line !~# '{{-\=\s*end\s*-\=}}'
|
||||||
|
let l:ind += l:sw
|
||||||
|
endif
|
||||||
|
|
||||||
|
let l:current_line = getline(v:lnum)
|
||||||
|
if l:current_line =~# '^\s*{{-\=\s*\%(else\|end\).*}}'
|
||||||
|
let l:ind -= l:sw
|
||||||
|
endif
|
||||||
|
|
||||||
|
return l:ind
|
||||||
|
endfunction
|
157
.vim/pack/plugins/start/vim-hugo/syntax/htmlhugo.vim
Normal file
157
.vim/pack/plugins/start/vim-hugo/syntax/htmlhugo.vim
Normal file
@ -0,0 +1,157 @@
|
|||||||
|
if exists('b:current_syntax')
|
||||||
|
finish
|
||||||
|
endif
|
||||||
|
|
||||||
|
if !exists('main_syntax')
|
||||||
|
let main_syntax = 'html'
|
||||||
|
endif
|
||||||
|
|
||||||
|
runtime! syntax/html.vim
|
||||||
|
|
||||||
|
syn case match
|
||||||
|
|
||||||
|
syn region htmlHugoBlock matchgroup=hugoDelimiters start=/{{-\?/ end=/-\?}}/
|
||||||
|
syn cluster htmlPreProc add=htmlHugoBlock
|
||||||
|
|
||||||
|
syn keyword htmlHugoInclude partial template contained containedin=htmlHugoBlock
|
||||||
|
syn keyword htmlHugoStatement with block define end contained containedin=htmlHugoBlock
|
||||||
|
syn keyword htmlHugoRepeat range contained containedin=htmlHugoBlock
|
||||||
|
syn keyword htmlHugoConditional if else contained containedin=htmlHugoBlock
|
||||||
|
syn keyword htmlHugoOperator and or not contained containedin=htmlHugoBlock
|
||||||
|
|
||||||
|
let s:hugo_global_functions = [
|
||||||
|
\ 'absLangURL',
|
||||||
|
\ 'absURL',
|
||||||
|
\ 'after',
|
||||||
|
\ 'anchorize',
|
||||||
|
\ 'append',
|
||||||
|
\ 'apply',
|
||||||
|
\ 'base64',
|
||||||
|
\ 'chomp',
|
||||||
|
\ 'complement',
|
||||||
|
\ 'cond',
|
||||||
|
\ 'countrunes',
|
||||||
|
\ 'countwords',
|
||||||
|
\ 'default',
|
||||||
|
\ 'delimit',
|
||||||
|
\ 'dict',
|
||||||
|
\ 'echoParam',
|
||||||
|
\ 'emojify',
|
||||||
|
\ 'eq',
|
||||||
|
\ 'errorf',
|
||||||
|
\ 'warnf',
|
||||||
|
\ 'fileExists',
|
||||||
|
\ 'findRE',
|
||||||
|
\ 'first',
|
||||||
|
\ 'float',
|
||||||
|
\ 'ge',
|
||||||
|
\ 'getenv',
|
||||||
|
\ 'group',
|
||||||
|
\ 'gt',
|
||||||
|
\ 'hasPrefix',
|
||||||
|
\ 'highlight',
|
||||||
|
\ 'hmac',
|
||||||
|
\ 'htmlEscape',
|
||||||
|
\ 'htmlUnescape',
|
||||||
|
\ 'humanize',
|
||||||
|
\ 'i18n',
|
||||||
|
\ 'in',
|
||||||
|
\ 'index',
|
||||||
|
\ 'int',
|
||||||
|
\ 'intersect',
|
||||||
|
\ 'isset',
|
||||||
|
\ 'jsonify',
|
||||||
|
\ 'lang',
|
||||||
|
\ 'lang.Merge',
|
||||||
|
\ 'last',
|
||||||
|
\ 'le',
|
||||||
|
\ 'len',
|
||||||
|
\ 'lower',
|
||||||
|
\ 'lt',
|
||||||
|
\ 'markdownify',
|
||||||
|
\ 'md5',
|
||||||
|
\ 'merge',
|
||||||
|
\ 'ne',
|
||||||
|
\ 'now',
|
||||||
|
\ 'partialCached',
|
||||||
|
\ 'plainify',
|
||||||
|
\ 'pluralize',
|
||||||
|
\ 'print',
|
||||||
|
\ 'printf',
|
||||||
|
\ 'println',
|
||||||
|
\ 'querify',
|
||||||
|
\ 'readDir',
|
||||||
|
\ 'readFile',
|
||||||
|
\ 'ref',
|
||||||
|
\ 'relLangURL',
|
||||||
|
\ 'relref',
|
||||||
|
\ 'relURL',
|
||||||
|
\ 'replace',
|
||||||
|
\ 'replaceRE',
|
||||||
|
\ 'safeCSS',
|
||||||
|
\ 'safeHTML',
|
||||||
|
\ 'safeHTMLAttr',
|
||||||
|
\ 'safeJS',
|
||||||
|
\ 'safeURL',
|
||||||
|
\ 'seq',
|
||||||
|
\ 'sha',
|
||||||
|
\ 'shuffle',
|
||||||
|
\ 'singularize',
|
||||||
|
\ 'site',
|
||||||
|
\ 'slice',
|
||||||
|
\ 'slicestr',
|
||||||
|
\ 'sort',
|
||||||
|
\ 'split',
|
||||||
|
\ 'string',
|
||||||
|
\ 'substr',
|
||||||
|
\ 'symdiff',
|
||||||
|
\ 'time',
|
||||||
|
\ 'title',
|
||||||
|
\ 'trim',
|
||||||
|
\ 'truncate',
|
||||||
|
\ 'union',
|
||||||
|
\ 'uniq',
|
||||||
|
\ 'upper',
|
||||||
|
\ 'urlize',
|
||||||
|
\ 'where',
|
||||||
|
\ 'minify',
|
||||||
|
\ 'fingerprint',
|
||||||
|
\ 'toCSS',
|
||||||
|
\ ]
|
||||||
|
|
||||||
|
for s:hugo_global_function in s:hugo_global_functions
|
||||||
|
exe 'syn keyword htmlHugoFunction '. s:hugo_global_function .' contained containedin=htmlHugoBlock'
|
||||||
|
endfor
|
||||||
|
|
||||||
|
syn match htmlHugoAssignment /:=/ contained containedin=htmlHugoBlock
|
||||||
|
|
||||||
|
syn match htmlHugoPipe /\|/ contained containedin=htmlHugoBlock
|
||||||
|
|
||||||
|
syn match htmlHugoNumber /\<\d\+\([Ee]\d\+\)\?\>/ contained containedin=htmlHugoBlock
|
||||||
|
|
||||||
|
syn region htmlHugoString start=/\z(["`']\)/ end=/\z1/ skip=+\\\\\|\\\z1+ contained containedin=htmlHugoBlock
|
||||||
|
syn region htmlHugoRawString start=/`/ end=/`/ contained containedin=htmlHugoBlock
|
||||||
|
|
||||||
|
syn region htmlHugoComment start=+/\*+ end=+\*/+ matchgroup=Comment keepend extend contained containedin=htmlHugoBlock
|
||||||
|
|
||||||
|
syn match htmlHugoMethod /\.[A-Z]\k\+/hs=s+1 contained containedin=htmlHugoBlock
|
||||||
|
|
||||||
|
hi def link htmlHugoComment Comment
|
||||||
|
hi def link htmlHugoDelimiters Delimiter
|
||||||
|
hi def link htmlHugoString String
|
||||||
|
hi def link htmlHugoRawString String
|
||||||
|
hi def link htmlHugoNumber Number
|
||||||
|
hi def link htmlHugoPipe Special
|
||||||
|
hi def link htmlHugoAssignment Special
|
||||||
|
hi def link htmlHugoIdentifier Identifier
|
||||||
|
hi def link htmlHugoConditional Conditional
|
||||||
|
hi def link htmlHugoRepeat Repeat
|
||||||
|
hi def link htmlHugoOperator Operator
|
||||||
|
hi def link htmlHugoStatement Statement
|
||||||
|
hi def link htmlHugoInclude Include
|
||||||
|
hi def link htmlHugoFunction Function
|
||||||
|
hi def link htmlHugoMethod Function
|
||||||
|
|
||||||
|
let b:current_syntax = 'htmlhugo'
|
||||||
|
|
||||||
|
" vim: nowrap
|
@ -1,9 +0,0 @@
|
|||||||
let g:netrw_dirhistmax =10
|
|
||||||
let g:netrw_dirhistcnt =7
|
|
||||||
let g:netrw_dirhist_7='/home/sdk/blog/themes/plague/layouts/_default'
|
|
||||||
let g:netrw_dirhist_6='/home/sdk/blog/content/about'
|
|
||||||
let g:netrw_dirhist_5='/home/sdk/blog/content/distfiles'
|
|
||||||
let g:netrw_dirhist_4='/home/sdk/blog/content/about'
|
|
||||||
let g:netrw_dirhist_3='/usr/ports/pobj/urlscan-1.0.6/urlscan-1.0.6/urlscan'
|
|
||||||
let g:netrw_dirhist_2='/usr/ports/openbsd-wip/security/phrasendrescher'
|
|
||||||
let g:netrw_dirhist_1='/usr/ports/mystuff/security/enchive'
|
|
@ -30,9 +30,9 @@ if &diff
|
|||||||
set colorcolumn=
|
set colorcolumn=
|
||||||
endif
|
endif
|
||||||
set diffopt=internal
|
set diffopt=internal
|
||||||
set diffopt+=filler,context:100000
|
set diffopt+=filler,context:20
|
||||||
set diffopt+=iwhite,iblank
|
set diffopt+=iwhite,iblank
|
||||||
set diffopt+=algorithm:patience
|
set diffopt+=algorithm:histogram
|
||||||
set diffexpr=
|
set diffexpr=
|
||||||
|
|
||||||
filetype plugin indent on " load plugins based on filetype
|
filetype plugin indent on " load plugins based on filetype
|
||||||
|
Loading…
Reference in New Issue
Block a user