Skip to content
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

Suggestion for Editor enhancement Vi Vim #205

Closed
ghost opened this issue Jun 11, 2016 · 39 comments
Closed

Suggestion for Editor enhancement Vi Vim #205

ghost opened this issue Jun 11, 2016 · 39 comments
Labels
Milestone

Comments

@ghost
Copy link

ghost commented Jun 11, 2016

VI/VIM Key mode, Integration or embedding of vim/neovim as the editor

@ghost ghost changed the title Suggestion for Editor enhancement Suggestion for Editor enhancement Vi Vim Jun 11, 2016
@pbek pbek added Type: Feature adds functionality Help wanted labels Jun 11, 2016
@pbek
Copy link
Owner

pbek commented Jun 11, 2016

Thank you for your suggestion. Any volunteers? :)

@ghost
Copy link
Author

ghost commented Jun 11, 2016

Trust me If I knew how I'd be all over it. I know there is an API for hooking into neovim. that may be the easiest way to get it in. then the plugins and full function of vim would be added to qownnotes.

@pbek
Copy link
Owner

pbek commented Jun 12, 2016

And how should that work? Is there even a GUI version of neovim?

@ghost
Copy link
Author

ghost commented Jun 12, 2016

This version that runs in atom works but you have to have the nvim socket open..
https://atom.io/packages/neovim-mode
This works much better but is really just an x11 frontend to neovim
https://github.com/rhysd/NyaoVim

@pbek
Copy link
Owner

pbek commented Oct 26, 2016

I will close this issue until there is / are more information / volunteers.

@pbek pbek closed this as completed Oct 26, 2016
@qazip
Copy link

qazip commented Oct 15, 2017

I would also like QOwnNotes to have a Vim-Mode. Using vim hotkeys everywhere else makes the use of QOwnNotes a bit annoying at times. It's the one thing I'm missing!

@kropper
Copy link

kropper commented Oct 22, 2017

Yes please. QOwnNotes would be a great tool to use, but without a real editor, it's not something I could work with efficiently.

@valvin1
Copy link

valvin1 commented Jul 29, 2018

It would very nice to have vim mode in qownnotes editor. :)

@pbek
Copy link
Owner

pbek commented Jul 29, 2018

Since we have a read-only mode now I maybe will implement some basic vim-shortcuts. :)

@pbek pbek reopened this Jul 29, 2018
@pbek
Copy link
Owner

pbek commented Jul 29, 2018

Any suggestions? Like:

  • i: insert mode (turns off read-only mode)
  • /: search (opens search bar)
  • Esc: leave edit mode (turns on read-only mode)

@qazip
Copy link

qazip commented Jul 29, 2018

Those, but also:

o: open new line below;
O: open new line above;
A: Insert mode at the end of the current line;
a: insert mode after the next character;
v: visual mode; (also ctrl+v)

But also stuff like "ciw" for "change inside word" or "ci(" for "change inside parenthesis", etc..

@pbek
Copy link
Owner

pbek commented Jul 29, 2018

I first need to get a Text Cursor in read only Mode to make most of those Shortcuts useful

@valvin1
Copy link

valvin1 commented Jul 29, 2018

there are a lot of useful key bindings in vim :)

It looks like you are developping in C++ ?

Here some addition useful keybinding :

in Normal mode :

  • h,j,k,l : to move the cursor
  • y, yy : copy the selection, copy the line
  • d, dd : delete the selection, delete the line
  • p : paste
  • x : delete the current position
  • r,R : replace one character, replace mode
  • w, b : go to next word, go to previous word
  • $ : go to the end of line
  • ^ : go to the start of line
  • cw, c$ : change current word, change until the end of line and set insert mode
  • :XX : go to line XX

@valvin1
Copy link

valvin1 commented Jul 29, 2018

maybe it exists some library which does already the job because there are a lot of key bindings :)

@pbek
Copy link
Owner

pbek commented Jul 29, 2018

There might be https://github.com/hluk/FakeVim if I can get it running.

@pbek
Copy link
Owner

pbek commented Jul 30, 2018

So far I had no luck with the library, it crashes for me (see hluk/FakeVim#40).

@pbek
Copy link
Owner

pbek commented Aug 2, 2018

I got it to run now. It seems that if we are using FakeVim then most of the shortcuts of OOwnNotes to work inside notes will not work properly... But there vi shortcuts seem to work. Is that a price we want to pay?

@pbek
Copy link
Owner

pbek commented Aug 2, 2018

I finally got a basic Vim mode working.

18.08.0

  • you can now enable a new Vim mode in the Editor settings
    • keep in mind that some QOwnNotes shortcuts will not work correctly in that mode

@pbek pbek added this to the 18.08.0 milestone Aug 2, 2018
pbek added a commit that referenced this issue Aug 2, 2018
@pbek
Copy link
Owner

pbek commented Aug 2, 2018

There now is a new release, could you please test it and report if it works for you?

@kropper
Copy link

kropper commented Aug 2, 2018

WOW! That's the best thing that happened to QOwnNotes in a loooong time! 👯 Thanks, and cheers!

@pbek
Copy link
Owner

pbek commented Aug 2, 2018

It doesn't seem to build on Windows (AppVeyor) yet... 😬 More work to do...

@qazip
Copy link

qazip commented Aug 2, 2018

V-Block mode doesn't seem to work (Ctrl+v).

EDIT:
Some things I don't like:

  • The block changes sizes (when in visual mode, it would be cool if the block mode kept its size throughout the document, regardless of having selected a letter, an empty space or a dot (".");
  • There is no feedback for the search function: When doing "/search_for_this_string", there should be a bar somewhere (probably at the bottom) indicating that we're searching for "search_for_this_string";
  • It would be cool if when copying using the vim mode, it also copied to the clipboard by default; (this is usually done in the vimrc)

@pbek
Copy link
Owner

pbek commented Aug 2, 2018

Can you please explain in more detail and step by step what you did, what happened and what you expected.

@qazip
Copy link

qazip commented Aug 2, 2018

Sure @pbek:

Let's say you've a document with the following text:

"
aaaabbbbaaaa
aaaabbbbaaaa
aaaabbbbaaaa
"

If you put the cursor on the first "b", then click on "ctrl+v" and go down and right, you should be able to select all the "b"s at once. You can then press "x" to delete them. Well, visual-block mode doesn't seem to work in qownnotes, that is, you can't select columns in visual mode.

@qazip
Copy link

qazip commented Aug 2, 2018

Scratch that, V-Block mode seems to work. There's just no visual feedback to it. I can do what I mentioned in the previous post, but the block should be highlighted and it currently is not (I am using the dark theme). (See an example here, in the 2:55 mark)

@pbek
Copy link
Owner

pbek commented Aug 3, 2018

I didn't even play with dark mode yet...

@pbek
Copy link
Owner

pbek commented Aug 7, 2018

18.08.2

  • added many improvements to the new Vim mode
    • visible commands in the status bar
    • support for more commands like :w, :q and :wq
    • searching and replacing with more feedback
    • visual mode also works now with more feedback
    • text indenting

@pbek
Copy link
Owner

pbek commented Aug 7, 2018

There now is a new release, could you please test it and report if it works for you?

@valvin1
Copy link

valvin1 commented Aug 7, 2018

Wow !! Thank you @pbek

It works very well on my side with the latest version. Even other command like :%s/search/new/g

I've tested almost all functions mentioned and it all works :) Great work !

Here is some minor feedbacks :

  • cursor is not always the same, it varies depending the character and if there is no character it is "normal"
  • during search i can loose colorization of the pattern, for example if there are multiple match, type 'n' for the next one and colorization disappear but can reappear later (dark mode)

@pbek
Copy link
Owner

pbek commented Aug 7, 2018

cursor is not always the same, it varies depending the character and if there is no character it is "normal"

I guess that's because the cursor is drawn manually and depends on the size of the character

during search i can loose colorization of the pattern, for example if there are multiple match, type 'n' for the next one and colorization disappear but can reappear later (dark mode)

I'm not sure what can cause this yet...

@qazip
Copy link

qazip commented Aug 7, 2018

  • I also don't like that the cursor size is not always the same (when in visual mode);
  • There's a bug with the search. Searching for something and then pressing esc should stop the search. However, does not cancel, in fact, it seems to activate the search (at least the coloring) if one cancels any other way (moving for example);
  • It would be cool if the "-- Command -- " text changed color when we change modes. For example, blue for insert, orange for visual mode, etc.

@pbek
Copy link
Owner

pbek commented Aug 8, 2018

Thank you for your feedback. Sounds like you want to post some issues / feature requests on https://github.com/hluk/FakeVim/issues. ;)

@qazip
Copy link

qazip commented Aug 8, 2018

Sorry @pbek. I thought these were things you could change. It looks great though, thank you for supporting vim-mode.

@pbek
Copy link
Owner

pbek commented Aug 8, 2018

I thought these were things you could change

technically everyone can, the FakeVim library is FLOSS ;) as well as QOwnNotes is...

It looks great though, thank you for supporting vim-mode.

thank you, I had to spend a lot of time for fixes and integration work :)

@pbek pbek closed this as completed Aug 8, 2018
@valvin1
Copy link

valvin1 commented Aug 8, 2018

about cursor width it can be solved using monospace / fixed-width font in the editor like DejaVu Sans Mono.

@qazip
Copy link

qazip commented Aug 8, 2018

@valvin, thank you! It does not completely fix the issue (when there's no character, the cursor is different) but it's much better now!

@valvin1
Copy link

valvin1 commented Aug 8, 2018

I've tricked it using the "note editor cursor witdth" but it affects normal and insert mode

screenshot_20180808_201028

@grandemk
Copy link

grandemk commented Nov 15, 2023

I tested the vim mode after finding it here: https://www.qownnotes.org/blog/2018-08-07-Vim-mode.html
I couldn't get j/k to work, they just teleport me on the title of my note.

@pbek
Copy link
Owner

pbek commented Nov 16, 2023

I tested the vim mode after finding it here: https://www.qownnotes.org/blog/2018-08-07-Vim-mode.html I couldn't get it j/k to work, they just teleport me on the title of my note.

For me, j/k moves the cursor one line up or down.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

5 participants