2022-09-24 01:07:06 +02:00
|
|
|
" General config {{{
|
2021-03-10 17:48:56 +01:00
|
|
|
"
|
2023-04-07 22:42:56 +02:00
|
|
|
" Tip: acronyms for overview, use `:h` for a quick lookup.
|
2020-02-17 17:05:51 +01:00
|
|
|
|
2023-04-07 22:42:56 +02:00
|
|
|
set nocp " Disable vi incompatibility
|
|
|
|
filetype plugin indent on " Filetype recognition
|
|
|
|
set enc=utf8 " Default to UTF-8 encoding
|
|
|
|
set hid " Allow hiding unsaved buffers
|
|
|
|
set tf " Fast tty
|
|
|
|
set ut=300 " 300ms for update time
|
|
|
|
set to tm=200 ttm=5 " Timeouts
|
|
|
|
set shm+=c " ...
|
|
|
|
set ul=500 hi=500 " History and undo
|
|
|
|
set nu rnu scl=number " Line numbers & signs
|
|
|
|
set nowrap
|
|
|
|
set bs=indent,eol,start " Indentation
|
|
|
|
set ai ts=2 sts=2 sw=2 et " Indentation
|
|
|
|
set is ic scs hls " Search
|
|
|
|
set lz " Only essential redraws
|
|
|
|
set nobk nowb noswf " No backups
|
|
|
|
set vi='20,\"101 " Max 100 lines in registers
|
|
|
|
set novb " Bell
|
|
|
|
set cole=0 cocu="" " Conceal
|
|
|
|
set cb=unnamedplus " Clipboard
|
|
|
|
set fcs+=vert:│ " Cleaner split separator (tmux style)
|
2022-08-18 13:47:32 +02:00
|
|
|
set list
|
2023-04-07 22:42:56 +02:00
|
|
|
set lcs=trail:·,tab:→\ ,nbsp:␣ " Whitespace rendering
|
|
|
|
set ar " Autoread
|
|
|
|
set spellsuggest+=5 " Limit spell suggestions
|
|
|
|
set wildignore+=*/node_modules/*,*/tmp/*,*.so,*.swp,*.zip
|
|
|
|
set thesaurus+=~/.vim/thesaurus/mthesaur.txt
|
2020-02-17 17:05:51 +01:00
|
|
|
|
2023-04-07 22:45:42 +02:00
|
|
|
" }}}
|
2022-05-11 00:56:39 +02:00
|
|
|
|
2023-04-07 22:48:21 +02:00
|
|
|
" Mappings {{{
|
|
|
|
"
|
2020-02-17 17:05:51 +01:00
|
|
|
|
2021-03-10 17:48:56 +01:00
|
|
|
" Leader keys
|
2023-04-07 22:48:21 +02:00
|
|
|
|
|
|
|
nn <space><nop>
|
2020-05-07 02:11:41 +02:00
|
|
|
let mapleader = " "
|
2020-05-08 16:11:55 +02:00
|
|
|
let maplocalleader = ";"
|
2023-04-07 22:48:21 +02:00
|
|
|
|
2021-03-10 17:48:56 +01:00
|
|
|
" Splits & navigation
|
2023-04-07 22:48:21 +02:00
|
|
|
|
|
|
|
nm s <c-w> " Split horizontal
|
|
|
|
nm ss :sp<CR><c-w>w| " Split horizontal
|
|
|
|
nm sv :vs<CR><c-w>w| " Split vertical
|
|
|
|
nn sw <c-w>w| " Navigate splits
|
|
|
|
nn sh <c-w>h| "
|
|
|
|
nn sj <c-w>j| "
|
|
|
|
nn sk <c-w>k| "
|
|
|
|
nn sl <c-w>l| "
|
|
|
|
nn sH <c-w>8<| " Resize splits
|
|
|
|
nn sJ <c-w>8-| "
|
|
|
|
nn sK <c-w>8+| "
|
|
|
|
nn sL <c-w>8>| "
|
|
|
|
nn s= <c-w>=| " Equalize splits
|
|
|
|
|
2021-03-10 17:48:56 +01:00
|
|
|
" Open
|
2023-04-07 22:48:21 +02:00
|
|
|
|
2021-03-28 10:37:23 +02:00
|
|
|
nn sb :Lex<cr>| " File tree
|
2023-04-07 22:48:21 +02:00
|
|
|
nn <leader><leader> :noh<cr> |"
|
2021-03-28 10:37:23 +02:00
|
|
|
nn <leader>t :term<cr>| " Open terminal
|
2021-03-10 17:48:56 +01:00
|
|
|
" Remaps
|
2021-03-28 10:37:23 +02:00
|
|
|
ino <nowait> jj <esc>| " Normal now
|
|
|
|
nn <left> <nop>| " Hard mode
|
|
|
|
nn <down> <nop>| " "
|
|
|
|
nn <up> <nop>| " "
|
|
|
|
nn <right> <nop>| " "
|
|
|
|
ino <left> <nop>| " "
|
|
|
|
ino <down> <nop>| " "
|
|
|
|
ino <up> <nop>| " "
|
|
|
|
ino <right> <nop>| " "
|
2021-03-10 17:48:56 +01:00
|
|
|
" Search
|
2023-04-07 22:48:21 +02:00
|
|
|
nn <c-_> :noh<cr>| " map 'ctrl + /'
|
|
|
|
" Use `the_silver_searcher` to find results (for selection if selection)
|
2021-03-10 17:48:56 +01:00
|
|
|
nn <leader>f :Ag <cr>
|
2023-04-07 22:48:21 +02:00
|
|
|
vm <leader>f y:Ag <C-r>"<cr>
|
2023-04-07 22:47:48 +02:00
|
|
|
" Toggle line numbers
|
|
|
|
nn <leader>n :set nu! rnu!<cr>
|
2021-03-10 17:48:56 +01:00
|
|
|
" Vim configuration
|
2023-04-07 22:48:21 +02:00
|
|
|
nn <leader>ec :vs $MYVIMRC<cr>
|
2021-03-10 17:48:56 +01:00
|
|
|
nn <leader>so :so %<cr>
|
|
|
|
|
2023-04-07 22:51:17 +02:00
|
|
|
" }}}
|
|
|
|
|
|
|
|
" Plugins {{{
|
|
|
|
|
2023-04-07 22:21:22 +02:00
|
|
|
" Plug setup {{{
|
|
|
|
|
2020-05-07 02:11:41 +02:00
|
|
|
call plug#begin()
|
2023-04-07 22:51:17 +02:00
|
|
|
if !exists('g:vscode')
|
2021-03-10 17:48:56 +01:00
|
|
|
Plug 'neoclide/coc.nvim', {'branch': 'release'}
|
2022-12-01 13:51:29 +01:00
|
|
|
Plug 'github/copilot.vim'
|
2023-04-07 22:51:17 +02:00
|
|
|
endif
|
2021-03-10 17:48:56 +01:00
|
|
|
" General
|
2022-12-01 13:54:13 +01:00
|
|
|
Plug 'unblevable/quick-scope'
|
2023-04-07 22:51:17 +02:00
|
|
|
Plug 'Shougo/context_filetype.vim'
|
2020-12-10 15:04:23 +01:00
|
|
|
Plug 'tpope/vim-commentary'
|
2023-04-07 22:51:17 +02:00
|
|
|
Plug 'tpope/vim-obsession'
|
2020-09-19 22:07:29 +02:00
|
|
|
Plug 'machakann/vim-sandwich'
|
2023-04-07 22:51:17 +02:00
|
|
|
Plug 'editorconfig/editorconfig-vim'
|
|
|
|
Plug 'honza/vim-snippets'
|
|
|
|
Plug 'chrisbra/unicode.vim'
|
|
|
|
Plug 'ap/vim-css-color'
|
|
|
|
" Fzf
|
2021-08-31 14:19:18 +02:00
|
|
|
Plug 'junegunn/fzf', { 'do': { -> fzf#install() } }
|
2020-05-07 02:11:41 +02:00
|
|
|
Plug 'junegunn/fzf.vim'
|
2021-03-10 17:48:56 +01:00
|
|
|
" JS and TypeScript
|
2020-05-07 02:11:41 +02:00
|
|
|
Plug 'pangloss/vim-javascript', { 'for': ['javascript', 'javascript.jsx'] }
|
|
|
|
Plug 'leafgarland/typescript-vim', { 'for': ['typescript', 'typescript.tsx'] }
|
|
|
|
Plug 'peitalin/vim-jsx-typescript', { 'for': ['typescript.tsx'] }
|
2020-09-19 20:15:01 +02:00
|
|
|
Plug 'evanleck/vim-svelte', {'branch': 'main'}
|
2022-05-11 01:02:08 +02:00
|
|
|
" JSON with comments
|
|
|
|
Plug 'neoclide/jsonc.vim'
|
2023-04-07 22:21:22 +02:00
|
|
|
" LaTeX
|
2021-03-10 17:48:56 +01:00
|
|
|
Plug 'lervag/vimtex'
|
2022-11-27 23:12:07 +01:00
|
|
|
" Wiki
|
|
|
|
Plug 'lervag/wiki.vim'
|
|
|
|
Plug 'hektor/taskwiki'
|
|
|
|
" Markdown
|
|
|
|
Plug 'vim-pandoc/vim-pandoc'
|
2021-08-31 14:22:15 +02:00
|
|
|
Plug 'vim-pandoc/vim-pandoc-syntax'
|
2023-04-07 22:21:22 +02:00
|
|
|
Plug 'ferrine/md-img-paste.vim'
|
2021-03-10 17:48:56 +01:00
|
|
|
" TidalCycles
|
|
|
|
Plug 'supercollider/scvim'
|
|
|
|
Plug 'tidalcycles/vim-tidal'
|
2023-04-07 22:51:17 +02:00
|
|
|
" GLSL
|
|
|
|
Plug 'tikhomirov/vim-glsl'
|
|
|
|
Plug 'timtro/glslView-nvim'
|
|
|
|
" Jupyter notebooks
|
|
|
|
Plug 'goerz/jupytext.vim'
|
|
|
|
" OpenSCAD
|
|
|
|
Plug 'sirtaj/vim-openscad'
|
2021-03-10 17:48:56 +01:00
|
|
|
call plug#end()
|
2023-04-07 22:51:17 +02:00
|
|
|
" }}}
|
2020-11-02 11:50:14 +01:00
|
|
|
|
2023-04-07 22:51:17 +02:00
|
|
|
" Plugin config {{{
|
2020-11-02 11:50:14 +01:00
|
|
|
|
2022-12-01 14:01:41 +01:00
|
|
|
" `.../sandwich` {{{
|
|
|
|
nmap s <Nop>
|
|
|
|
xmap s <Nop>
|
|
|
|
let g:sandwich#recipes = deepcopy(g:sandwich#default_recipes)
|
|
|
|
" }}}
|
2022-12-01 13:57:54 +01:00
|
|
|
|
2022-12-01 13:51:29 +01:00
|
|
|
" `.../copilot` {{{
|
|
|
|
|
|
|
|
let g:copilot_node_command = "/home/h/.config/nvm/versions/node/v16.18.0/bin/node"
|
|
|
|
let g:copilot_no_tab_map = v:true
|
|
|
|
imap <c-l> <Plug>(copilot-next)
|
|
|
|
imap <c-h> <Plug>(copilot-prev)
|
|
|
|
imap <silent><script><expr> <s-tab> copilot#Accept("\<CR>")
|
|
|
|
" Show Copilot node v16 as it does not work with v18 yet
|
|
|
|
|
2023-04-07 22:51:17 +02:00
|
|
|
" }}}
|
|
|
|
|
|
|
|
" `.../vimtex` {{{
|
|
|
|
|
2021-03-10 17:48:56 +01:00
|
|
|
let g:vimtex_view_method='zathura'
|
2021-08-31 14:22:15 +02:00
|
|
|
let g:tex_flavor='latex'
|
2023-04-07 22:51:17 +02:00
|
|
|
let g:tex_conceal='abdmgs'
|
2021-03-10 17:48:56 +01:00
|
|
|
let g:vimtex_quickfix_mode=0
|
2020-09-19 22:07:29 +02:00
|
|
|
|
2023-04-07 22:51:17 +02:00
|
|
|
" }}}
|
|
|
|
|
|
|
|
" 'ferrine/md-img-paste.vim' {{{
|
|
|
|
|
|
|
|
" Paste clipboard images
|
|
|
|
au FileType pandoc nmap <buffer><silent> <leader>v :call mdip#MarkdownClipboardImage()<CR>
|
|
|
|
au FileType markdown nmap <buffer><silent> <leader>v :call mdip#MarkdownClipboardImage()<CR>
|
|
|
|
|
|
|
|
" }}}
|
|
|
|
|
|
|
|
" 'tpope/vim-commentary' {{{
|
2021-08-31 14:22:15 +02:00
|
|
|
|
2021-03-10 17:48:56 +01:00
|
|
|
xm <leader>c <Plug>Commentary
|
|
|
|
nm <leader>c <Plug>Commentary
|
|
|
|
nm <leader>cc <Plug>CommentaryLine
|
2020-09-19 22:07:29 +02:00
|
|
|
|
2023-04-07 22:51:17 +02:00
|
|
|
" }}}
|
2020-09-19 22:07:29 +02:00
|
|
|
|
2023-04-07 22:51:17 +02:00
|
|
|
" `junegunn/fzf` {{{
|
|
|
|
" `junegunn/fzf.vim`
|
|
|
|
|
|
|
|
let g:fzf_layout = {'window': { 'width': 1, 'height': 0.62}}
|
2021-08-31 14:23:54 +02:00
|
|
|
let g:fzf_colors =
|
|
|
|
\ { 'fg': ['fg', 'Normal'],
|
|
|
|
\ 'bg': ['bg', 'Normal'],
|
|
|
|
\ 'hl': ['fg', 'Comment'],
|
|
|
|
\ 'fg+': ['fg', 'CursorLine', 'CursorColumn', 'Normal'],
|
|
|
|
\ 'bg+': ['bg', 'CursorLine', 'CursorColumn'],
|
|
|
|
\ 'hl+': ['fg', 'Statement'],
|
2023-04-07 22:51:17 +02:00
|
|
|
\ 'info': ['fg', 'PreProc'],
|
2021-08-31 14:23:54 +02:00
|
|
|
\ 'border': ['fg', 'Comment'],
|
|
|
|
\ 'prompt': ['fg', 'Conditional'],
|
|
|
|
\ 'pointer': ['fg', 'Exception'],
|
|
|
|
\ 'marker': ['fg', 'Keyword'],
|
2023-04-07 22:51:17 +02:00
|
|
|
\ 'spinner': ['fg', 'Label'],
|
|
|
|
\ 'header': ['fg', 'Comment'] }
|
2021-08-31 14:23:54 +02:00
|
|
|
|
2022-11-27 23:24:25 +01:00
|
|
|
let g:ag_working_path_mode="r"
|
|
|
|
|
|
|
|
" }}}
|
|
|
|
|
|
|
|
" `vim-pandoc/vim-pandoc` {{{
|
|
|
|
" `vim-pandoc/vim-pandoc-syntax`
|
|
|
|
|
|
|
|
au FileType pandoc call pandoc#completion#Init()
|
|
|
|
let g:pandoc#filetypes#pandoc_markdown=0
|
|
|
|
let g:pandoc#spell#enabled=0
|
|
|
|
let g:pandoc#spell#default_langs=['en_us', 'nl_be']
|
|
|
|
let g:pandoc#formatting#mode='a'
|
|
|
|
let g:pandoc#formatting#textwidth=90
|
|
|
|
let g:pandoc#modules#disabled = ["formatting", "dashes", "yaml", "metadata"]
|
|
|
|
|
2023-04-29 18:54:51 +02:00
|
|
|
let g:pandoc#syntax#conceal#urls=1
|
|
|
|
let g:pandoc#syntax#conceal#blacklist=[]
|
|
|
|
let g:pandoc#syntax#style#emphases=0 " Bug workaround
|
|
|
|
let g:pandoc#syntax#conceal#cchar_overrides = { "atx": " ", "li": "·" }
|
|
|
|
|
2022-11-27 23:24:25 +01:00
|
|
|
" }}}
|
|
|
|
|
2023-04-07 22:21:22 +02:00
|
|
|
|
|
|
|
|
|
|
|
" }}}
|
|
|
|
|
2022-11-27 23:24:25 +01:00
|
|
|
" `lervag/wiki.vim` {{{
|
|
|
|
|
2023-05-01 15:34:27 +02:00
|
|
|
" Only load wiki.vim for zk directory
|
2022-11-27 23:24:25 +01:00
|
|
|
let g:wiki_global_load=0
|
2023-05-01 15:34:27 +02:00
|
|
|
let g:wiki_root='~/.zk'
|
2022-11-27 23:24:25 +01:00
|
|
|
let g:wiki_index_name='index'
|
|
|
|
let g:wiki_zotero_root='~/doc/Zotero'
|
|
|
|
let g:wiki_filetypes=['md']
|
|
|
|
let g:wiki_completion_case_sensitive=0
|
|
|
|
|
|
|
|
" If we are on a wiki link
|
|
|
|
|
2023-04-07 22:51:17 +02:00
|
|
|
" TODO: configure the following
|
2022-11-27 23:24:25 +01:00
|
|
|
" let g:wiki_file_handlenmap r
|
|
|
|
|
|
|
|
" Links
|
2023-04-07 22:51:17 +02:00
|
|
|
" FIXME: figure out what '' vs '.md' does
|
2022-11-27 23:24:25 +01:00
|
|
|
let g:wiki_link_extension='.md'
|
|
|
|
" Do not automatically transform to link, use `<leader>wf` for this
|
|
|
|
let g:wiki_link_toggle_on_follow=0
|
|
|
|
let g:wiki_link_target_type='md'
|
|
|
|
|
|
|
|
let g:wiki_map_text_to_link='Slugify'
|
|
|
|
|
|
|
|
" E.g. transform `My link` into `[My link](my-link.md)`
|
|
|
|
function Slugify(text) abort
|
|
|
|
return [substitute(tolower(a:text), '\s\+', '-', 'g'), a:text]
|
|
|
|
endfunction
|
|
|
|
|
|
|
|
vmap <leader>wf <Plug>(wiki-link-toggle-visual)
|
|
|
|
|
|
|
|
" Automatically save when navigation
|
|
|
|
let g:wiki_write_on_nav=1
|
|
|
|
|
|
|
|
" }}}
|
|
|
|
|
|
|
|
" `tools-life/taskwiki` {{{
|
|
|
|
|
|
|
|
let g:taskwiki_taskrc_location='/home/h/.config/task/taskrc'
|
|
|
|
let g:taskwiki_disable_concealcursor=1
|
|
|
|
let g:taskwiki_dont_preserve_folds=1
|
|
|
|
let g:taskwiki_dont_fold=1
|
|
|
|
|
|
|
|
" }}}
|
2020-08-06 16:36:57 +02:00
|
|
|
|
2023-04-07 22:51:17 +02:00
|
|
|
" `pangloss/vim-javascript` {{{
|
|
|
|
|
2020-05-07 02:11:41 +02:00
|
|
|
let g:javascript_plugin_jsdoc = 1 " jsdoc syntax highlighting
|
|
|
|
let g:javascript_plugin_flow = 1 " flow syntax highlighting
|
|
|
|
let g:javascript_conceal_function = "ƒ"
|
2020-08-06 16:36:57 +02:00
|
|
|
let g:javascript_conceal_return = "⇖"
|
2020-05-13 19:08:38 +02:00
|
|
|
let g:svelte_indent_script = 0
|
|
|
|
let g:svelte_indent_style = 0
|
|
|
|
|
2023-04-07 22:51:17 +02:00
|
|
|
" }}}
|
2022-05-11 01:02:08 +02:00
|
|
|
|
2022-12-01 13:54:13 +01:00
|
|
|
" `.../quickscope` {{{
|
|
|
|
|
|
|
|
let g:qs_max_chars=80
|
|
|
|
let g:qs_lazy_highlight = 1
|
|
|
|
|
|
|
|
" }}}
|
|
|
|
|
2020-03-19 14:28:07 +01:00
|
|
|
|
2021-03-10 17:48:56 +01:00
|
|
|
" Tidalcycles (sclang and vim-tidal)
|
2020-05-08 16:11:55 +02:00
|
|
|
let g:tidal_default_config = {"socket_name": "default", "target_pane": "tidal:1.1"}
|
2023-04-07 22:51:17 +02:00
|
|
|
let g:tidal_no_mappings = 1
|
|
|
|
|
|
|
|
au FileType tidal nm <buffer> <leader>ep <Plug>TidalParagraphSend
|
|
|
|
au FileType tidal nm <buffer> <leader>ee <Plug>TidalLineSend
|
|
|
|
au FileType tidal nnoremap <buffer> <leader>h :TidalHush<cr>
|
|
|
|
au FileType tidal com! -nargs=1 S :TidalSilence <args>
|
|
|
|
au FileType tidal com! -nargs=1 P :TidalPlay <args>
|
|
|
|
au FileType tidal com! -nargs=0 H :TidalHush
|
2020-05-07 02:11:41 +02:00
|
|
|
|
2023-04-07 22:51:17 +02:00
|
|
|
" SuperCollider
|
|
|
|
au BufEnter,BufWinEnter,BufNewFile,BufRead *.sc,*.scd se filetype=supercollider
|
|
|
|
au Filetype supercollider packadd scvim
|
2020-11-02 11:53:18 +01:00
|
|
|
|
2023-04-07 22:51:17 +02:00
|
|
|
" }}}
|
2020-09-19 22:07:29 +02:00
|
|
|
|
2021-03-10 17:48:56 +01:00
|
|
|
" FZF
|
|
|
|
nn <c-p> :FZF<cr>
|
|
|
|
nn <leader>p :FZF<cr>
|
|
|
|
nn <leader>b :Buffers<cr>
|
|
|
|
nn <leader>h :History<cr>
|
2020-09-19 22:07:29 +02:00
|
|
|
let g:fzf_action = {
|
|
|
|
\ 'ctrl-t': 'tab split',
|
|
|
|
\ 'ctrl-s': 'split',
|
|
|
|
\ 'ctrl-v': 'vsplit'
|
|
|
|
\}
|
2022-11-27 23:24:25 +01:00
|
|
|
" Insert path completion
|
|
|
|
ino <expr><c-f> fzf#vim#complete#path('rg --files --sort path')
|
2020-09-19 22:07:29 +02:00
|
|
|
|
2022-11-27 23:24:25 +01:00
|
|
|
" }}}
|
|
|
|
|
|
|
|
" Color theme & statusline {{{
|
|
|
|
"
|
2020-05-13 19:08:38 +02:00
|
|
|
|
2021-03-10 17:48:56 +01:00
|
|
|
se ls=2
|
|
|
|
se stl=\ %0*%n
|
|
|
|
se stl+=\ %m
|
2022-11-27 23:24:25 +01:00
|
|
|
se stl+=\ %y%0*
|
2021-03-10 17:48:56 +01:00
|
|
|
se stl+=\ %<%F
|
2022-11-27 23:24:25 +01:00
|
|
|
se stl+=\ %0*%=%5l%*
|
|
|
|
se stl+=%0*/%L%*
|
|
|
|
|
|
|
|
colo yang
|
|
|
|
|
|
|
|
" }}}
|
2020-11-02 11:54:10 +01:00
|
|
|
|
2022-11-27 23:24:25 +01:00
|
|
|
" Quick hacks {{{
|
|
|
|
"
|
2020-02-16 12:41:12 +01:00
|
|
|
|
2022-11-27 23:24:25 +01:00
|
|
|
fu! Compile()
|
|
|
|
if expand('%:e') == "md"
|
|
|
|
:silent exec "!pandoc % -s -o /tmp/op.pdf &"
|
|
|
|
endif
|
|
|
|
endfu
|
|
|
|
|
|
|
|
fu! Preview()
|
|
|
|
:call Compile()
|
|
|
|
:silent exec "!zathura /tmp/op.pdf &"
|
|
|
|
endfu
|
2020-08-06 16:36:57 +02:00
|
|
|
|
2021-03-10 17:48:56 +01:00
|
|
|
" VIM config hot reload
|
2022-11-27 23:24:25 +01:00
|
|
|
|
|
|
|
" TODO: separate to filetype specific files
|
|
|
|
|
|
|
|
" JS
|
|
|
|
" Jump between `=` and `;`
|
|
|
|
au FileType javascript set mps+==:;
|
|
|
|
|
|
|
|
" JSONC (see https://github.com/neoclide/jsonc.vim/pull/9")
|
|
|
|
au BufNewFile,BufRead */.vscode/*.json setlocal filetype=jsonc
|
|
|
|
|
2023-12-18 13:54:07 +01:00
|
|
|
let s:zk_preview_enabled = 0
|
|
|
|
let s:live_server_job = -1
|
|
|
|
au BufEnter /home/h/.zk/*.md silent exe '!echo "%" > /home/h/.zk/current-zettel.txt'
|
|
|
|
function! ToggleZKPreview()
|
|
|
|
if s:zk_preview_enabled == 1
|
|
|
|
let s:zk_preview_enabled = 0
|
|
|
|
call jobstop(s:live_server_job)
|
|
|
|
au! ZKPreview
|
|
|
|
else
|
|
|
|
let s:zk_preview_enabled = 1
|
|
|
|
let s:live_server_job = jobstart('live-server --watch=/home/h/.zk/current-zettel-content.html --open=current-zettel-content.html --port=8080')
|
|
|
|
augroup ZKPreview
|
|
|
|
au BufEnter /home/h/.zk/*.md silent exe '!cat "%:r.html" > /home/h/.zk/current-zettel-content.html'
|
|
|
|
au BufWritePost /home/h/.zk/*.md silent exe '!make && cat "%:r.html" > /home/h/.zk/current-zettel-content.html'
|
|
|
|
augroup END
|
|
|
|
endif
|
|
|
|
endfunction
|
|
|
|
command! ToggleZKPreview call ToggleZKPreview()
|
2022-11-27 23:24:25 +01:00
|
|
|
|
2023-12-18 13:54:07 +01:00
|
|
|
nn <leader>o :ToggleZKPreview<cr> :!xdg-open http://localhost:8080/%:t:r.html & <cr>
|
2022-11-27 23:24:25 +01:00
|
|
|
|
|
|
|
highlight QuickScopeSecondary cterm=underline
|
|
|
|
highlight QuickScopePrimary ctermbg=253 ctermfg=232 cterm=none
|
|
|
|
highlight Pmenu ctermfg=232
|
|
|
|
|
|
|
|
" Taken from /usr/share/vim/vim90/defaults.vim
|
|
|
|
augroup vimStartup
|
|
|
|
au!
|
|
|
|
|
|
|
|
" When editing a file, always jump to the last known cursor position.
|
|
|
|
" Don't do it when the position is invalid, when inside an event handler
|
|
|
|
" (happens when dropping a file on gvim) and for a commit message (it's
|
|
|
|
" likely a different one than last time).
|
|
|
|
autocmd BufReadPost *
|
|
|
|
\ if line("'\"") >= 1 && line("'\"") <= line("$") && &ft !~# 'commit'
|
|
|
|
\ | exe "normal! g`\""
|
|
|
|
\ | endif
|
|
|
|
|
|
|
|
augroup END
|
|
|
|
|
2023-04-07 22:51:31 +02:00
|
|
|
augroup Vim
|
|
|
|
au!
|
|
|
|
" Reload vim config when ~/.vimrc is changed
|
|
|
|
au BufWritePost $HOME/.vimrc so $MYVIMRC | redraw | echo "Reloaded vimrc"
|
|
|
|
augroup END
|