tpope / vim-rsi Goto Github PK
View Code? Open in Web Editor NEWrsi.vim: Readline style insertion
Home Page: http://www.vim.org/scripts/script.php?script_id=4359
rsi.vim: Readline style insertion
Home Page: http://www.vim.org/scripts/script.php?script_id=4359
i_Ctrl-E is a very useful key to escape out of the insert completion popup and return the text back to the way it was before you started completion. With vim-rsi, this does not work when called from the middle of a line. If you ignore the remapping when pumvisible()
is true, I think that will fix the problem.
:help i_CTRL-G_U
gives examples of movement mappings in insert mode that respect the dot operator, for example <home>, <end>, <left>, <right>
. How about vim-rsi
piggybacking on these, for example,
inoremap <expr> <C-A> col('.') == match(getline('.'), '\S') + 1 ?
\ repeat('<C-G>U<Left>', col('.') - 1) :
\ (col('.') < match(getline('.'), '\S') ?
\ repeat('<C-G>U<Right>', match(getline('.'), '\S') + 0) :
\ repeat('<C-G>U<Left>', col('.') - 1 - match(getline('.'), '\S')))
inoremap <expr> <C-E> col('.')>strlen(getline('.'))<bar><bar>pumvisible()?"\<Lt>C-E>":repeat("\<Lt>C-G>U\<Lt>Right>", col('$') - col('.'))
inoremap <expr> <C-B> getline('.')=~'^\s*$'&&col('.')>strlen(getline('.'))?"0\<Lt>C-D>\<Lt>Esc>kJs":"\<Lt>C-G>U\<Lt>Left>"
inoremap <expr> <C-F> col('.')>strlen(getline('.'))?"\<Lt>C-F>":"\<Lt>C-G>U\<Lt>Right>"
I would love to figure out how to disable the <M-d>
mapping, so I can enter "ä" in emails to German correspondents. I tried
iunmap <M-d>
late in my .vimrc but that doesn't do the trick.
I use this so much at the command line that I frequently do the same in vim.
Ctrl-K deletes "⇥ from the cursor to the end of the line"
There's probably an elegant way to do this using mappings, but I'm not sure how.
If I press <M-d>
in command mode it uses the mapping for insert mode (:!echo write a few words^Odw
).
It should act the same way as <M-BS>
which works fine in command mode.
This can be solved by adding:
cnoremap <M-d> <S-Right><C-w>
In Colemak, you attain the circumflex by hitting AltGr+x
and then the letter you would like to apply it to.
î is attained by hitting AltGr+x
and then i
.
â is attained by hitting AltGr+x
and then a
.
æ is attained by hitting AltGr+z
.
I noticed the issue when trying to type in French just now.
I tested all of the French accented characters with vim-rsi disabled, and again when enabled. These are the only three that are affected, and every one of them functions correctly without the plugin enabled.
I haven't tested these with any other layout, so it is unclear if other layouts are affected. It's possible that it has something to do with how they are composed in Colemak.
hi, can you add a variable to control this rsi feature only works in command line mode, i.e., give an option to disable it in insert mode? thanks.
Hi,
whenever I have the following code:
[x]var b = new A();
[x]
is the cursor
and if I start writing the following macro:
qq0fnDo<esc>pkJ
(which is a macro that does absolutely nothing), and if I I do @q
to replay that macro, I get the following resul instead: vakJr b =
Whenever I remove vim-rsi, this doesnt happen anymore (my full dot files are here: https://bitbucket.org/edi9999/dotfiles/src/6b646ff8e5566f751c92c469b128258f62ae4bf0/.vimrc?at=master)
Do you know what is happening here ?
Maybe add mappings for C-p and C-n in the command line so they can be used to browse command history?
Consider adding
inoremap <C-> u
It's very handy for me, but I don't know how important i_CTRL- is for others.
I don't know if it's even possible to have it in command mode.
While I see vim-rsi is correctly mapping <M-d>
:
:verbose imap <m-d>
i ä * <C-O>dw
Last set from ~/.vim/.cache/neobundle/vim-rsi/plugin/rsi.vim
My $TERM/terminfo(?), prints ALT + D as ^]d
, unsurprisingly typing the ä
, results in the desired command. When running vim from an xterm, it correctly(?), maps ALT + D as ä
.
It seems every other terminal emulator (rxvt, and almost everyone [if not all] based on the vte gtk widget) maps ALT + D as ^]d
. Though, setting <M-d>
as <esc>d
, partially solves the problem:
execute "set <M-d>=\ed"
" I tried using \<Esc>, but it's too fast(?) and exists insert mode and let you in operator pending after inserting a `d`.
If I understand correctly, problem with that is that you use <M-d>
fast enough (below ttimeoutlen
?) the command gets executed as two: ^[
, and d
and you get out of insert mode and d
is inserted in normal mode.
Anyway, I think a plausible workaround could be checking the term, and in case is not xterm
, run that line. If you are interested I can do a PR.
Hi,
for the past week or so I was obsessed with setting up Alt mappings for all the possible keys based on the example provided in vim-rsi. I digged the idea of being able to use Alt as another modifier key. I even created a plugin that enables that (it's a work in progress, but I probably won't bother to finalize it).
Since then, I've learned that setting up alt mappings breaks 2 other things:
esc
+ character andesc
+ charHere's how the issues can be reproduced in vim-rsi:
istuff^[f.astuff^[
. f.
does not do what it should because ^[ + f is recognized as imap <C-s> <Esc>ddi
(this example is obviously made up)Basically, anytime <Esc>
+ b, d, f, n or p (alt mappings from vim-rsi) is executed in a macro or a mapping, I think it won't work. And it will be dang hard to debug why.
For me personally, the biggest issue are f
and n
because they are used all to often in macros.
Not sure if there's any solution to this, but I hope bringing this up helps.
Hi! thank you for all the great plugins!
I noticed that sensible.vim
defines two binds:
if empty(mapcheck('<C-U>', 'i'))
inoremap <C-U> <C-G>u<C-U>
endif
if empty(mapcheck('<C-W>', 'i'))
inoremap <C-W> <C-G>u<C-W>
endif
These are missing from rsi.vim
, shouldn't these be added also if sensible.vim
does not exist?
If you're at the bar in: as |df hj
And you hit M-f in Emacs, you end up at: as df| hi
(your next char goes right after the df
)
But in vim-rsi you end up at as df |hj
Same thing for M-d, slurping the space after the deleted text while Emacs leaves that space there.
C-u deletes from the cursor to the beginning of the line, C-k deletes from the cursor to the end of the line
I use both of these pretty frequently in bash, vim-rsi provides C-u but not C-k.
the character æ for me.
test/test/test
^
Press M-b
Expected result:
test/test/test
^
Actual result:
test/test/test
^
I am using Cygwin's MinTTY. $TERM
is xterm-256color
.
Following scenario:
<esc>
n
(as in, go to next search result)rather than going to the next match, results in cursor being moved as if I pressed <esc>ja
and it doesn't go to normal mode.
What's interesting is that rather than entering insert mode again, it looks like I never left insert mode in the first place.
This leads me to believing that I am pressing keys quick enough that it gets interpreted as an escape sequence of one keypress, which matches some libreadline key binding. Following this logic, it manifests only now because before I've installed vim-rsi
, that sequence was unbound and its components got interpreted as separate keypresses.
I can fix the behavior by adding let g:rsi_no_meta = 1
to .vimrc
, but this breaks altb in command mode.
I think adding an option whether to include readline keybindings in insert mode would be sufficient. Actually, this is caused by noremap! <M-n> <Down>
... not sure what to make of it.
Hi,
love the plugin. I was mind-blown to find Alt mappings can be used in terminal vim (tried to google that before, no success).
I was skimming the source code of the plugin and saw this:
https://github.com/tpope/vim-rsi/blob/master/plugin/rsi.vim#L51-55
I'm not particularly good with vimscript, but I don't even know where to start looking that up? Where do the - come from? Is that a vim, bash, system thing..?
I'd be grateful even for the point in a direction so I can figure it out myself. Thanks!
coc has a custom popup window now and use coc#pum#visible()
check whether insert completion is visible.
maybe vim-rsi
should give user a function to customize i_CTRL-E
and c_CTRL-Y
, like
let pumvisible_func = get(g:, 'pumvisible_func', 'pumvisible')
inoremap <expr> <C-E> col('.')>strlen(getline('.'))<bar><bar>pumvisible_func()?"\<Lt>C-E>":"\<Lt>End>"
any suggestions will be appreciated
Question asked in the README:
You know Readline key bindings? Of course you do, they're in your shell, your REPL, and perhaps even the GUI for your OS.
Turns out - no I don't, even with a decade of using linux terminals. But this plugin is very helpful through the doc to show me Readline key bindings that I didn't know existed.
This is something that repeatedly pops up for me.
While current implementation of <M-b>
and <M-f>
in command line is useful, I'd prefer to have it work just as in bash
- that is, respecting "word".
I miss this the most when trying to manually edit the middle "piece" of the filename, example:
:e /path/need_to_edit_this_part/path/file.txt
If the feature is acceptable, I'd even be willing to try to implement this, but I'm worried no one would want to merge and later maintain the vimscript I write :/
the subject says it all, just a kill to the end of the line. I like it. not sure what or if it breaks any vim stuff, nothing I could see.
Meta mappings inside a vim terminal stop working when vim-rsi is loaded.
Opening a vim terminal (:terminal) and typing Alt+f produces ';2C', Alt+b produces ';2D', etc...
I am using vim version 8.1.0229 and zsh.
using vim-rsi, unfortunately I can not use my ä-key anymore ...
CTRL-T
mapping is currently explicitly disabled in regular search modes (/
and ?
) to allow for default behaviour of jumping between incsearch
results. Recently (I believe) Vim started supporting /_CTRL-G
and /_CTRL-T
in other search modes like :global
, :vglobal
, and :substitute
. Previous special casing in vim-rsi
doesn't work for them so it is impossible to jump back (/_CTRL-G
works as expected). Can these modes also be special-cased to preserve default CTRL-T
behaviour?
It'd be nice to exit commandline mode with C-g just like in readline
This is in Neovim terminal mode, M-BS works fine in insert mode.
In modern Vim this allows you to jump to next search result without accepting current search.
Nice plugin. though I have noticed that, for example, C-a moves to the first character in the line, not the first character in the visible line when lines are wrapped.
Would it be possible for the plugin to detect this and use 0 rather than ^ to move to the start of the line? And similar behaviour for C-e, ie using $ for end of line when wrapped.
Thanks
Martin
How about including word transposition with m-t?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.