Giter VIP home page Giter VIP logo

vimflowy's Introduction

Vimflowy: Vim shortcuts for Workflowy

This extension adds (some) VIM keyboard shortcuts to Workflowy.com.

These keyboard shortcuts are similar, if not identical, in their behaviour to the ones that can be found in the text editor called VIM. All VIM behaviours are not supported yet. New shortcuts are continously added.

Keybindings

Vimflowy will block keystrokes which haven't been bound in all modes - except insert mode. However, keys that have been modified with ALT/CTRL/META (but not SHIFT) are allowed to passthrough. For example <Shift>d will be blocked but <Ctrl>d or <alt>d will be allowed to pass through.

  • Normal mode
    • j: Move down one item
    • k: Move up one item
    • h: Move cursor left
    • l: Move cursor right
    • i: Insert before currently selected character
    • a: Insert after currently selected character
    • I: Insert at the beginning of the line
    • A: Insert after the end of the line
    • /: Start search
    • o: Create a new bullet below current line and go into insert mode
    • O: Create a new bullet above current line and go into insert mode
    • e: move to end of word
    • w: move forward one word
    • b: move backwards 1 word
    • 0,B,^: Move cursor to the first character of the line
    • E,$: Move cursor to the last character on the line
    • gg: Go to top most root item on page
    • g: Go to root item of the currently focused list
    • G: Go to the bottom of focused list
    • GG: Go to the bottom of current list, recursivly
    • #: search for the word under the cursor. Works as tag search.
    • u: Undo
    • <Ctrl>r: Redo
    • y: yank (duplicate) focused items
    • Y: yank (mirror) focused items
    • p: paste yanked items below focused item
    • P: paste yanked items above focused item
    • <alt>l: Zoom in on focused node 1 step and retain focus on that node
    • <alt>h: Zoom out of focused node 1 step and retain focus on that node
    • <Alt>J: Move the current line down
    • <Alt>K: Move the current line up
    • <Alt>1-7: Color focused item name/note (depending on where the cursor is)
    • <Alt>0: Remove coloring from the focused item name/note (cursor dependent)
    • <ctrl>h: zoom out (identical behaviour as WF zoom out - but instant)
    • <ctrl>l: zoom in (identical behaviour as WF zoom in - but instant)
    • <ctrl>j: Jump to node via EasyMotion
    • <Ctrl>c: Copies focused item to clipboard; enabling you to paste items between browsers.
    • V,v: Enter visual mode
    • >,<alt>L,Tab: indent item(s)
    • <alt>H,<shift>Tab: outdent items
    • <: outdent items (and selected kids once the parent item hits the wall)
    • <Alt>Enter: Will open first URL found in the focusedItems name or note. Works with Workflowys inline linking feature.
    • <Shift><Alt>Enter: zoom in on a mirrored items parent. (use backspace to get back again)
    • Space, z: toggle expand/collapse on focusedItem
    • <ctrl>Space: toggle expand/collapse on all items under currentItemRoot
    • Enter: Zoom in on focused node - and place current item in memory
    • Backspace: zoom in on item which was place in memory when using 'Enter'
    • <alt>§, <alt>`: toggle work time counter; displaying num (8 hour) days and num (5 day) Weeks worth of tags. (use #1d, #2h, #30m tags for it to count)
    • §, `: sort completed items according to time and place them at the bottom
    • r: replace character under cursor
    • x: remove character under cursor
    • s: remove character under cursor + insert mode
    • f: find character after cursor in current line. Ex: fb will find the 1st b occurence, 3fb will find 3rd b occurence.
    • t: same as 'f' but cursor moves to just before found character
    • F: backwards version of 'f'
    • T: backwards version of 't'
    • S: substitute entire line - deletes line, enters insertion mode
    • C: change to end of line
    • d$, D: delete to end of line
    • dd: yank items (by copy) and delete the currently selected item(s)
    • de: cut from cursor location to the end of the current word
    • dm: detach mirror
    • ce: de + goToInsertMode
    • dw: cut from cursor location to next word
    • cw: dw + goToInsertMode
    • dn: delete note
    • cn: change note == delete note + insert mode
    • diw: delete word under cursor. Works with a numeric 0-9 prefix to make the command repeat. 4ciw, for example.
    • ciw: deletes word under cursor + insert-mode. Works with a numeric 0-9 prefix.
    • daw: deletes word under the cursor and trims off any white space at the end. Works with a numeric 0-9 prefix.
  • insert mode
    • <jk> : Enter Normal mode
  • visual mode
    • >,<alt>L,Tab: indent item(s) + enter normal mode
    • <alt>H,<shift>Tab: outdent items + enter normal mode
    • <: outdent items (and selected kids once the parent item hits the wall) + enter normal mode
    • V,v,<Esc>: Enter normal mode
    • y: yank (duplicate) focused items and enter normal mode
    • Y: yank (mirror) focused items and enter normal mode
    • d: yank (copy) + delete selected items + enter normal mode
    • D: delete notes on all selected items
    • G: Adds the siblings below to the selection
    • g: Adds the siblings above to the selection
    • GG: Adds the ancestors below to the selection
    • gg: Adds the ancestors above to the selection
    • <Alt>J: Move the current selection down
    • <Alt>K: Move the current selection up
    • u: Undo + exit visual mode
    • <Ctrl>r: Redo
    • <Ctrl>c: Copies selected items to clipboard; enabling you to paste items between browsers.
    • Space: toggle expand/collapse on focusedItem
    • <ctrl>Space: toggle expand/collapse on all items under currentItemRoot
    • <Alt>1-7: Color selected items
    • <Alt>0: Remove Color from selected items
  • all modes
    • <Esc>, <ctrl>[: Enter Normal mode
    • <Ctrl>Dead, <Ctrl>;, <Ctrl>:: Use Workflowys JumpToItemMenu
    • <Ctrl>k: Edit links when focusing on a link. Secondary behaviour is to prompt the Workflowys JumpToItemMenu
    • <ctrl>Enter: Toggle Completed on seletion

Mode indicator

In the bottom left corner there is a mode indicator that shows what mode you are in currently.

Rebinding keys

You'll have to edit keybinding.js or transparentKeybindings.js if you want to rebind or add new shortcuts.

mac users: if you want to bind stuff to Cmd you'll have to type "meta-" instead. "meta-j" instead of "cmd-j" for example.

Usage tips

If you're using cvim (or any other Chrome extensions that install modal keybindings), make sure you add http*://*.workflowy.com/*to the excluded URLs.

Installation

The extension is available on the chrome web store

But you can also download and install an unofficial version:

  1. Clone this repo (or your fork) somewhere on your filesystem.
  2. go to chrome://extensions/
  3. click 'Load unpacked extension...' button right below 'Extensions' header in the top left corner of the page
  4. point at the vimflowy repo directory
  5. refresh workflowy page

Tested on

The extension has mainly been tested on nordic QWERTY keyboards running windows 10, but it should work on other keyboard configurations as well. Please report any bugs you might find at Issues

Buy Me A Coffee

vimflowy's People

Contributors

8utl3r avatar aagerblad avatar jvaelen avatar matthulse avatar tarnas14 avatar wojnach avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

vimflowy's Issues

[bug] Vimflowy not working as of today

Hi! First of all, thanks for the extension, I wouldn't be using workflowy without it.

As of today, vimflowy seems to not be working at all for me (and at least another user) as if the extension isn't loaded. It may be related to a recent workflowy update ?

In the console log of my browser, I can see an error: Uncaught TypeError: Cannot read properties of null (reading 'addEventListener') at vimflowy.js:13:15. I can see it's related to the creation of the mainContainer variable but I don't know much about web/js so I can't really help more than that.

Add support for boards

When you use boards there isn't a way to jump between the board columns, it just treats the first one as if it were the only one.

Normal mode issue with <command>o on mac

When in normal mode if you use the shortcut for show/hide completed items it treats it as if it just pressed "o". The shortcut on mac is "o" so it's likely just not blocking when is pressed.

G doesn't go to bottom of long list of items

I have a page with a very long list of items that is longer than one page. G does not go to the bottom. It doesn't go to the bottom of the page, either. GG does not either. However, if I do G, then wait till it jumps, then G again, then it will go to the bottom.

command K shortcut to display change link name prompt no longer works

Usually if you wanted to add hyperlink to a text, you would select text and hit ⌘+K on the mac. This will show a contextual prompt where you can then put in the link and change the display of the text. This can also be done for hyperlinks.

This used to work. However, when hitting the hot key, it now always goes to the page switcher view.

I figured out that the Vimflowy extension was causing this by simply disabling it

Jump to node

I honestly have no idea if this is possible...but as an idea:

Press a key, say 'f' for example and navigation hints pop up at every line on the page (other letters for hints). So if I'm looking at a long list with lots of nodes I can simply press 'f-v' to jump down to a specified line (the one with the 'v' hint popup in this case). This would super charge movement

[question] [feature request] How to "unblock"/passthrough certain keys to other extensions?

Thanks for the great extension,
I love using vim motions/keybings for workflowy, but I also want to use them elsewhere for browser navigation.
As such, I also use vimium / vimium-c to navigate the browser.

For the most part, I'm okay with just blacklisting workflowy URLs (as suggested in the README), but the real sticking point is I can't use my vim keybinds (e.g. J, K) to switch tabs out of a workflowy.com tab, which interrupts my flow and forces me to use my mouse or one of the clunkier non-vim shortcuts for tab navigation.

Is there a way to selectively "unblock" / allow to pass-through a subset of keys in normal mode? (this would allow me to use keys unused by vimflowy but usable by vimium for navigation).
If needed, I'd be willing to just patch together changes to keybindings.js or transparentKeybindings.js on my own local fork as a workaround - I'm just not sure what I would need to do. Would setting "K" as a keymap which does nothing in transparentKeybindings be sufficient to let it pass through for instance?

as a more flexible future solution which would likely require a lot more work, it would be great to be able to specify keys that get passed through in the options tab - ( this is something vimium has implemented for example: mode_key_handler.js )

Almost all functionality stopped working suddenly

I assume something has changed on the Workflowy side.
As of today I can't get any features to work. Updated to latest version (0.0.4.1) to make sure I wasn't missing some bugfix.
I can see the mode indicator in the bottom left corner, so the extension is running.
Examples of features not working:
Esc causes the search functionality to popup, rather than take me to NORMAL mode
Pressing any button in NORMAL mode will result in writing, rather than the intended command.

Is anyone else seeing this?

[help][feature request] Moving within a large item

If I have an item that is very long, like a paragraph, what is the easiest way to move around in it? All I can find so far are very inefficient ways:

  • w, e, etc to move word by word, or even 20w all are too imprecise
  • f to find the first letter, but then I have to do it over and over to get to the word I want
  • / search is what I would use in vim, but all it does is narrow down the nodes on the page to ones that contain that word. And then the cursor still does not go to the word that was searched, it simply highlights it (workflowy's default behavior)
  • j, k move item by item, so skip over lines within an item
  • A, ^, 0, $, etc all move to the very beginning or end of the item (basically soft line wrap)

Am I missing something? If not, could this be added as a feature? Some way to search within an item (similar to f and t) to move the cursor, but with greater control than just a single letter.

Thanks!

j/k keyboard navigation broken on new backlinks section

Using j/k navigation breaks on Backlinks. When going down, the cursor skips the backlinks section entirely. When going up, the cursor stops on the backlink section and won't go any further up. Using the arrow keys is a workaround, but j/k navigation as it is doesn't work with backlinks.

Note: Backlinks is a labs feature.

add support for transclusion

the most recent beta has included transclusion (finally...), I was wondering how hard it would be to add support for that via the vimflowy extension. I was thinking something like 'yc' or 'cc' for clone? or even 'cd' for clone then immediately delete clone and add it to clipboard then 'p' to place clone via clipboard.

NormalMode: <Enter> bleeding through and modifying bullet name before zoom in.

In normal mode, zooms into a node, but I've noticed recently it's modifying the node names. My guess as to what's happening is somehow the enter keypress is "bleeding through" and splitting / overwriting whatever was under the cursor in normal mode.

I hadn't noticed this happening before, so not sure if it's related to the March 20th changes.
Poking around, it seems like it might be related to

Enter: e =>
{
const focusedItem = WF.focusedItem();
if(e.shiftKey && focusedItem)
{
goToInsertMode();
return;
}
PrevEnterItem = WF.currentItem();
if(focusedItem)
{
// console.log("transparent Enter (NORMAL) valid focus");
e.preventDefault()
e.stopPropagation()
// WF.zoomIn(focusedItem);
WF.zoomTo(focusedItem);
WF.editItemName(focusedItem);
}
else
{
// WF.zoomIn(WF.currentItem());
WF.zoomTo(WF.currentItem());
WF.editItemName(WF.currentItem());
}
},

specifically:
e.preventDefault()
e.stopPropagation()

Also looks like there was some mention of bleed through / not stopping propagation previously here:
eaa4596

ZoomIn (ctrl-l) and ZoomOut (ctrl-h) now zoom instantly. The zoom animation was causing input to bleed through - even though event.preventDefault() and event.stopPropagation() was being called.

Add support for Text Objects

Great extension! It would be fantastic to also have support for Text Objects like inner/all e.g. ciw or daw or 3daw

[feature request] Page movement

This is a great extension! One of the things I am missing (which would be very helpful with long lists) is some of the cursor movements:

  • H: move cursor to item at the top of the "page"
  • M: put the cursor in the middle of the "page"
  • L: Put cursor on item at the bottom of the "page"

In the above, the "page" is the things that you can currently see on the page. Not sure if that is feasible.

  • zz: Whatever item is under the current cursor position, scroll the page so that it is in the middle
  • zt: Whatever item is under the cursor, scroll the page so that it is at the top
  • zb: Whatever item is under the cursor, scroll the page so that it is at the bottom

Obviously, for these it depends on how much can be scrolled.

Options page to control <jk> mapping

As someone who regularly types jk in insert mode, it's an inconvenience that it unintentionally brings me to normal mode.

I'd be willing to send a pull request to control (i.e. disable) this mapping.

  1. Are you open to this suggestion?
  2. Do you have any requirements for the design of the options page and what else should go there?

I've attached a simple mock for what the options page could look like.

Screenshot 2023-03-09 at 23 50 38

Tip: How to bind "alt" keybindings on mac

Background:
I was having issues using the "alt-j" and "alt-k" commands on Mac to move items up and down. This was due to the default behaviour on Mac to type the characters "∆" and "˚" when pressing alt-j and alt-k respectively.

Initially I tried to edit the keybindings to another combination i.e. "meta-j" and "meta-k", but this conflicted with WorkFlowy's jump menu command.

Solution:
I found that you can bind "alt-∆" and "alt-˚" in place of "alt-j" and "alt-k" in keybindings.js, and it works perfectly fine on Mac.

Note: Thanks for working on this extension! I was so happy when I found it.

'Jump To' search doesn't seem to work with vimflowy enabled

Cmd + K triggers a 'Jump To' navigation shortcut allowing search terms to be used to select a bullet to jump to.

I've found that If vimflowy is in INSERT mode, the Jump To search box works. However, if in NORMAL mode, the behavior is erratic. Only certain characters can be typed, unable to delete or escape. Must use the mouse to click outside of the dialog box to get it to go away.

The following console error appears while trying to use the Jump To search box from NORMAL mode:
image

On a semi-related note, when in NORMAL mode, the Cmd+? shortcut to show keyboard shortcuts does not work.

Extension no longer loads

Not sure if this is my fault or not but the extension is not loading on workflowy.com at the moment.

Steps taken to troubleshoot:

  1. Reloaded page
  2. Uninstalled and reinstalled extension
  3. Restarted computer (macos, mojave)
  4. Uninstalled and reinstalled extension

No dice on any of this. Haven't tried with a different computer yet. Other extensions are functional, even ones that read page content. Vimflowy extension has permission to read workflowy.com.

Thanks! I'll keep researching on my side as I'm able. Don't know if this is affecting anyone else (I kinda doubt it is).

alt-h doesn't always retain cursor position

First off, thank you for this! I had turned off vimium for workflowy and really missed my vim mappings!!

If i am on a page with a bunch of bullets, then I open one, and then I do <alt>-l to zoom in, the cursor position remains where I was anywhere under that bullet. However, when I then zoom back out with <alt>-h, the cursor usually goes to the very top of the long bullet list.

Esc always removes search

When I am in either insert or normal mode, <esc> always removes any search. Is this on purpose?

For instance, I am at a very top level. I search for something using /. I then navigate around to an item, and do something in insert mode. I then want to go back to normal mode and hit <esc>. It then removes the search that I had, which is not expected. The only way I know to then get out of insert mode is to do <jk>. However, my vim muscle memory always hits <esc> after typing, and removing the search is not expected.

Toggle collapse does not work in search

EDIT: It is only in search that this does not work.

When I have a search active (which I do a lot, and this is why I didn't notice that this was only happening on search!), and then I am nagivating down through the items, toggling the collapse of an item does not work for me. None of the following work in visual or normal mode:

  • Space
  • z
  • <ctrl>Space

I can still select an item by hitting enter, but then I encounter the problem in #24 that when I come back the search is gone.

I can use my mouse and the normal WF of right clicking and then selecting Expand all, so WF can still do it.

It would be really helpful to be able to toggle the collapse on items after you have searched for something.

alt shortcuts / keybinds don't work on Mac

I'm on Mac, and none of the keybinds involving alt seem to work for me.

This might be related to #16 (i.e. Mac handles alt+key differently to other operating systems). But even the modifications made to that thread/commit don't seem to be working for me...

Sometime soon I can try just rebinding those shortcuts. Are there any suggestions for how to log what vimflowy thinks is being pressed when I hit alt-j for instance? Then I can use that to help debug

<Backspace> does not remember search

Similar to #23, if I have a search and then zoom in on an item with Enter, when I try to go back using Backspace, it goes back to the previous item but the search query is no longer there. This is also true for things like <alt>l, where it moves down one but without the search. Is this indended?

If the behavior here and in #23 are on purpose, then it would be nice to be able to remember previous search, as with vim. For instance, when you hit / in vim, you can then use the arrows to go back in your search history. This doesn't work in Vimflowy, so once I lose my search, I have to type it in again. This is problematic for me because I use tags a lot, so I want to search for my tags. Some of them are pretty long, so typing them out again is cumbersome.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.