Compare commits

..

11 Commits

10 changed files with 108 additions and 122 deletions

View File

@ -0,0 +1,4 @@
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>")

View File

@ -0,0 +1,3 @@
" 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>

View File

@ -0,0 +1,3 @@
nmap s <Nop>
xmap s <Nop>
let g:sandwich#recipes = deepcopy(g:sandwich#default_recipes)

View File

@ -0,0 +1,3 @@
xm <leader>c <plug>Commentary
nm <leader>c <plug>Commentary
nm <leader>cc <plug>CommentaryLine

View File

@ -0,0 +1,15 @@
let g:pandoc#syntax#conceal#urls=1
let g:pandoc#syntax#codeblocks#embeds#langs=[
\ 'python',
\ 'bash',
\ 'javascript',
\ 'typescript',
\ 'html',
\ 'css',
\ 'scss',
\ 'json',
\ 'yaml'
\ ]
let g:pandoc#syntax#style#emphases=0 " Bug workaround
let g:pandoc#syntax#conceal#cchar_overrides = { "atx": " ", "li": "·" }
let g:pandoc#syntax#conceal#blacklist=[]

View File

@ -0,0 +1,7 @@
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"]

View File

@ -1,5 +1,44 @@
" " Change local buffer to directory of current file after the plugin has loaded
" Change local buffer to directory of current file after the plugin has loaded
autocmd VimEnter * lcd %:p:h
" " Override wiki index mapping to also cd into the wiki
nm <leader>ww <Plug>(wiki-index) \| :lcd %:p:h<cr>
nm <leader>ww <plug>(wiki-index)
" nm <leader>l <plug>(wiki-next-link)
" nm <leader>h <plug>(wiki-prev-link)
" nm <leader>j <plug>(wiki-link-follow)
" nm <leader>k <plug>(wiki-link-return)
" nm <leader>s <plug>(wiki-link-follow-split)
" nm <leader>v <plug>(wiki-link-follow-vsplit)
autocmd BufEnter *.md if expand('%:t') =~ '_' | echo 'hierarchical relation' | endif
autocmd BufEnter *.md if expand('%:t') =~ '--' | echo 'non-hierarchical relation' | endif
autocmd BufEnter *.md if expand('%:t') =~ '<>' | echo 'dichotomy' | endif
autocmd BufEnter *.md if expand('%:t') =~ 'my-' | echo 'personal file' | endif
autocmd BufEnter *.md if expand('%:t') =~ 'project-' | echo 'project file' | endif
autocmd BufEnter *.md if expand('%:t') =~ 'project_' | echo 'project file' | endif
" Only load wiki.vim for zk directory
let g:wiki_global_load=0
let g:wiki_root='~/.zk'
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
" Links
let g:wiki_link_extension=''
" 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'
" 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
let g:wiki_map_text_to_link='Slugify'
vmap <leader>wf <plug>(wiki-link-toggle-visual)
" Automatically save when navigation
let g:wiki_write_on_nav=1

View File

@ -3,14 +3,18 @@
* Linting & (Auto)formatting
*/
"coc.preferences.formatOnType": true,
"coc.preferences.formatOnSave": true,
"prettier.configPath": ".prettierrc",
"prettier.ignorePath": ".prettierignore",
"prettier.semi": false,
"prettier.tabWidth": 2,
"prettier.singleQuote": true,
"prettier.arrowParens": "avoid",
"prettier.printWidth": 120,
"eslint.format.enable": true,
"coc.preferences.formatOnType": true,
"coc.preferences.formatOnSave": true,
"eslint.onIgnoredFiles": "warn",
// Markdown
"markdownlint.config": {

View File

@ -1,11 +1,15 @@
snippet shebang
snippet shebabash "Bash shebang" i
#!/usr/bin/env bash
endsnippet
snippet shebangp
snippet shebapython "Python shebang" i
#!/usr/bin/env python
endsnippet
snippet shebangn
snippet shebanode "Node shebang" i
#!/usr/bin/env node
endsnippet
snippet shebats "Typescript shebang" i
#!/usr/bin/env ts-node
endsnippet

134
.vimrc
View File

@ -74,9 +74,6 @@ ino <up> <nop>| " "
ino <right> <nop>| " "
" Search
nn <c-_> :noh<cr>| " map 'ctrl + /'
" Use `the_silver_searcher` to find results (for selection if selection)
nn <leader>f :Ag <cr>
vm <leader>f y:Ag <C-r>"<cr>
" Toggle line numbers
nn <leader>n :set nu! rnu!<cr>
" Vim configuration
@ -114,6 +111,8 @@ Plug 'peitalin/vim-jsx-typescript', { 'for': ['typescript.tsx'] }
Plug 'evanleck/vim-svelte', {'branch': 'main'}
" JSON with comments
Plug 'neoclide/jsonc.vim'
" Jupyter
Plug 'quarto-dev/quarto-vim'
" LaTeX
Plug 'lervag/vimtex'
" Wiki
@ -138,22 +137,8 @@ call plug#end()
" Plugin config {{{
" `.../sandwich` {{{
nmap s <Nop>
xmap s <Nop>
let g:sandwich#recipes = deepcopy(g:sandwich#default_recipes)
" }}}
" `.../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
" }}}
" `.../vimtex` {{{
@ -164,101 +149,32 @@ let g:vimtex_quickfix_mode=0
" }}}
" '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' {{{
xm <leader>c <Plug>Commentary
nm <leader>c <Plug>Commentary
nm <leader>cc <Plug>CommentaryLine
" }}}
" `junegunn/fzf` {{{
" `junegunn/fzf.vim`
let g:fzf_layout = {'window': { 'width': 1, 'height': 0.62}}
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'],
\ 'info': ['fg', 'PreProc'],
\ 'border': ['fg', 'Comment'],
\ 'prompt': ['fg', 'Conditional'],
\ 'pointer': ['fg', 'Exception'],
\ 'marker': ['fg', 'Keyword'],
\ 'spinner': ['fg', 'Label'],
\ 'header': ['fg', 'Comment'] }
" FZF
nn <c-p> :FZF<cr>
nn <leader>p :FZF<cr>
nn <leader>b :Buffers<cr>
nn <leader>h :History<cr>
let g:fzf_action = {
\ 'ctrl-t': 'tab split',
\ 'ctrl-s': 'split',
\ 'ctrl-v': 'vsplit'
\}
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"]
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": "·" }
" Insert path completion
" ino <expr><c-f> fzf#vim#complete#path('ag -l -g *.md')
" ino <c-f> <plug>(fzf-complete-file-ag)
ino <expr><c-f> fzf#vim#complete#path("ag -l -g '' \| sed -e 's/\.md$//'")
" Use `the_silver_searcher` to find results (for selection if selection)
nn <leader>f :Ag<cr>
vm <leader>f :Ag <C-r>"<cr>
" }}}
" }}}
" `lervag/wiki.vim` {{{
" Only load wiki.vim for zk directory
let g:wiki_global_load=0
let g:wiki_root='~/.zk'
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
" TODO: configure the following
" let g:wiki_file_handlenmap r
" Links
" FIXME: figure out what '' vs '.md' does
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` {{{
@ -306,18 +222,6 @@ au Filetype supercollider packadd scvim
" }}}
" FZF
nn <c-p> :FZF<cr>
nn <leader>p :FZF<cr>
nn <leader>b :Buffers<cr>
nn <leader>h :History<cr>
let g:fzf_action = {
\ 'ctrl-t': 'tab split',
\ 'ctrl-s': 'split',
\ 'ctrl-v': 'vsplit'
\}
" Insert path completion
ino <expr><c-f> fzf#vim#complete#path('rg --files --sort path')
" }}}