sponsor Vim development Vim logo Vim Book Ad

conomode.vim : Vi-style editing for the command line

 script karma  Rating 2/2, Downloaded by 2211  Comments, bugs, improvements  Vim wiki

created by
Andy Wokula
 
script type
utility
 
description
Continued here: https://github.com/Houl/conomode-vim (2017 Aug 06)

Implements a kind of Normal mode ( "Cmdline-Normal mode" ) on top of the Command line.  Purpose is similar to the cmdline-window (q:), but navigation and editing can be done in-place.  Of course the cmdline-window is much more powerful.

Conomode does not replace Vim's native emacs-style command line editing, it just adds one key: CTRL-O (see below).

- enter with c_<C-O>   (press CTRL-O while in Command-line mode)
- mode indicator is a colon ":", moved along with the cursor, hiding the char under it
- quit to Cmdline-mode with I, i, a, A, : or any unmapped key (which then executes or inserts itself), or wait 60 seconds.
- quit to Normal mode with Esc

Features So Far:
- Motions: h l w b e W B E 0 ^ $ f{char} F{char} t{char} T{char} ; , %    also in Operator pending mode
- Operators: d y c    these write to the unnamed register; c prompts for input()
- Shortcuts: yy dd D x X s C    yy -> y_, dd -> d_, D -> d$, x -> dl, X -> dh, s -> cl, C -> c$
- Simple Changes: ~ r{char}
- Putting: P p     put the unnamed register
- Repeating: .     repeatable commands: d r c ~ o   also: I i a A
- Macros: q @      q starts[/stops] recording, @ executes, no register involved
- Mode Switching:  I i a A - back to Cmdline (with positioned cursor),  <Esc> - back to Normal mode, <CR> - execute Cmdline, : - back to Cmdline (remove all text)
- Insert: o        input() version of i (accepts a count and is recordable)
- Undo: u U        redo with "U" (to keep c_CTRL-R working); undo information survives mode switching (!); undo is yet unlimited
- Count: can be given for most commands
- Misc: <C-L> - redraw the Cmdline

Notes:
- the mode indicator makes UTF-8 characters look garbled - it's only a display problem; press Ctrl-L to redraw the Cmdline; I'd rather not use conomode with UTF-8, sorry ...

Feedback is welcome (bugs, usage improvements, does it feel like vi?, etc.)

Have fun!

2012 Apr 14
 
install details
:source conomode.vim

Can be used as a plugin.

Note: Vim7.3 is recommended, older Vims are likely to crash due to a bug in getcmdline()

The plugin defines a lot of mappings for Cmdline-mode, but these are local to the script -- so except for <C-O>, there cannot be a conflict with other mappings.


Hint:
to autoload the plugin when pressing <C-O> the first time, you can create a "macros" folder, put the script file there and add the following code to your vimrc:
" vimrc:
cmap <C-O> <C-R>=<sid>LoadConoMode()<CR><C-O>
func! <sid>LoadConoMode()
    cunmap <C-O>
    verbose runtime macros/conomode.vim
    redraw
    return ""
endfunc

2012 Apr 14
 

rate this script Life Changing Helpful Unfulfilling 
script versions (upload new version)

Click on the package to download.

package script version date Vim version user release notes
conomode.vim 0.6.1 2012-01-30 7.3 Andy Wokula BF: fixed dumb error with cw (was ok in v0.4)
BF: now conomode also disabled for :debug and <C-R>=
conomode.vim 0.6 2012-01-28 7.3 Andy Wokula Note: default key changed to CTRL-O
Insert keys I i a A no longer prompt for input()
NF: added motions %, | (bar), t and T
NF: separate undo stacks, per cmdtype
NF: g:conomode_emacs_keys to enable a few Emacs keys, Ctrl-W, Ctrl-Y (disabled per default)
NF: (non-vi) gX to cut older undo states
BF: added init folklore
BF: better escaping when recording c{text}<Enter>
BF: removed count limits for h and l motions
BF: yy, dd, cc now use whole-line text object (matters for repeat)
BF: f now inclusive
conomode.vim 0.4 2010-08-20 7.3 Andy Wokula NF: Macro recording: q @
NF: undo survives mode switching
NF: Tilde command: ~
NF: Insert commands: I i a A (now prompt for input())
NF: <Esc> (and o O ) switches to the Cmdline (not Normal mode)
NF: more verbose now
BF: disallowed recursive Conomode
BF: better multi-byte support
conomode.vim 0.1 2008-10-02 7.0 Andy Wokula Initial upload
ip used for rating: 44.200.145.114

If you have questions or remarks about this site, visit the vimonline development pages. Please use this site responsibly.
Questions about Vim should go to the maillist. Help Bram help Uganda.
   
Vim at Github