Comments (8)
In principle, this is already possible by defining your own VimwikiLinkHandler function, see :h VimwikiLinkHandler
. It is called every time the user tries to open a link. Inside the function, you can do whatever you want, roughly like this:
function! VimwikiLinkHandler(link)
if a:link =~ "command:"
let command = a:link[8:]
exe ":r!".command
return 1
endif
return 0
endfunction
(BTW: cool, syntax highlight in github comments, is this new?)
This is the applied unix principle: one tool for every task, combined through shell calls.
(BTW 2: I guess you don't want to actually replace your executable link with the output, because then you can use the link only once. Although you can make the file readonly, so that the inserted text is not saved but every time recomputed when the file is opened or the user activates the link.)
from vimwiki.
Einfach wrote: "(BTW 2: I guess you don't want to actually replace your executable link with the output, because then you can use the link only once."
Ahhh well there's the rub, I think s/actual replace/visually replace/
I'd like it to output to a block of text defined as a region. Full behavior handling would include actions for hitting enter within that region.
With the cursor over the top line of the new block, (the same line that contained the Description a second ago) the raw link should become visible, like normal link behavior. Hitting Enter again (or just cursor-position-over?) reverts the block back to the description, so enter-enter toggles the block visibility.
Move the cursor down into the block text region (presuming it is more than one line) and hitting enter anywhere in there could take yet another (pre-defined) action. If the block opened a task-query-output, then hitting enter in that region could then launch plugin command :TW withthatquery, for example.
Einfach wrote: "..the inserted text is not saved but every time recomputed when the file is opened or the user activates the link"
and I agree :)
from vimwiki.
OK, as far as I understand, you want something similar to a popup that shows some specific infos if you activate a link. There is this project: http://vimuiex.sourceforge.net/index.html that tries to provide pseudo-UI inside a terminal Vim, and I believe I once saw another “library” with roughly the same purpose.
But… it seems to me like really complicated stuff.
Why not follow the approach I suggested? You could have in your wiki file a link like [[showtasklist|click here to show the current task list]]
and write a VimwikiLinkHandler that, when given a link showtasklist
, adds lines beneath the link into the Vim buffer that look like task1 2013-11-04 description [[taskdone:task1|click here to mark the task as done]]
and maybe changes the link to [[deletenextlines|click here to hide the task list]]
. Of course, the link handler has to handle links of the form taskdone:taskname
and deletenextlines
appropriately.
And in order to prevent the open task list from being saved, set and unset the 'readonly' option or whatever.
from vimwiki.
@EinfachToll, thanks for the examples, I'm going to have to learn a bit more, try them out and then have better feedback, but I think that's the idea.
but on the topic, of linking or embedding a command to see the results in a wiki page, does transclusion behavior have anything to add here? If the link is a command-with-args and the result is inline, as a block, that's sort-of transclusion, isn't it?
{{:! task overdue +foo}}
from vimwiki.
When using transclusions, the content is only expanded and included in the .html file, when you convert your file, not in your .wiki file.
from vimwiki.
Ohh.. copy that :)
from vimwiki.
Hi, I came across this because I use vimwiki and was looking for a similar feature. This sounds to me like orgmode's babel. Is there anyway to get this functionality in vim/vimwiki? Would something like this fit into vimwiki's vision?
EDIT: btw, VimOrganizer seems to do this by calling into org-babel itself. I think having emacs and orgmode as a dependency is not an option, but maybe the implementation could be helpful and for example just Vimscript or python could be supported initially.
from vimwiki.
Using a custom VimwikiLinkHandler is the best option for this functionality.
from vimwiki.
Related Issues (20)
- vimwiki2htmlall with syntax=default doesn't render font changes in HTML HOT 1
- Vimwiki does not recognize filetype on startup HOT 1
- Feature: Add depth setting and locality to VimwikiGenerateLinks
- (Feature Request/I'm building it) Vimwiki Agenda HOT 3
- Renaming page with <leader>wr fails to update links in existing pages HOT 4
- vimtex cannot detect mathzone in vimwiki markdown file
- Failed to generate markdown style link with Lazy.nvim HOT 1
- VimWiki and Goyo HOT 1
- Failure in Exapanding snippets/Ultisnips in inline math mode of vimwiki
- Improve docs for opening links in existing split: How to give [reuse] Argument to VimwikiSplitLink? HOT 2
- Is it possible to make enter on GitHub links go to repo in filesystem? HOT 1
- (neovim) Vimwiki always creates .wiki files instead of .md HOT 2
- How can I disable VimWiki's table mode? HOT 1
- vimwiki_tags not generated for markdown syntax files
- Macro slows down with each iteration HOT 4
- VimWiki "Wiki" section in Github allows everyone to create pages HOT 2
- Addition of new line is not reflected in conversion from .wiki to .html HOT 1
- Help setting different dirs from diary and zk
- Link works for VIM 9.0 but report error for VIM 9.1
- Links that line wrap are badly formatted HOT 3
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 vimwiki.