Vis: A Vim-Like Text Editor
11–20 of 166 posts
Re: Vis: A Vim-Like Text Editor
#12Looks promising, and support for huge files is a weak point in vim, so I gave it a try. My usual workflow with big logfiles is to zoom into certain types of messages with e.g. :v/error/d and back out with u, and alternatively jump from one occurrence of a string to the next with *. That doesn't seem to work, so for the moment it's not the right 80% for me. But I do think it's a worthy project, so I'll keep an eye on…
What does :v do?
:[range]v[global]/{pattern}/[cmd] Same as :g!.
Where:
:[range]g[lobal]!/{pattern}/[cmd] Execute the Ex command [cmd] (default ":p") on the lines within [range] where {pattern} does NOT match.
So :v/error/d will delete all lines that don't contain the string "error".
Re: Vis: A Vim-Like Text Editor
#13Re: Vis: A Vim-Like Text Editor
#14Earlier quoted context omitted.
What does :v do?
:help :v will tell you: :[range]v[global]/{pattern}/[cmd] Same as :g!. Where: :[range]g[lobal]!/{pattern}/[cmd] Execute the Ex command [cmd] (default ":p") on the lines within [range] where {pattern} does NOT match. So :v/error/d will delete all lines that don't contain the string "error".
Re: Vis: A Vim-Like Text Editor
#15Re: Vis: A Vim-Like Text Editor
#16That video needs sound, I have no idea about what's happening.
- x/pattern/ extracts stuff from the text, creates a selection for every match
- some normal vi motions are used to modify the selections, "o" to move the
cursor from one end of the selection to the other, "w" to move the cursor
to the start of the next word
- y/,/ similar to x/ but create a selection for everything which does not match,
hence splitting the existing selection into multiple ones
- \ trim selections i.e. remove leading and trailing white space
- v/Vis keep all selection not matching Vis
- g/F|C keep all selection matching F|C
- + rotate selection contents on the same line
- v/Com keep all selection not matching Com
- + rotate some more
- ESC clear selections, ESC remove all cursors
- x/pattern select different regions
- .,/^\} extend selection by searching in forward direction until the first match
of } at the start of a line
- { i/#if 0\n/ a/\n#endif/ } insert some text before every selection with i/text/
and append some text after every selection with a/text/
- change file, select similarily indented code block using a text object: vi
- x/\w+ extracts all words from selection
- Tab align selections
- C-c remove first selection column (i.e. remove first selection on every line)
- Esc clear selections, switch to normal mode, move to next { with f{
- i goto insert mode and align cursors
- search a variable, select it with C-n
- C-n select next match
- C-x skip this match, that is clear it and select next match
- C-n select next match
- c vi change operator, delete selection, switch to insert mode
- rename the variable, switch back to normal mode
- undo the changesRe: Vis: A Vim-Like Text Editor
#17How would you compare this to the NeoVim project? https://github.com/neovim/neovim
Re: Vis: A Vim-Like Text Editor
#18But what does it got that vim doesn't?
Sam expressions for manipulating text. This is a blub thing - if you haven't seen them you might not realise what you're missing out on. Try to imagine an editor where the core idea is a better-sed-than-sed. Two well-known editors to come from the ed tradition: vi and sam. Vi is an obvious evolution - make it 2d. Sam did this as well, but its main focus was developing the expression language. For example, so you can…
Re: Vis: A Vim-Like Text Editor
#19Definitely going to give it a try. Currently I'm using Neovim and I like a lot the embedded terminal feature. I wonder how easily this can be recreated using a Lua plugin.
Re: Vis: A Vim-Like Text Editor
#20Earlier quoted context omitted.
:help :v will tell you: :[range]v[global]/{pattern}/[cmd] Same as :g!. Where: :[range]g[lobal]!/{pattern}/[cmd] Execute the Ex command [cmd] (default ":p") on the lines within [range] where {pattern} does NOT match. So :v/error/d will delete all lines that don't contain the string "error".
Which neatly maps to grep's -v option that does the same.