First commit
Already working are: the theme, Goyo, vimwiki and vim-zettel, ultisnips. Wishlist: an easy way to link to anchors in a note, a graph visualization of the notes.
This commit is contained in:
commit
29e52f9e0c
|
@ -0,0 +1,7 @@
|
|||
tags:
|
||||
|
||||
# %title
|
||||
|
||||
----
|
||||
## References
|
||||
|
|
@ -0,0 +1,16 @@
|
|||
[
|
||||
{
|
||||
"name": "ref",
|
||||
"extension": "md",
|
||||
"encoding": "utf8",
|
||||
"formatSource": [
|
||||
"---\n",
|
||||
{ "req": true, "bibfields": [[ "title", false, "title: ", "\n", []]]},
|
||||
{ "req": false, "bibfields": [[ "urldate", false, "date: ", "\n", []]]},
|
||||
"type: ref\n",
|
||||
"---\n\n",
|
||||
{ "req": false, "bibfields": [[ "title", false, "# ", "\n\n", []]]},
|
||||
{ "req": true, "bibfields": [[ "url", false, "[source](", ")\n", []]]}
|
||||
]
|
||||
}
|
||||
]
|
|
@ -0,0 +1,81 @@
|
|||
# Misc
|
||||
snippet date "date YYYY-mm-dd format" w
|
||||
`date +%Y-%m-%d`
|
||||
endsnippet
|
||||
|
||||
snippet ts "timestamp" w
|
||||
`date +%Y-%m-%d\ %H:%M`
|
||||
endsnippet
|
||||
|
||||
# Sections
|
||||
snippet sec "new section" bA
|
||||
[](#`!p snip.rv = "-".join(t[1].lower().split())`)
|
||||
# ${1:${VISUAL:New Section}}
|
||||
|
||||
$0
|
||||
endsnippet
|
||||
|
||||
snippet ssec "new subsection" bA
|
||||
[](#`!p snip.rv = "-".join(t[1].lower().split())`)
|
||||
## ${1:${VISUAL:New Subsection}}
|
||||
|
||||
$0
|
||||
|
||||
endsnippet
|
||||
|
||||
snippet sssec "new sub-subsection" bA
|
||||
[](#`!p snip.rv = "-".join(t[1].lower().split())`)
|
||||
### ${1:${VISUAL:New Subsubsection}}
|
||||
|
||||
$0
|
||||
|
||||
endsnippet
|
||||
|
||||
# Text formatting
|
||||
snippet * "italics"
|
||||
*${1:${VISUAL}}*$0
|
||||
endsnippet
|
||||
|
||||
snippet ** "bold"
|
||||
**${1:${VISUAL}}**$0
|
||||
endsnippet
|
||||
|
||||
snippet *** "bold italics"
|
||||
***${1:${VISUAL}}***$0
|
||||
endsnippet
|
||||
|
||||
snippet // "Comment"
|
||||
<!-- ${1:${VISUAL}} -->$0
|
||||
endsnippet
|
||||
|
||||
# Common stuff
|
||||
snippet img "Image"
|
||||
![${1:pic alt}](${2:path}${3/.+/ "/}${3:opt title}${3/.+/"/})$0
|
||||
endsnippet
|
||||
|
||||
snippet ilc "Inline Code" iA
|
||||
\`${1:${VISUAL}}\`$0
|
||||
endsnippet
|
||||
|
||||
snippet cbl "Codeblock" bA
|
||||
\`\`\`$1
|
||||
${2:${VISUAL}}
|
||||
\`\`\`
|
||||
$0
|
||||
endsnippet
|
||||
|
||||
snippet refl "Reference Link"
|
||||
[${1:${VISUAL:Text}}][${2:id}]$0
|
||||
|
||||
[$2]:${4:https://${3:www.url.com}} "${5:$4}"
|
||||
endsnippet
|
||||
|
||||
snippet fnt "Footnote"
|
||||
[^${1:${VISUAL:Footnote}}]$0
|
||||
|
||||
[^$1]:${2:Text}
|
||||
endsnippet
|
||||
|
||||
snippet ln "Link"
|
||||
[${1:${VISUAL:Text}}](${4:https://${3:www.url.com}})$0
|
||||
endsnippet
|
|
@ -0,0 +1,226 @@
|
|||
" Note taking vimrc
|
||||
|
||||
" Base {{{
|
||||
" Fundamental settings
|
||||
set modelines=1 " Enables the use of modelines to tweak things on a single document scale (see last line for an example)
|
||||
set nocompatible " Don't try to be compatible with vi
|
||||
set path+=**
|
||||
set backspace=indent,eol,start
|
||||
" }}}
|
||||
" Tabs and spaces {{{
|
||||
"Set the size and type of space made by a TAB stroke
|
||||
set tabstop=2 " TABS are read as 2 spaces
|
||||
set softtabstop=2 " TABS are edited as 2 spaces
|
||||
set expandtab " TABS are (actually) spaces
|
||||
set mouse= " Mouse support
|
||||
"}}}
|
||||
" Various UI config {{{
|
||||
" Various tweakings of the UI
|
||||
set cursorline " Highlights the current line
|
||||
set wildmenu " Visual menu for autocompletion
|
||||
set lazyredraw " Do not redraw screen too often (to make macros quicker)
|
||||
set showmatch " Shows matching pairs of [] () etc.
|
||||
" }}}
|
||||
" Shortcuts {{{
|
||||
" AZERTY remappings {{{
|
||||
" Search previous occurence of a word
|
||||
noremap µ #
|
||||
" Jump to correponding parenthesis
|
||||
noremap ù %
|
||||
" Navigate tags
|
||||
noremap <C-p> <C-]>
|
||||
noremap <C-o> :pop<CR>
|
||||
" }}}
|
||||
" Various shortcuts
|
||||
" Various shortcuts called by the <leader> char
|
||||
let mapleader="," " the <leader> char is , (\ by default)
|
||||
let maplocalleader=","
|
||||
" Source vimrc
|
||||
nnoremap <leader>s :source ~/notes/.config/vimrc<CR>
|
||||
" Move through splits with less keystrokes
|
||||
nnoremap <C-h> <C-w><C-h>
|
||||
nnoremap <C-l> <C-w><C-l>
|
||||
nnoremap <C-j> <C-w><C-j>
|
||||
nnoremap <C-k> <C-w><C-k>
|
||||
" FZF shortcuts
|
||||
" Snippets help
|
||||
nnoremap <leader>h :Snippets<CR>
|
||||
inoremap <leader>h <esc>:Snippets<CR>
|
||||
" Vim-Zettel shortcuts
|
||||
nnoremap <leader>n :ZettelNew<space>
|
||||
nnoremap <leader>p :ZettelOpen<CR>
|
||||
nmap <leader>f :ZettelSelectBuffer<CR>
|
||||
imap <silent> <leader>l <esc><Plug>ZettelSearchMap
|
||||
nmap <silent> <leader>l <Plug>ZettelSearchMap
|
||||
nmap T <Plug>ZettelYankNameMap
|
||||
xmap <leader>n <Plug>ZettelNewSelectedMap
|
||||
nmap gZ <Plug>ZettelReplaceFileWithLink
|
||||
nmap <leader>bl :ZettelBackLinks<CR>
|
||||
" }}}
|
||||
" Spelling and autocompletion {{{
|
||||
" Get and correct spelling mistakes
|
||||
setlocal spell
|
||||
set spelllang=fr,en_gb
|
||||
inoremap <C-l> <c-g>u<Esc>[s1z=`]a<c-g>u
|
||||
|
||||
set complete+=kspell " Add dictionary to completion
|
||||
set completeopt=menuone,longest " the way completion are displayed: the longest match first, even displayed if there is only one match
|
||||
set shortmess+=c " Remove the completion info in the bottom left
|
||||
" Navigate the autocompletion menu with arrows
|
||||
inoremap <expr> <Down> pumvisible() ? "<C-n>" :"<Down>"
|
||||
inoremap <expr> <Up> pumvisible() ? "<C-p>" :"<Up>"
|
||||
inoremap <expr> <Right> pumvisible() ? "<C-y>" : "<Right>"
|
||||
inoremap <expr> <CR> pumvisible() ? "<C-y>" : "<CR>"
|
||||
inoremap <expr> <Left> pumvisible() ? "<C-e>" : "<Left>"
|
||||
|
||||
" }}}
|
||||
" Searching {{{
|
||||
" How search results are displayed
|
||||
set incsearch " search as typing
|
||||
set hlsearch " highlight matches
|
||||
" Shortcut to turn off search highlights (typing :nohlsearch being cumbersome)
|
||||
nnoremap <leader>k :nohlsearch<CR>
|
||||
" }}}
|
||||
" Code folding {{{
|
||||
" Fold some nested blocks to help your brain
|
||||
set foldenable " Turn folding on
|
||||
set foldlevelstart=10 " Only fold blocks nested more than 10 times
|
||||
set foldnestmax=10 " Do not fld within folds more than 10 times
|
||||
set foldmethod=indent " Base folding on the indentation
|
||||
" Use space to unfold a block
|
||||
nnoremap <space> za
|
||||
" }}}
|
||||
" Autogroups {{{
|
||||
filetype plugin on " Run ftplugin now to be able to ovewrite..
|
||||
" Commands executed at startup
|
||||
augroup launch
|
||||
autocmd!
|
||||
" Launch Vimwiki at startup
|
||||
autocmd VimEnter * VimwikiIndex
|
||||
" Launch Goyo at startup
|
||||
autocmd VimEnter * Goyo
|
||||
augroup END
|
||||
" Goyo specific commands
|
||||
autocmd User GoyoEnter call <SID>goyo_enter()
|
||||
autocmd User GoyoLeave call <SID>goyo_leave()
|
||||
" }}}
|
||||
" Plugins {{{
|
||||
" Plugin specific settings, using vim-plug https://github.com/junegunn/vim-plug
|
||||
" Check whether vim-plug is installed and possibly install it
|
||||
if empty(glob('~/.vim/autoload/plug.vim'))
|
||||
silent !curl -fLo ~/.vim/autoload/plug.vim --create-dirs
|
||||
\ https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim
|
||||
autocmd VimEnter * PlugInstall --sync | source $MYVIMRC
|
||||
endif
|
||||
" Call vim-plug to look for plugins
|
||||
call plug#begin('~/.vim/bundles')
|
||||
" Declare the plugins to use
|
||||
|
||||
" vim behavior{{{
|
||||
" become a snippet master
|
||||
Plug 'SirVer/ultisnips'
|
||||
let g:UltiSnipsExpandTrigger='<tab>' " Expand snippets with a TAB
|
||||
let g:UltiSnipsJumpForwardTrigger='<tab>' " Use TAB to navigate the different zones of your snippet
|
||||
let g:UltiSnipsJumpBackwardTrigger='<s-tab>' " Use SHIFT+TAB to navigate backwards
|
||||
let g:UltiSnipsSnippetDirectories=[$HOME.'/notes/.config/ultisnip']
|
||||
|
||||
" Pop completion menu automatically
|
||||
Plug 'vim-scripts/AutoComplPop'
|
||||
" }}}
|
||||
" Appearance{{{
|
||||
|
||||
" PaperColor theme
|
||||
Plug 'NLKNguyen/papercolor-theme'
|
||||
|
||||
" Use Goyo, an epurated interface
|
||||
Plug 'junegunn/goyo.vim'
|
||||
|
||||
" Ensure :q to quit even when Goyo is active
|
||||
" https://github.com/junegunn/goyo.vim/wiki/Customization#ensure-q-to-quit-even-when-goyo-is-active
|
||||
function! s:goyo_enter()
|
||||
let b:quitting = 0
|
||||
let b:quitting_bang = 0
|
||||
autocmd QuitPre <buffer> let b:quitting = 1
|
||||
cabbrev <buffer> q! let b:quitting_bang = 1 <bar> q!
|
||||
endfunction
|
||||
|
||||
function! s:goyo_leave()
|
||||
" Quit Vim if this is the only remaining buffer
|
||||
if b:quitting && len(filter(range(1, bufnr('$')), 'buflisted(v:val)')) == 1
|
||||
if b:quitting_bang
|
||||
qa!
|
||||
else
|
||||
qa
|
||||
endif
|
||||
endif
|
||||
endfunction
|
||||
" }}}
|
||||
" Filetypes {{{
|
||||
" vim Markdown
|
||||
Plug 'preservim/vim-markdown'
|
||||
let g:vim_markdown_no_extensions_in_markdown = 1
|
||||
let g:vim_markdown_follow_anchor = 1
|
||||
let g:vim_markdown_frontmatter = 1
|
||||
let g:vim_markdown_math = 1
|
||||
" }}}
|
||||
" Core {{{
|
||||
" FZF
|
||||
Plug 'junegunn/fzf', { 'do': { -> fzf#install() } }
|
||||
Plug 'junegunn/fzf.vim'
|
||||
|
||||
" Vimwiki
|
||||
Plug 'vimwiki/vimwiki'
|
||||
" Settings for Vimwiki
|
||||
" let g:vimwiki_global_ext = 0
|
||||
let g:vimwiki_list = [
|
||||
\{'path':'~/notes/','ext':'.md','syntax':'markdown','index':'README'}
|
||||
\]
|
||||
let g:vimwiki_filetypes = ['markdown']
|
||||
" Disable vimwiki table navigation with tab as it hides ultisnips tab
|
||||
" expansion
|
||||
let g:vimwiki_table_mappings = 0
|
||||
|
||||
" Vim-Zettel
|
||||
Plug 'michal-h21/vim-zettel'
|
||||
" Vim-Zettel options
|
||||
" Per wiki options
|
||||
let g:zettel_options = [{"front_matter" : [["type","note"]],"template" : "~/templates/notes/note.tpl"}
|
||||
\ ]
|
||||
" Note title format
|
||||
let g:zettel_format = "%y%m%d-%H%M-%title"
|
||||
let g:zettel_random_chars = 16
|
||||
" Mappings
|
||||
let g:zettel_default_mappings = 0
|
||||
" Search option
|
||||
let g:zettel_fzf_command = "rg --column --line-number --ignore-case --no-heading --color=always "
|
||||
" }}}
|
||||
|
||||
" Declare plugins to vim
|
||||
call plug#end()
|
||||
" }}}
|
||||
" Colors {{{
|
||||
" To install a new color scheme simply download the colorscheme.vim file in
|
||||
" your ~/.vim/clors and add the relevant line under here.
|
||||
|
||||
" Enabling 'true colors'
|
||||
if (has("nvim"))
|
||||
" For Neovim 0.1.3 and 0.1.4 < https://github.com/neovim/neovim/pull/2198 >
|
||||
let $NVIM_TUI_ENABLE_TRUE_COLOR=1
|
||||
endif
|
||||
" For Neovim > 0.1.5 and Vim > patch 7.4.1799 < https://github.com/vim/vim/commit/61be73bb0f965a895bfb064ea3e55476ac175162 >
|
||||
" Based on Vim patch 7.4.1770 (`guicolors` option) < https://github.com/vim/vim/commit/8a633e3427b47286869aa4b96f2bfc1fe65b25cd >
|
||||
" < https://github.com/neovim/neovim/wiki/Following-HEAD#201605 >
|
||||
if (has("termguicolors"))
|
||||
set termguicolors
|
||||
endif
|
||||
|
||||
" Use the current background color when clearing
|
||||
let &t_ut=''
|
||||
|
||||
set background=dark
|
||||
colorscheme PaperColor
|
||||
|
||||
" syntax enable " If you want syntax coloring...
|
||||
syntax on
|
||||
" }}}
|
||||
" vim: foldmethod=marker:foldlevel=0
|
Loading…
Reference in New Issue