lighttable / vim Goto Github PK
View Code? Open in Web Editor NEWVim keybindings for Light Table
License: MIT License
Vim keybindings for Light Table
License: MIT License
Currently search function doesn't behave in the vim mode like it does in the vim itself.
The search will move cursor back to the skipped result.
The vim behavior: there is no currently highlighted found text in vim. If you move the cursor down, the search will continue to show results after current cursor position.
In #40 and other cases, we want to map visual mode keys to commands that operate on what's selected. Unfortunately, on OSX 10.9, LT 0.6.7 and Vim 0.1.0, CodeMirror appears to be losing its selection. To recreate this:
Map a visual mode key to a command e.g. in user.behaviors:
(:lt.plugins.vim/map-keys-visual {"=" ":ltexec smart-indent-selection"})
Put a debugging statement in that command to demonstrate what's selected: (prn "HERE" (editor/selection cur))
Select something and press '='. You should see "HERE" ""
printed to the console indicating selection is last. If you select and then run the command Editor: Smart indent line(s)
, you'll see a selection printed.
Further investigation required to determine if this is a bug with CodeMirror or LT
ZZ is an alias for ":x" (short for ":xit" or ":exit"), which itself is like ":wq" except it only writes if the file has been modified.
I can't be the only one who prefers using ZZ over :wq. If it's not too hard to contribute, I may add a PR for this.
And the solution is easy:
https://github.com/LightTable/Vim/blob/master/vim.js#L584
->
https://github.com/marijnh/CodeMirror/blob/master/keymap/vim.js#L576
I tested it, works.
My user.behaviors:
:editor [:lt.objs.editor/no-wrap
(:lt.objs.style/set-theme "default")
(:lt.plugins.vim/activate-vim)]
I cloned this repo into my LIghtTable plugins dir:
$ cd LightTable/blah/blah/.../plugins
$ git clone https://github.com/LightTable/Vim.git
When I save my user.behaviors I see LightTable reload them.
However, I can't get into vim command mode.
The solution seems to be 'restart LightTable'.
So, I suggest this project's README.md file should add:
LightTable is cool, but u don't!
How to reproduce.
The correct behavior would be to update search to the word selected in the step 2 and to drop the search from the first step.
Since updating the vim plugin recently I sometimes get in a state where I can not exit insert mode.
I haven't nailed down exactly what steps are needed to reproduce this, I will update this issue if I am able to.
The following errors appear in the console when trying to exit by hitting escape:
Uncaught TypeError: Cannot call method 'find' of undefined
vim.js [2870] updateLastSelection
vim.js [2906] exitVisualMode
vim.js [2169] actions.enterInsertMode
vim.js [1919] operators.change
vim.js [1490] commandDispatcher.evalInput
vim.js [1084] commandDispatcher.processOperator
vim.js [1041] commandDispatcher.processCommand
vim.js [738] vimApi.handleKey
vim.js [4603] anonymous
codemirror.js [3004] doHandleBinding
codemirror.js [3061] anonymous
codemirror.js [4723] lookup
codemirror.js [4738] CodeMirror.lookupKey
codemirror.js [3060] handleCharBinding
codemirror.js [3119] onKeyPress
codemirror.js [2008] anonymous
Uncaught TypeError: Cannot read property 'height' of undefined
vim.js [4648] exitInsertMode
codemirror.js [3004] doHandleBinding
codemirror.js [3047] anonymous
codemirror.js [4723] lookup
codemirror.js [4738] CodeMirror.lookupKey
codemirror.js [3047] handleKeyBinding
codemirror.js [3079] onKeyDown
codemirror.js [2008] anonymous
Working under windows system, I think it's a very common requirement.
I just installed (not upgraded to) 0.2.0 on a Windows box running a recent source build of Light Table.
No keybindings seem to be active for any files opened after installing the plugin. Keybindings were active after closing and re-opening Light Table.
How and where can I do that?
There are a number of CodeMirror features that this plugin does not have. This issue serves as a meta-issue until these are knocked out. Some of these may be broken out into separate cards. If you care about one of these, make a pull request for it :) Will keep this list up to date:
d/be
(openDialog) - from #10
c/
and d/
passthrough which doesn't seem possible yet:sort
and :global
handleEx
Issues marked with openDialog require an interactive dialog. The current dialog does not handle that yet.
Selecting a part of line using CTRL+v works fine in vim for selecting vertical or just a part of line but not in the LightTable vim plugin.
This is probably one of the weirdest bugs.
Sometimes, after working for a while, something triggers this bug. Basically when I delete a whole line using 'dd' and then paste it with p, the line is actually pasted vertically, not horizontally! As weird as it sound here is an example:
This seems to be file-specific, if I try to 'dd' in another file, it works fine (until the bug is hit in that file too).
I'm getting the following error, when I have a single-line document, and I try to delete to the start of the line with dd
:
Error: There is no line -1 in the document.
at getLine (/opt/homebrew-cask/Caskroom/lighttable/0.7.2/LightTable/LightTable.app/Contents/Resources/app.nw/core/node_modules/codemirror/codemirror.js:6721:39)
at cursorCoords (/opt/homebrew-cask/Caskroom/lighttable/0.7.2/LightTable/LightTable.app/Contents/Resources/app.nw/core/node_modules/codemirror/codemirror.js:1789:26)
at drawSelectionCursor (/opt/homebrew-cask/Caskroom/lighttable/0.7.2/LightTable/LightTable.app/Contents/Resources/app.nw/core/node_modules/codemirror/codemirror.js:1299:15)
at drawSelection (/opt/homebrew-cask/Caskroom/lighttable/0.7.2/LightTable/LightTable.app/Contents/Resources/app.nw/core/node_modules/codemirror/codemirror.js:1266:9)
at endOperation_R2 (/opt/homebrew-cask/Caskroom/lighttable/0.7.2/LightTable/LightTable.app/Contents/Resources/app.nw/core/node_modules/codemirror/codemirror.js:2053:30)
at endOperations (/opt/homebrew-cask/Caskroom/lighttable/0.7.2/LightTable/LightTable.app/Contents/Resources/app.nw/core/node_modules/codemirror/codemirror.js:2014:7)
at endOperation (/opt/homebrew-cask/Caskroom/lighttable/0.7.2/LightTable/LightTable.app/Contents/Resources/app.nw/core/node_modules/codemirror/codemirror.js:2001:7)
at eval (/opt/homebrew-cask/Caskroom/lighttable/0.7.2/LightTable/LightTable.app/Contents/Resources/app.nw/core/node_modules/codemirror/codemirror.js:2147:17)
at CodeMirror.setOption (/opt/homebrew-cask/Caskroom/lighttable/0.7.2/LightTable/LightTable.app/Contents/Resources/app.nw/core/node_modules/codemirror/codemirror.js:4020:48)
at lt.objs.editor.set_mode (file:///opt/homebrew-cask/Caskroom/lighttable/0.7.2/LightTable/LightTable.app/Contents/Resources/app.nw/core/node_modules/lighttable/bootstrap.js:23804:43)
Obviously I could just cc
, but. :P
Package manager, like bower, should get them when plugin is installed. What do you think?
When selecting something I get an error if I want to use CTRL+[ instead of ESC. It works in normal mode but when something is selected.
Also completely unrelated: Would it make sense to use Emacs Evil plugin and port it from emacs lisp to cljs instead of using Codemirrors vim? It supports tons of features and might be easy to port for it being a lisp. Just a thought. Feel free to ignore.
Hi, sorry for the noob question but it's possible map the keys jk for change from insert to normal mode??..thanks!...by the way, seems than the configuration file changes in the latest lightable release......
When typing code in Vim mode, if you cancel an autocomplete popup using Esc it also forces the editor out of insert mode and into normal mode.
It seems like the Esc is being processed twice and should be consumed by cancelling the popup.
m/
A newer version of the CodeMirror code should bring a lot of good stuff, including text objects.
I want do this keymap :
[:editor :lt.plugins.vim/map-keys {",;" "$A;<ESC>"}]
The $a
of keymap work fine : cursor go to the end of line and pass to edition mode. The end of keymap (;
character don't work).
OS X Yosemite
Light Table version
0.7.2
Binary version
0.8.4
I was using the exact same setup on Ubuntu previously and this issue wasn't there.
ex-mode :qa command should be supported to quit LightTable entirely and :wqa command that saves all not saved files and quits LightTable
When I hit the "/" key to search with the vim plugin active, I get the following error in a dialog box:
Not an editor command ":ltexec vim.find"
When I search for this I find a keybinding in the vim plugin's source. Suspecting there was an api change, I added the following to my keybindings:
:editor { ...
"/" [:vim.find]}
and after saving this it seems to work. However, I can't get rid of the error messages about :ltexec find.next
and :ltexec find.prev
by adding similar key bindings for n
and shift-n
.
Is it in conflict with another keybinding?
Hi, I noticed a funny bug in the vim plugin, which I experience only on one of the two (Linux) machines where I use lighttable.
Basically, if I copy something, say a line using yy
, then I move somewhere, or use other commands, when I paste I get the content of the clipboard and, below, all the letter commands I have given.
So, say that I copied Hallo
, then moved around using say jjjlll
when I paste I will get:
Hallo
jjjlll
Anyone has seen this before?
Steps to reproduce
*
, or /
or Ctrl/Cmd-F
).This is very confusing - it's like getting lost every now and then.
Versions
OS X: 10.7.5
Light Table version: 0.7.2
Binary version: 0.8.4
Vim plugin: 0.1.0
user.behaviours
[
[:app :lt.objs.style/set-skin "dark"]
[:editor :lt.objs.editor/wrap]
[:editor :lt.objs.style/set-theme "default"]
[:editor :lt.plugins.vim/activate-vim]
[:editor :lt.objs.style/font-settings "Ubuntu Mono" 10]
[:editor.clojure :lt.objs.langs.clj/print-length 1000]
]
In Vim I can easily delete text (or change with c
) by pressing d/
and typing some letters. For example (cursor at [0,0]):
ba a a a
a a a be
Typing d/be
will delete everything up to "be". It's currently not possible to do with LT. Note that it's actually supported by CodeMirror.
I'm trying to answer the following Stack Overflow question:
key bindings - Bind multiple actions to one key in lighttable - Stack Overflow
It seems like I should be able to add the following to my user.keymap file to implement this:
[:editor "esc" :auto-complete.remove (:vim.send-key "<Esc>")]
But it doesn't work.
Trying to isolate what's going on, I added the following to my user.keymap file instead:
[:editor "capslock" (:vim.send-key "<Esc>")]
But it doesn't work. Nor does ... (:vim.send-key "Esc")
.
But other argument values, like "$" or "0" do work. What's up with Escape?
It seems like select inside e.g. vi"
is not working.
It works in the CodeMirror vim demo:
http://codemirror.net/demo/vim.html
Expected behavior: evaluating an arbitrary unit of code selected with the visual mode requires selecting exactly the code users want to evaluate.
Actual behavior: evaluating an arbitrary unit of code selected with the visual mode requires users to select one character further, unless an exception is throw. The exception thrown is related to malformed selections being evaluated.
Light Table 0.6.2/Vim plugin 0.0.2
Hi. Lovely plugin :) I'm trying to adjust it to my keymap. But have few issues. Main is that instead of hjkl keys I use dhtn for movements (dvorak and stuff). So when I do bindings like
"d" "h"
"j" "d"
j is still working but d is not. Is it possible to configure binding in non recursive way (like nnoremap in vim for example)?
shift-y
is a synonym for yy
in vim... and yy
is implemented correctly, so this should be straightforward to fix...
:
enters vim-like ex-mode. In Vim, :32
would jump to line 32.
How would I go about adding this as a command function?
Or would this interfere with the behavior of cmd
+l
which takes a second argument after cmd
+l
?
as the title,this behavior is different from a real vim editor
When you have the Vim plugin installed, keymap sequences that include a key press without a modifier key (e.g. ctrl-w w
) don't work.
{:app {"ctrl-w w" [:workspace.show]}}
to user.keymap.The workspace tree shows or hides itself.
Nothing happens. If you disable Vim mode and then open a new editor window, the workspace tree shows or hides as expected.
Please let me know if you need any more info.
To reproduce:
Without Vim plugin we are able to move past the folded code without it being unfolded.
when using di " it deletes text inside quotes,
I normal vim di { or di [ also works
In codemirror's vim demo ( https://codemirror.net/demo/vim.html ) the '/' activates the find dialog while in visual mode. Entering a useful search term and then pressing enter, extends the current selection to the beginning of the search term.
In Light Table, the '/' key has no effect in visual mode. Using the LT command menu to choose "Find: In current editor" does open the find dialog but, upon completion, the cursor is moved without extending the selection. The editor is still in visual mode.
4.7.0 introduced custom keypress/keydown handlers. This conflicts with LT's mousetrap handlers and causes Esc, backspace. Waiting to upgrade until codemirror/codemirror5#2915 is addressed
After 0.6 and the plugins the shortcuts like "/" and "=" doesn't work but gives an error like: "Not an editor command ":ltexec vim.find""
Binding them in user keymap seems to overwrite the behaviour that the vimplugin brings so maybe the ltexec part needs to be removed?
The normal mode mappings (
and )
do not work. They should go forward and backward one line.
The normal mode mapping {
and }
should go forward and back a paragraph, but they go to the beginning and end of a file.
The section mappings [[
and ]]
do not work.
For details see :he object-motion
in vim.
I tend to use the 'c' character a lot to delete + insert text in a single keystroke. Sometimes after I have been working for a while, I realize that hitting 'c'+something (like 'cw' or 'ct(' ) it will delete the contents but not drop me into insert mode.
I fear this might be related to bug #38 but I am not sure.
By default vim mode in lighttable doesn't include the character under the cursor, which is different from vim default.
The highlighted text normally includes the character under the cursor.
However, when the 'selection' option is set to "exclusive" and the cursor is
after the Visual area, the character under the cursor is not included.
It'd be great to get it fixed or get it as an option.
This plugin is getting really close to replacing vim for me. A couple issues though:
1.) I'd really like to be able to use gt
and Gt
to change tabs. Having to do the comand + shift + bracket chord currently.
2.) When I hit :
or /
I can no longer use <C-[>
to close out of that particular context. Example: I press :
in normal mode, and the command window pops up. I decide I don't want to enter a command. Now I have to use ^-space
to close that context. I realize this is nitpicky, but it's not the way vim behaves.
If you hold down l
to move the cursor right, you get one of those little character menus pops up asking you if you want to type a ล
.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.