-
Notifications
You must be signed in to change notification settings - Fork 66
WikiJournalIndex: sorting, encoding #178
Copy link
Copy link
Closed
Description
Description
:WikiJournalIndex command
- Creates entries sorted first by year then by month descending that makes most recent entry not at the top but some way down. Expected: ability to have it at top or at bottom, i.e. entries sorted.
- has invalid first symbol if Cyrillic chars used. In the example: "Ð?юль". Expected: first char is correct. In the example: "Июль"
- After saving and reopenning the encoding is undetected and needs
:e ++enc=utf-iexectuded. Expected: encoding detected correctly.
Minimal working example
├── index.md
├── index.wiki
└── дневник
├── 2021-07-20.md
├── 2021-07-21.md
└── 2021-07-22.md
index.md (reopened with :e ++enc=utf-8):
# Index
# 2021
## Ð?юль
[2021-07-20](journal:2021-07-20)
[2021-07-21](journal:2021-07-21)
[2021-07-22](journal:2021-07-22)
index.wiki:
[index.md](index.md)дневник/2021-07-*.md files are empty with one header at top.
vimrc:
let g:wiki_filetypes = ['wiki', 'md']
let g:wiki_link_target_type = 'md'
let g:wiki_month_names = ['Январь', 'Февраль', 'Март', 'Апрель', 'Май', 'Июнь', 'Июль', 'Август', 'Сентябрь', 'Октябрь', 'Ноябрь', 'Декабрь']
let g:wiki_toc_title = 'Содержание'
let g:wiki_journal = {
\ 'name': 'дневник',
\ 'frequency': 'daily',
\ 'date_format': {
\ 'daily' : '%Y-%m-%d',
\ 'weekly' : '%Y_w%V',
\ 'monthly' : '%Y_m%m',
\ },
\}
function! MyWikiBufferInit()
try
colorscheme onehalflight
" colorscheme onehalfdark
catch
endtry
try
CocDisable
catch
endtry
set laststatus=0
set foldcolumn=4
au! BufWritePost ~/mydir/notes/* !git add "%";git commit -m "Auto commit of %:t." "%"
nmap <leader>mh :s_\v^((#+) +)?(.*)_#\2 \3_e<CR> :noh<CR>
nmap <leader>mH :s_\v^#(#* )? *(.*)_\1\2_e<CR> :noh<CR>
endfunction
augroup MyWikiAutocmds
autocmd!
autocmd User WikiBufferInitialized call MyWikiBufferInit()
augroup END
function! MyWikiClean()
" Clean escape '\' chars inserted by Evernote export.
%s_\\__gce
" Clean enclosing of links with '<' and '>' chars.
%s_\v\<([^\>]+)\>_\1_gce
%s_\v\!\[\]\((local.*\/([^\)]+))\)(\{wid[^}]*\})?_[\2](\1)_
endfunction
let g:wiki_map_link_create = 'WikiRemoveWhitespaceLinkCreate'
function WikiRemoveWhitespaceLinkCreate(text) abort
if a:text !~# '\v(md|wiki|txt)$'
return strftime('%Y%m%d%H%M') . '_' . substitute(tolower(a:text), '\s\+', '_', 'g')
endif
return a:text
endfunction
let g:wiki_viewer = {
\ '_' : 'xdg-open',
\}
let g:wiki_file_open = 'WikiFileOpen'
function! WikiFileOpen(...) abort dict
if self.path !~# '\v(md|wiki|txt)$'
silent execute '!xdg-open' fnameescape(self.path) '&'
return 1
endif
return 0
endfunctionReactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels