This function evaluates current cursor position or selected range and tries to find out what your intent is, when pressing the hotkey invoking the function:
- Under a markdown title: Google the title (so that you find out which link you want to reference in the link)
- Under a ref: Open it in the editor. If not present and a MD ref: Create the file, open it.
- Under a manpage link: Open it
- Under a normal word or selected range: Google it
If you marked a bunch of URLs, those will be opened in browser as well.
Word | Whole Line Valid Cursor Positions: ^ Open Action |
Comment |
---|---|---|
readme |
[foo bar][hosts](, g bla) ...........^^^^ ✔️ /etc/hosts |
Ref link to existing file is opened |
x |
[new]: /tmp/vpeso.gk/m1.md .........^^^^^ ✔️ /tmp/vpeso.gk/m1.md |
Ref link to existing file is opened |
x |
foo [xxx](x1/x1.md) .........^^^^^ ✔️ /tmp/vpeso.gk/x1/x1.md |
Linked non existing markdown files: Dir created, file unsaved opened in vi dir created content: # xxx LS |
bashrc |
foo ~/.bashrc ....^^^^^^ ✔️ /home/gk/.bashrc |
tilde replaced, file open in vi |
bashrc |
foo $HOME/.bashrc ....^^^^^^^^^^^ ✔️ /home/gk/.bashrc |
$HOME replaced |
bashrc |
'foo ~/.bashrc' .....^^^^^ ✔️ /home/gk/.bashrc |
tilde replaced, file open in vi |
etc |
foo some_func("/etc/hosts") bar ...............^^^^^^^^^^ ✔️ /etc/hosts |
file name extracted |
etc |
foo some_func(^/etc/hosts^) bar ...............^^^^^^^^^^ ✔️ /etc/hosts |
file name extracted in backticks |
bla |
foo [xxx](/tmp/vpeso.gk/m1.md.tst) .........^^^^^ |
No auto creation of non .md file |
x |
x b [a][foo bar] x ^ |
< 3 letter words (x) are not googled |
y |
x b [a][foo bar] y ................^^ |
y only: no action |
testimg |
x b ![](./testimg.png) ..........^^^^^^ ⌨ $BROWSER "/tmp/vpeso.gk/testimg.png" >/dev/null 2>&1 |
Must run the image open command |
foobar |
a foobar bar foo .^^^^^ 🌐search: client=%s-b-d&q=foobar |
|
foobar |
foobar bar foo ^^^^^^ 🌐search: client=%s-b-d&q=foobar |
|
a |
b [a](http://foo/bar) x .....^^^^^^^ 🌐 http://foo/bar |
|
a |
b <http://foo/bar> .....^^^^^^^ 🌐 http://foo/bar |
|
a |
b <https://foo/bar> .....^^^^^^^ 🌐 https://foo/bar |
|
foo |
[foo]: http://foo.bar ^^^^^^^^^^ 🌐 http://foo.bar |
|
git |
a "git/hub" foo ...^^^^^^ 🌐 https://github.com/git/hub |
github default for 2 word slash sepped |
foo |
[foo]: http://foo.bar . .^ 🌐 http://foo.bar |
Splits off after the link by space |
foo |
[foo bar]: ^^^^^ 🌐search: client=%s-b-d&q=foo bar |
No link -> google title |
foo |
x b [a][foo bar] x .......^^^^^ 🌐 http://foo.bar |
Find defined link in the file, open it |
a |
x b [a][foo bar] x ....^^ 🌐search: client=%s-b-d&q=a |
Google the title |
barx |
x b [barx bah][foo] x ....^^^^^^^^^ 🌐search: client=%s-b-d&q=barx bah |
Google ALL title |
Notes: - backticks replaced with ^ - Testfile contains markdown ref: [foo bar]: http://foo.bar |