Commit e957e886142ae96257ef36cb8048a47a0917e0da

Work around delay after Escape due to Alt mappings
Looked it up in rsi.vim.
Author: xaizek
Author date (UTC): 2016-10-23 17:28
Committer name: xaizek
Committer date (UTC): 2016-10-23 17:28
Parent(s): db29d906246fafd759c7c790df0471394ec75d15
Signing key: 99DC5E4DB05F6BE2
Tree: fc7e5b938ba4ce0c2f09183e9b522b4bcdd53b37
File Lines added Lines deleted
plugin/emacscommandline.vim 26 30
File plugin/emacscommandline.vim changed (mode: 100644) (index b0c4504..bf9b638)
... ... cnoremap <C-B> <Left>
4 4 cnoremap <C-F> <Right> cnoremap <C-F> <Right>
5 5 cnoremap <C-P> <Up> cnoremap <C-P> <Up>
6 6 cnoremap <C-N> <Down> cnoremap <C-N> <Down>
7 if has('gui_running')
8 cnoremap <M-r> <C-F>?
9 else
10 cnoremap <Esc>r <C-F>?
11 cmap <M-r> <Esc>r
12 endif
7 cnoremap <M-r> <C-F>?
13 8
14 9 " Maps to old shortcuts using Ctrl-O as a prefix " Maps to old shortcuts using Ctrl-O as a prefix
15 10 cnoremap <C-O><C-A> <C-A> cnoremap <C-O><C-A> <C-A>
 
... ... noremap! <expr> <SID>transposition getcmdpos()>strlen(getcmdline())?"\<Left>":ge
33 28 noremap! <expr> <SID>transpose "\<BS>\<Right>".matchstr(getcmdline()[0 : getcmdpos()-2], '.$') noremap! <expr> <SID>transpose "\<BS>\<Right>".matchstr(getcmdline()[0 : getcmdpos()-2], '.$')
34 29 cmap <script> <C-T> <SID>transposition<SID>transpose cmap <script> <C-T> <SID>transposition<SID>transpose
35 30
36 if has('gui_running')
37 cnoremap <M-f> <C-\>e<SID>ForwardWord()<CR>
38 else
39 cnoremap <Esc>f <C-\>e<SID>ForwardWord()<CR>
40 cmap <M-f> <Esc>f
41 endif
31 cnoremap <M-f> <C-\>e<SID>ForwardWord()<CR>
42 32 function! <SID>ForwardWord() function! <SID>ForwardWord()
43 33 let l:loc = strpart(getcmdline(), 0, getcmdpos() - 1) let l:loc = strpart(getcmdline(), 0, getcmdpos() - 1)
44 34 let l:roc = strpart(getcmdline(), getcmdpos() - 1) let l:roc = strpart(getcmdline(), getcmdpos() - 1)
 
... ... function! <SID>ForwardWord()
54 44 return getcmdline() return getcmdline()
55 45 endfunction endfunction
56 46
57 if has('gui_running')
58 cnoremap <M-b> <C-\>e<SID>BackwardWord()<CR>
59 else
60 cnoremap <Esc>b <C-\>e<SID>BackwardWord()<CR>
61 cmap <M-b> <Esc>b
62 endif
47 cnoremap <M-b> <C-\>e<SID>BackwardWord()<CR>
63 48 function! <SID>BackwardWord() function! <SID>BackwardWord()
64 49 let l:loc = strpart(getcmdline(), 0, getcmdpos() - 1) let l:loc = strpart(getcmdline(), 0, getcmdpos() - 1)
65 50 let l:roc = strpart(getcmdline(), getcmdpos() - 1) let l:roc = strpart(getcmdline(), getcmdpos() - 1)
 
... ... function! <SID>BackwardKillLine()
138 123 return l:ret return l:ret
139 124 endfunction endfunction
140 125
141 if has('gui_running')
142 cnoremap <M-d> <C-\>e<SID>KillWord()<CR>
143 else
144 cnoremap <Esc>d <C-\>e<SID>KillWord()<CR>
145 cmap <M-d> <Esc>d
146 endif
126 cnoremap <M-d> <C-\>e<SID>KillWord()<CR>
147 127 function! <SID>KillWord() function! <SID>KillWord()
148 128 call <SID>saveUndoHistory(getcmdline(), getcmdpos()) call <SID>saveUndoHistory(getcmdline(), getcmdpos())
149 129 let l:loc = strpart(getcmdline(), 0, getcmdpos() - 1) let l:loc = strpart(getcmdline(), 0, getcmdpos() - 1)
 
... ... function! <SID>KillWord()
164 144 return l:ret return l:ret
165 145 endfunction endfunction
166 146
167 if has('gui_running')
168 cnoremap <M-BS> <C-\>e<SID>BackwardKillWord()<CR>
169 else
170 cnoremap <Esc><BS> <C-\>e<SID>BackwardKillWord()<CR>
171 cmap <M-BS> <Esc><BS>
172 endif
147 cnoremap <M-BS> <C-\>e<SID>BackwardKillWord()<CR>
173 148 function! <SID>BackwardKillWord() function! <SID>BackwardKillWord()
174 149 " Do same as in-built Ctrl-W, except assign deleted text to @c " Do same as in-built Ctrl-W, except assign deleted text to @c
175 150 call <SID>saveUndoHistory(getcmdline(), getcmdpos()) call <SID>saveUndoHistory(getcmdline(), getcmdpos())
 
... ... function! <SID>Undo()
241 216 call remove(s:oldcmdline, 0) call remove(s:oldcmdline, 0)
242 217 return l:ret return l:ret
243 218 endfunction endfunction
219
220 if !has("gui_running")
221 silent! exe "set <F31>=\<Esc>r"
222 silent! exe "set <F32>=\<Esc>f"
223 silent! exe "set <F33>=\<Esc>b"
224 silent! exe "set <F34>=\<Esc>d"
225 silent! exe "set <F35>=\<Esc>\<C-?>"
226 silent! exe "set <F36>=\<Esc>\<C-H>"
227 map! <F31> <M-r>
228 map! <F32> <M-f>
229 map! <F33> <M-b>
230 map! <F34> <M-d>
231 map! <F35> <M-BS>
232 map! <F36> <M-BS>
233 map <F31> <M-r>
234 map <F32> <M-f>
235 map <F33> <M-b>
236 map <F34> <M-d>
237 map <F35> <M-BS>
238 map <F36> <M-BS>
239 endif
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