Comments (6)
Hi again,
I found a first workaround. By adding
noremap <Leader>v :Lines<CR>title:<Space>
to my vimrc. Like this the command 'Lines' from fzf is used to search for 'title:'. This will show a list of all open Zettels that include a 'title:' in the YAML-header. Then by typing the desired title and hitting enter you can directly jump to that Zettel.
Nonetheless it is still a workaround since you can not see the status of the buffer. This would help for example to see if you need to save a Zettel before closing it:
:ls[!] [flags]
Show all buffers. Example:1 #h "/test/text" line 1 2u "asdf" line 0 3 %a + "version.c" line 1
[...]
Indicators (chars in the same column are mutually exclusive): u an unlisted buffer (only displayed when [!] is used) unlisted-buffer % the buffer in the current window # the alternate buffer for ":e #" and CTRL-^ a an active buffer: it is loaded and visible h a hidden buffer: It is loaded, but currently not displayed in a window hidden-buffer - a buffer with 'modifiable' off = a readonly buffer R a terminal buffer with a running job F a terminal buffer with a finished job ? a terminal buffer without a job: :terminal NONE + a modified buffer x a buffer with read errors
from vim-zettel.
@LibrEars I've added a new formatting variable, g:zettel_bufflist_format
for that. You can set it to "%filename - %title"
to see both title and filename.
from vim-zettel.
Here is a function that uses a modified example of buffer selection function from FZF. It loops over lines returned from :ls
, extracts filenames, and retrieves titles using the zettel#vimwiki#get_title
function.
function! s:buflist()
" redirect :ls to a variable
redir => ls
silent ls
redir END
let lines = split(ls, '\n')
let newlines = []
" run over buffers
for line in lines
let filename = matchstr(line, '\v"\zs([^"]+)')
" we need to expand the matched filename to a full path
let filename = fnamemodify(filename, ":p")
" use vim-zettel command to read title
let title = zettel#vimwiki#get_title(filename)
" add title to the result of :ls
call add(newlines, line . " - " . title)
endfor
return newlines
endfunction
function! s:bufopen(e)
execute 'buffer' matchstr(a:e, '^[ 0-9]*')
endfunction
nnoremap <silent> § :call fzf#run({
\ 'source': reverse(<sid>buflist()),
\ 'sink': function('<sid>bufopen'),
\ 'options': '+m',
\ 'down': len(<sid>buflist()) + 2
\ })<CR>
The result looks like this:
1 %a "markdown/pokus.md" line 16 - First file
2 # "~/scratchbox/vimwiki/markdown/200908-1431.md" line 1 - Title one
> 3 "~/scratchbox/vimwiki/markdown/200226-1314.md" line 13 - Title two
from vim-zettel.
This is exactly what I had dreamed of! Thank you very much! Should be added to vim-zettel default functions =)
from vim-zettel.
I've added a :ZettelSelectBuffer
command, it should do this trick. It even hides the filenames, unless the file is missing a title.
from vim-zettel.
Nice!
For some it might be convenient to still see the filenames in parallel.
I close the Issue. Thank you again :)
from vim-zettel.
Related Issues (20)
- Make :ZettelOpen jump to correct line HOT 4
- Would it be possible to use Telescope rather than fzf? HOT 9
- Linking visually selected text to an existing zettel HOT 3
- Allow for NV-like creation of new zettel HOT 1
- Error when running ZettelInbox on Vimwiki dev branch HOT 4
- ZettelSearch and insert mode HOT 1
- :ZettelSearch and :NV search different things HOT 1
- Feature Request: ZettelOrphanedPages?ZettelOrphans
- Should this work in Neovim? I cannot make it create notes anywhere but current directory HOT 7
- :ZettelOpen & :ZettelSearch don't work HOT 8
- Disregard
- Question: Using vim-zettel with 11ty - Generating 11ty links on output HOT 1
- Create zettels in a subfolders? HOT 12
- Zettels are not created in the current subfolder. HOT 7
- No File extension when new zettel is created from outside a Wiki HOT 3
- Error when creating new Zettel HOT 2
- General Question: How do you properly use tags? HOT 2
- 关于vim-zettel的4个方面问题反馈与求助~~ HOT 1
- Link does not show the title HOT 5
- z command breaks with gvim HOT 8
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from vim-zettel.