Commit 152aa8003d6df37242648824b1431791d0a59350

corrected documentation other minor changes
Author: Houtsnip
Author date (UTC): 2011-04-17 21:49
Committer name: Houtsnip
Committer date (UTC): 2011-04-17 21:49
Parent(s): 6f12379481b8155a214456ad13882c7b0a00cb77
Signing key:
Tree: 55201f3017d19dff0ae95d0b24067ba85a02d7cc
File Lines added Lines deleted
doc/emacscommandline.txt 32 14
plugin/emacscommandline.vim 4 3
File doc/emacscommandline.txt changed (mode: 100644) (index 63b2904..b5dd74c)
1 *emacscommandline.txt* Emacs-style (and bash-style) mappings for command-line
2 mode
1 *emacscommandline.txt* Emacs- (or Bash-) style mappings for command-line mode
3 2
4 Author: Houtsnip <nstraigohttreedsitcph-githuab@yahmoo.co.uk>
3 Author: Houtsnip <NstraigOhttreedSitcPh-githuAb@yahMoo.co.uk>
5 4 *emacscommandline-author* *emacscommandline-author*
6 5 License: Same terms as Vim itself (see |license|) License: Same terms as Vim itself (see |license|)
7 6
8 7 INTRODUCTION *emacscommandline* INTRODUCTION *emacscommandline*
9 8
10 This plugin makes the command-line mode behave more like the bash command
11 line, by adding Emacs-style mappings (like in the Bash shell).
9 This plugin makes the command-line mode behave more like the Unix command
10 line, by adding Emacs-style mappings (like in the Bash shell). Some of the
11 mappings just map existing vim commands, but the rest implement functionality
12 that is not available natively.
12 13
13 14 MOVEMENT *emacscommandline-movement* MOVEMENT *emacscommandline-movement*
14 15
15 16 *CTRl-A* move cursor to beginning of line *CTRl-A* move cursor to beginning of line
16 *CTRl-E* move cursor to end of line
17 *CTRl-E* move cursor to end of line (i.e the native vim behaviour:
18 see |c_CTRL-E|). Not actually a re-mapping, but noted here
19 anyway for completeness.
17 20 *CTRl-B* move cursor one character backwards *CTRl-B* move cursor one character backwards
18 *CTRl-F* move cursor one character forwards
21 *CTRl-F* move cursor one character forwards (overwrites |c_CTRL-F|)
19 22 *META-B* move cursor one word backwards *META-B* move cursor one word backwards
20 23 *META-F* move cursor one word forwards *META-F* move cursor one word forwards
21 24
 
... ... DELETION *emacscommandline-deletion*
23 26
24 27 *CTRl-D* delete character under cursor *CTRl-D* delete character under cursor
25 28 *CTRl-K* kill line (delete from character under cursor to end of line) *CTRl-K* kill line (delete from character under cursor to end of line)
29 (overwrites insert digraph: see |c_CTRL-K|. This is a shame,
30 but personally I don't use this much in command-line mode.)
26 31 *CTRl-U* backwards kill line (delete backwards to beginning of line) *CTRl-U* backwards kill line (delete backwards to beginning of line)
32 (i.e. the same behaviour as in Bash: unix-line-discard)
27 33 *META-D* delete word under cursor *META-D* delete word under cursor
28 34 *META-Backspace* delete word backwards *META-Backspace* delete word backwards
29 *CTRL-W* delete backwards to next white-space character
35 *CTRL-W* delete backwards to previous white-space character
36 (i.e. the same behaviour as in Bash: unix-word-rubout)
30 37
31 38 HISTORY *emacscommandline-history* HISTORY *emacscommandline-history*
32 39
33 *CTRl-P* previous line in history
34 *CTRl-N* next line in history
35 *META-CTRl-R* search history backwards
40 *CTRl-P* previous line in history (same as <Up>)
41 *CTRl-N* next line in history (same as <Down>)
42 *META-R* search history backwards
43 (It would be nice to use the mapping CTRL-R, but this is
44 already used for insert register: see |c_CTRL-R|.)
36 45
37 46 OTHER *emacscommandline-other* OTHER *emacscommandline-other*
38 47
39 *CTRl-Y* paste (yank) last deleted text
40 *CTRl-_* undo last change
48 *CTRl-Y* paste (yank) last deleted text (overwrites |c_CTRL-Y|).
49 Note that in Emacs, 'yank' means 'paste', whereas in vim it
50 means 'copy'. The same text is also available in the
51 registry 'c'.
52 *CTRl-_* undo last change (overwrites |c_CTRL-_|)
41 53 *CTRl-X_CTRL-U* " " " *CTRl-X_CTRL-U* " " "
42 *CTRl-Z* toggle command-line as external command
54 *CTRl-Z* toggle command-line as external command (overwrites suspend
55 vim in the terminal)
43 56
57 OLD KEYS *emacscommandline-old-keys*
58
59 The old functions are all mapped to the same combination prefixed by CTRL-O.
60 So for example, to open the command-line window (see |c_CTRL-F|), press
61 instead CTRL-O_CTRL-F.
44 62
45 63 *WARNING* *WARNING*
46 64
File plugin/emacscommandline.vim changed (mode: 100644) (index 8464734..4b5aec9)
1 1 " Make more like emacs " Make more like emacs
2 2 cnoremap <C-A> <Home> cnoremap <C-A> <Home>
3 cnoremap <C-E> <End>
4 3 cnoremap <C-B> <Left> cnoremap <C-B> <Left>
5 4 cnoremap <C-F> <Right> cnoremap <C-F> <Right>
6 5 cnoremap <C-P> <Up> cnoremap <C-P> <Up>
7 6 cnoremap <C-N> <Down> cnoremap <C-N> <Down>
8 cnoremap <Esc><C-R> <C-F>?
9 cmap <M-C-R> <Esc><C-R>
7 cnoremap <Esc>r <C-F>?
8 cmap <M-R> <Esc>r
10 9
11 10 " Maps to old shortcuts using Ctrl-O as a prefix " Maps to old shortcuts using Ctrl-O as a prefix
12 11 cnoremap <C-O><C-A> <C-A> cnoremap <C-O><C-A> <C-A>
 
... ... let s:oldcmdline = [ ]
210 209 function! <SID>saveUndoHistory(cmdline, cmdpos) function! <SID>saveUndoHistory(cmdline, cmdpos)
211 210 if len(s:oldcmdline) == 0 || a:cmdline != s:oldcmdline[0][0] if len(s:oldcmdline) == 0 || a:cmdline != s:oldcmdline[0][0]
212 211 call insert(s:oldcmdline, [ a:cmdline, a:cmdpos ], 0) call insert(s:oldcmdline, [ a:cmdline, a:cmdpos ], 0)
212 else
213 let s:oldcmdline[0][1] = a:cmdpos
213 214 endif endif
214 215 if len(s:oldcmdline) > 100 if len(s:oldcmdline) > 100
215 216 call remove(s:oldcmdline, 100) call remove(s:oldcmdline, 100)
Hints

Before first commit, do not forget to setup your git environment:
git config --global user.name "your_name_here"
git config --global user.email "your@email_here"

Clone this repository using HTTP(S):
git clone https://code.reversed.top/user/xaizek/vim-emacscommandline

Clone this repository using ssh (do not forget to upload a key first):
git clone ssh://rocketgit@code.reversed.top/user/xaizek/vim-emacscommandline

You are allowed to anonymously push to this repository.
This means that your pushed commits will automatically be transformed into a pull request:
... clone the repository ...
... make some changes and some commits ...
git push origin master