Console editor: something between VIM and nano? - vim

I used vim for a long time, but switched to Sublime Text last year for most of my programming work.
Now, every time I have to make use of a console editor (mostly over ssh), I feel extremely uncomfortable with vim. The shortcuts and commands have slowly left my memory, my once carefully curated vimrc is gathering dust, and I just can't use the editor effectively without re-learning everything.
On the other hand, nano is just dumb. Great for opening a file, adding a flag and closing it, but way too primitive for anything else.
Is there something in between I can use? I can settle for not-as-easy-as-nano-nor-as-powerful-as-vim.

You can use mcedit. It is much more user friendly than other editors - it even supports mouse over ssh (even in Putty console from Windows).
Simply install package Midnight Commander as follows:
Ubuntu/Debian:
sudo apt-get install mc
Fedora/Redhat:
sudo yum install mc
MacOS:
brew install mc
and it will make mcedit available.
In local console it even supports Shift+Del, Shift+Ins, Ctrl+Ins shortcuts that we use in Windows.
It also has nice ability to copy blocks into arbitrary files, effectively giving you unlimited number of clipboards.

You could try these, but you'll have to install them on the machines you SSH into:
joe
ne
diakonos
But my opinion is that you should drop the seriously underpowered Sublime and go back to Vim.
$ vimtutor is your friend.

If you want to learn a text editor that's available on just about every machine you could possibly SSH into, basically your only options are vim, emacs, nano, and ed.
Emacs is an okay choice, so long as you can remember c-x c-s (save) and c-x c-c (close)… But that's only two fewer commands than you need to remember with vim (i for insert mode, <esc> for normal mode, :w to save, and :q to quit).
Possibly a better alternative would be to run X11 locally, so you can use gedit, gvim, or one of the other graphical editors from the remote machine? Or maybe print off a couple of cheat sheets (see: https://stackoverflow.com/questions/442057/what-is-your-linux-vim-cheat-sheet) and keep them on your person at all times?

I haven't personally used it, but the Cream flavor of Vim modifies Vim with more standard-style mappings (e.g. CTRL-F for Find), no modal editing (normal vs. insert mode) as in Vi(m), and it also works in the console (with menus). Maybe that makes Vim suitable to you.

Since you're a Sublime user, you'll probably feel comfortable with Suplemon https://github.com/richrd/suplemon.
It's a bit like Sublime and it's specifically created to be easy and powerfull at the same time. It also has multiple cursors and similar key mapping as Sublime. It's written in Python and supports addon modules. Hopefully one day it'll support Sublime packages too.
Disclaimer: I'm the developer of Suplemon.

Related

Can I use vim-like commands in the WIndows Command line in Windows 10?

Because I use vim (and obviously like it) while working in the command line, I often go through a few keystrokes before I realize I'm not in vim anymore. That's not a huge problem, but when entering a lot of commands on one line, vim-like navigation would really speed things up on the extremely rare occasion cough I make a typo. It would be great it there were a way to make command line typing act at least a little like vim (e.g. Normal mode, Insert mode, movement from the home keys, etc.)
I am open to using a different shell, but would prefer something I can use without learning a ton of new commands (e.g. command line or BASH like). I have else compiled many of my frequent command sequences into .bat files, which I would prefer not to have to change too much to get to work properly.
When using Windows, a good option would be to install Git, which gives you "Git Bash", which is their distribution of mingw.
Now that you have bash, you can use set -o vi which puts your readline in Vim mode.
https://sanctum.geek.nz/arabesque/vi-mode-in-bash/
I'm surprised nobody has mentioned Clink. It works with cmd.exe, and has support for Vim (well, technically, Vi) key mappings. Sadly, the documentation seems unfinished (to say the least); that said, I have found it to be quite stable, and have used it for a few years now. Doing a quick search yields information on how to set the default editing mode to Vi (versus Emacs).
In short Control+Alt+J switches to Vi mode (assuming one is currently in the default Emacs mode), and a standard Readline inputrc in the right place (my file path is %HOMEPATH%\AppData\Local\clink\clink_inputrc), with the right directive (set editing-mode vi) ensures that a new cmd.exe invocation starts off in Vi mode.
I am open to using a different shell, but would prefer something I can use without learning a ton of new commands (e.g. command line or BASH like)
In bash you can enter vi-mode with the command:
set -o vi
This will make shell-editing very similar to Vim-editing. For a cheat-sheet of vim-mode commands see: https://github.com/pkrumins/bash-vi-editing-mode-cheat-sheet/blob/master/bash-vi-editing-mode-cheat-sheet.txt

What is the difference between gVim and gVim easy?

The question is self explanatory, but I haven't found a single resource that explains what the difference is after an hour of searching. After poking around a little bit in both, it appears that gVim and gVim easy are identical.
Gvim easy is started and locked in insert-mode (every character you type is printed like a simple notepad).
Standard gvim starts in normal mode and you have to toggle between normal/insert like all other vim.
From help:
Easy mode. Implied for |evim| and |eview|. Starts with
'insertmode' set and behaves like a click-and-type editor.
This sources the script $VIMRUNTIME/evim.vim. Mappings are
set up to work like most click-and-type editors, see
|evim-keys|. The GUI is started when available.
{not in Vi}
gVim-Easy, which is installed with gVim, has all the functionality of
normal gVim but lacks modes. This is especially useful for begginers
and people who do not want to, or do not have the time to, learn how
to use gVim. Users can benefit from gVim's superior syntax
highlighting and auto-indentation while not having to have to learn
the, often deemed complex, command set of gVim in order to edit a
simple document. It is recommended that readers of this tutorial at
least try to learn how to use gVim in normal mode, the learning curve
is steep, but, the benefits in speed and usability this confers is
worth the investment.
Read here
gVim Easy: gvim.exe -y (pass a parameter y)
gVim: gvim.exe
It seems that Insert and Replace are available modes, and command mode is missing. And at first glance it appears to have lost the ability to save a document using keystrokes - the File menu shows only ":w" for Save and without command mode, the command simply isn't there. What isn't shown however is Alt-F followed by S - this works, although also missing is the status line confirmation of the file being written.

Is there a way to change vim's default mode

Does anyone know how to change vim's default mode? Its default mode is command mode, but could I change it to insert mode?
Just add the following line to your vimrc:
start
Vim's default mode will be changed to Insert mode. Just press Esc to enter Command mode.
You can try the 'insertmode' option (add set insertmode to your .vimrc file), although I recommend that you learn the standard vi operation, because not all vi-like editors support this mode of work.
cheers,
mitch
If you really want an editor that starts out in insert mode, perhaps vim is not the editor for you.
Most editors that aren't based on vi behave the way you want. Emacs is very powerful, but it may be too complicated for your needs. Nano (man nano for info nano for more information) might be a good choice. There are other possibilities.
vim really isn't designed to be used that way. As others have said, there are ways to force it to start up in insert mode. (I've been using vi-style editors for decades, and I didn't even know about :set insertmode until now.) But it's awkward to use.
My advice: either (1) use an editor that behaves the way you want, or (2) spend some time learning to use vim in its default configuration, and see if you can get used to it.
One big advantage of vim's separation of insert and command modes is that the command mode can use letters as commands; modeless editors generally have to use control keys or function keys to execute commands.
Update (a decade later): vim has an option -y that starts it with insertmode enabled. evim is equivalent to vim -y, and eview to view -y. From the man page (emphasis added):
eVim starts Vim and sets options to make it behave like a modeless editor. This is still Vim but used as a point-and-click editor. This feels a lot like using Notepad on MS-Windows. eVim will always run in the GUI, to enable the use of menus and toolbar.
Only to be used for people who really can't work with Vim in the normal way. Editing will be much less efficient.
The 'insertmode' option is set to be able to type text directly.
Mappings are setup to make Copy and Paste work with the MS-Windows keys. CTRL-X cuts text, CTRL-C copies text and CTRL-V pastes text. Use CTRL-Q to obtain the original meaning of CTRL-V.
You can use
vi -cstartinsert
or
vi -cstart
That launch vi and put it insert mode. You can do an alias to that if it's really usefull (I still understand why you want that anyway). You can also look at this tip.
"Cream" is a project that aims to make Vim easier to use. By default everything you do in Cream is in insert mode, I believe:
http://en.wikipedia.org/wiki/Cream_%28software%29

how to configure vim commands to windows style?

My job involves working on Windows, *ix and with variety of IDE's like Eclipse, Visual Studio. Sometimes I really don't want to open Eclipse for little editing so I would prefer simple text editor like Vim, but the keys for the commands are horrible to me, I would like to setup Vim command keys to simple and modern style.
Can someone guide me how to configure Vim commands to simple keys like Ctrl+C or Ctrl+V for copy paste (through clipboard) or Shift+→, Shift+← for selecting text.
See this question: How do I configure VIM for using Ctrl-C Ctrl-V as copy paste to and from system buffer in ubuntu?
and the over all help on how to do key mapping here: How to make a keymap
It's not the answer you're looking for, but I'm with hammar. For example the Mac version of vim has the standard Mac-style copy/paste shortcut keys "baked in" yet I use the default vim keybindings now, since, like yourself, I hop about Linux/Windows/Mac, and having the same vim keyboard shortcuts.
Conversely, you'll find managing your personalized, if unorthodox, key bindings more onerous than simply "going vim."
I presume you've "worked" the vimtutor?

What Vim features are missing in Emacs with Viper and Vimpulse?

There are important features of Emacs which are missing in Vim, such as the comint mode, and there are no scripts/plugins which can replace them.
There are also benefits of Vim over Emacs, such as modal editing and generally better default shortcuts. However, Viper mode gets me both. Vimpulse also enables visual mode.
Unfortunately, no mode can make Emacs work as fast as Vim.
So I mostly learned Vim-in-Emacs. What Vim features am I missing?
I'm a regular vim user but not an emacs user and haven't used vimpulse to confirm this.
But browsing the vimpulse code below I see no mention of text objects.
http://www.emacswiki.org/cgi-bin/wiki/vimpulse.el
Vim introduced some very useful idioms for selection and movement that aren't in regular vi
cat 'cut around tag' for xml/html tags
diw 'delete in word'
di( di" delete text within a "" () etc.
in the vim help see :he text-objects for more.
Unfortunately, no mode can make Emacs work as fast as Vim.
If you mean that the emacs startup time is poor, you can cut it down dramatically by having an emacs session permanently open, and use gnuclient/emacsclient whenever you need to edit a file.
http://www.emacswiki.org/emacs/GnuClient
One vi feature that I miss in emacs is the . (dot) command that repeats the last edit. There is dot-mode.el which implements C-. to simulate this but it didn't always work for me (I am not proficient in elisp to figure out why).
Even viper doesn't implement this command exactly like vi does (last time I checked), and even if it does, I don't think that is enough for me to start using viper.
To get a complete list of what vimpulse may be missing type
:helpgrep not in Vi
Every feature in the help that is not vi compatible will be listed.
Theres about 700 matches.
Of course there will be a lot of duplicated functionality
Vi motion everywhere - in Vi you can always navigate using the same shortcuts, whether you are inside a directory listing, a help file, a write only file or something you're allowed to edit.
Correct visual and delete behaviour - very similar to emacs marking but idiomatically different, so difficult for a Vi user to retrain. If you're already used to the emacs marking you're not really missing anything.
Correct escape behaviour - should cancel all other modal activity and return you to command mode. Again, if you're comfortable in emacs you're probably used to having modal inputs and such anyway.
The obvious chestnuts about Vi being deployed on every nix system in the world (Gentoo purists correct me?) - not a very strong argument in my eyes anyway.
Those are the ones that sprang out during my use of emacs+viper.
Vim macros don't seem to work with viper/vimpulse:
Vim macros don't work when using viper + vimpulse in Emacs
(Btw, the killer emacs feature that makes me care about vim/vimpulse is that different frames can edit the same file. It's like having a split where the two pieces can be in different windows. If anyone knows how to accomplish that in vim, you'd be my hero.)
Incremental search using / and ? is missing.
Being a lover of emacs as an OS and vi as an input model, naturally I wanted to love viper. However within two seconds of using it I had to give it up: viper does not support C-[ as a substitute for the escape key–which is an essential shortcut for the most frequently used command in vi.

Resources