-
-
Notifications
You must be signed in to change notification settings - Fork 64
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
VISUAL with vim shortcuts #44
Comments
Yep, this is definitely possible. I'll try to fix this in one of the next releases. |
I think it's a great idea. Are there any plans to implement this soon? The issue, I think comes from the fact that vim doesn't really support doing a visual selection then going into insert mode (without losing the selection), so right now you can only select normally using mouse or shift+arrow keys. Not exactly sure what a workaround would look like. Best, |
its possible using the vimrc plugin (https://github.com/esm7/obsidian-vimrc-support/tree/master) in a kinda hacky way. exmap test jscommand {const sel = selection; editor.cm.cm.state.vim.insertMode = true; editor.setSelection(sel.anchor, sel.head);}
vmap <C-o> :test<CR> to your vimrc you should be able to use the visual snippets. |
adding this.addcommand({
// this adds the select mode from vim so visual snippets can be triggered with vim visual selection
id: "switch-to-select-mode",
name: "Switch from visual mode to select mode",
editorCheckCallback: (checking: boolean, editor: Editor) => {
let vimObject = (window as any).CodeMirrorAdapter?.Vim;
if (
!(this.app as any).isVimEnabled() ||
!editor.cm.cm.state.vim?.visualMode
) {
return false;
} else if (!checking) {
let selection: EditorSelection = editor.listSelections();
vimObject.handleKey(editor.cm.cm, "<Esc>");
vimObject.handleKey(editor.cm.cm, "i");
editor.setSelections(selection);
} else {
return true;
}
},
}); would add select mode as an command. you can go back to visual with (vim mapping). const sel = selection;
const vimObj = window.CodeMirrorAdapter?.Vim;
const cm = editor.cm.cm;
if (vimObj) {
vimObj.handleKey(cm, "<Esc>");
vimObj.handleKey(cm, "i");
editor.setSelections(sel);
} with the vimrc, but I couldn't get |
I like the VISUAL idea for editing previously written latex. However it is easier to select text while in vim mode. Would there be a way to use the selection performed in vim mode?
I am not sure of what exactly this would look like.
Best,
Matthew
The text was updated successfully, but these errors were encountered: