How Do I delete a remap from .ideavim? - ideavim

Am using intelij and Ideavim.
I remapped Esc to gh by typing inoremap gh <Esc> in .ideavimrc and its been working fine. Recently, I found out that while typing a word like "Highlight", the gh inbetween will always be read as gh and then vim will move out of insert mode.
I've tried to revert it by deleting the content in .ideavim but the old gh is still working.
I've also tried changing it to gg and then to jj in an attempt to may be erase the old gh, but they seem to be pilling up.
When I type in :imap, I see this
And all three of them, gg, gh, and jj are all working as Esc when in insert mode.
How do I get rid of the rest and leave only jj?
I've also tried a lot of suggestions, like using iumap or umap but it doesn't seem to be working.
Am on windows.

The solution was imapclear. This cleared all the previous remaps I made.
Note, it will clear only the remaps that are effective in insert mode only.
Here is a very usefully resource that helped me https://vim.fandom.com/wiki/Mapping_keys_in_Vim_-_Tutorial_(Part_1)

Related

VSCode snippets (Hypersnips) tab stops in nested use of snippets

I am using VSCode Hypersnips (based off of Vi's https://github.com/SirVer/ultisnips), following this guide . See also Create-Snippets-For-Ultisnips.
Consider the following example: I have a snippet
snippet fm "inline Math" wA
\(${1}\) $0
end snippet
and another snippet
snippet ( "parenthesis" wiA
($1) $0
end snippet
If I were to type fm, then that would produce \(|\) |, where the first | is where my cursor is, and the second | is where my cursor would be if I pressed <Tab>. Now, when I type fm ( hi <Tab> that produces \((hi) |\) as expected, but when I press <Tab> again (hoping to use the $0 tab stop of the fm snippet), I don't get outside the right \) like I want, and instead a tab character (i.e. 2 spaces) are placed where the cursor is.
I am wondering if I can nest snippets like this, and still use the tab stops of the outer snippet once I exit the inner snippet.
I assume the same issue occurs if I use native VSCode snippets.
StackOverflow informs me that a similar question has been asked: Atom - Nested snippets with tab stops error, but not about VSCode's snippets.
It seems this is known issue: https://github.com/draivin/hsnips/issues/78. This is a summary of the issue from Dec. 2 2021:
So, I looked into it, the placeholder disappearance is caused by a
workaround we are currently using to get around a VsCodeVim issue.
History time:
We started using the workaround to get around this issue Trigger A leaves me in visual mode, I want it to leave me in insert
mode instead #28.
Supposedly, the related issue in VSCodeVim was fixed
here Snippet is not working Properly VSCodeVim/Vim#5240.
I'm not sure
if it was never properly fixed, or if a regression happened, but it
seems that the issue still exists (see Unexpectedly entered visual
mode in snippet VSCodeVim/Vim#7068), so while that issue is still
open, we can't remove the workaround and fix this bug.
For now, https://github.com/draivin/hsnips/issues/126 offers what I think is the best solution, namely using VSCode Neovim.

Complete command from history in ipython

For reasons outside of my control I'm stuck using python 2.6.6 and IPython 0.10.2. I also normally use the tcsh shell, and have gotten quite used to completing a command from the history using <A-p> (i.e. pressing the ALT key and p). However, this doesn't work in IPython. I know I can press <C-r> and then start typing a command, but what inevitably is happening is that I start a command, press <A-p>, get a colon indicating some weird state, then exit out of that state, delete my command, press <C-r> then search for my command. It's getting rather irritating. Is there any way to make <A-p> complete my already started command by relying on the history?
Ouch, this is an old version of IPython, Python (and pip). The bad news is I don't have much experience with such an old version of IPython, the good new is; it was way simpler at that time.
Most of the shortcut and feature are provided using readline, and the python bindings of stdlib. Meaning that most likely what you are trying to configure is readline itself and not only IPython; so you can find more information on that outside of IPython !
The secret is to grep in the source-code for parse_and_bind, then you'll find the following example configuration, leading me to change the ~/.ipython/ipy_user_conf.py to be like so at around line 99 (all indented an extra 4 space to be in the main() function):
import readline
readline.parse_and_bind('set completion-query-items 1000')
readline.parse_and_bind('set page-completions no')
rlopts = """\
tab: complete
"\C-l": possible-completions
set show-all-if-ambiguous on
"\C-o": tab-insert
"\M-i": " "
"\M-o": "\d\d\d\d"
"\M-I": "\d\d\d\d"
"\C-r": reverse-search-history
"\C-s": forward-search-history
"\C-p": history-search-backward
"\C-n": history-search-forward
"\e[A": history-search-backward
"\e[B": history-search-forward
"\C-k": kill-line
"\C-u": unix-line-discard"""
for cmd in rlopts.split('\n'):
readline.parse_and_bind(cmd)
The repetition of commands make me think that what \C,\M or [e mean might be system dependant. I would bet on \C being Control, and \M being Meta (Alt, Opt), but at least one of these line did the trick for me (and also now tab allows to complete). See also man readline for the list of commands you can bind to what, and enjoy! Hoping you can upgrade to Python 3 and IPython 6 at some point.
[Edit]
See Eric Carlsen second comment under this answer for how it was resolved.

Powershell commands?

Ok I'm having trouble and google isn't helping, so I thought I'd come to you geniuses. I'm using Powershell and posh-git, and it keeps doing something that I'm sure I can exit out of with a magic command, I just don't know it yet.
Basically, when I run git diff (or something else with a long result), it will only give me a screen's worth of information, and end the screen with a colon
:
And if I keep pressing Enter it will add more to the screen til it is done showing everything for that command, and shows
<END>
But now what? How do I get out of this and back to calling commands? Enter, Esc and the other things I thought to try are not helping. I'm sure this must be a simple thing, but I don't know how to explain to Google what I want.
Anyone know?
if you do a git config -l you may see some relevant entries like:
core.pager='less'
pager.diff=false
pager.log=true
You can enable or disable the pager for different commands, or set a different pager. https://www.kernel.org/pub/software/scm/git/docs/git-config.html has the details, check out the core.pager section and pager.<cmd> sections for specifics.
If you're using 'less' as your pager, hit 'h' at that : prompt to get lots of details about what you can do there, and as pointed out by others, q, Q, or ZZ will get you back to the command line.
You can terminate the current command using CTRL+C. Is that what you're asking?

Emacs Prelude, Smartparens, and OsX

I'm using OSX 10.9, iTerm2, Emacs Prelude, and Clojure with all the modes that entails most relevantly, smartparens. Good so far.
The short version is: has anybody out there found a harmonious way to use all of this together with OSX Mission Control?
The longer version goes: I want to be able to use commands like sp-forward-slurp-sexp, which has a default keybinding of C-<right>, better known as the default OS-level shortcut for "switch Spaces right via Mission Control." I can re-map that fairly easily (say, to C-Shift-<right>) -- but now, I discover that C-<right> actually seems to be sending something like M-[1;4A. Instead of triggering sp-forward-slurp-sexp, you get sp-wrap-with-pair "[". Uhm.
I dug up this dissertation on re-mapping keys, which is very thorough, but also involves re-mapping rather a deal of stuff, then disabling the parts of paredit that are listening for the M-[ command. While this technically seems to work, I actually rather like having sp-wrap-with-pair enabled. Perhaps a better option would be to embrace the theoretically equivalent C-( -- except iTerm2 only interprets that as a literal 9, and C-) as 0. This SO post chews on this problem, and gets as far as a tantalizing comment suggesting that C-( and C-) simply be re-mapped to escape sequences that emacs can map back to C-( and C-) -- but frankly, I haven't a clue how to figure out what escape sequences those should be.
Bringing it all home: has anybody found a way to use all of these tools (Mission Control, iTerm2, Emacs Prelude, smartparens) together without having to re-wire or disable parts of some or most of them? Or: who has the most elegant re-wiring? Anybody figured out the C-)-to-escape-sequence-back-to-C-) trick yet?
Edit
Stabbing in the dark, I've done the following:
1. Set iTerm to send an escape sequence for the keyboard shortcut Ctrl-Shift-0 (C-S-)) of SPRTPRN.
2. Put this in my emacs config:
(define-key input-decode-map "\eSPRTPRN" [C-right-paren])
(global-set-key [C-right-paren] (kbd "C-)"))
...it does not work, but I've a hunch I'm getting closer. I think.
Edit, Again
I realized something: the notion that Shift doesn't work here doesn't make sense to me. At least on my emacs install, M-< and M-> jump to the beginning and end of a buffer, respectively -- and to use those commands, I have to actually press Meta-Shift-<. Huh.

IPython's history-search-backward not working as desired

IPython's history-search-backward feature is one of my favorite features. history-search-backward allows you to type part of a command and then search backward through your readline history for commands that began with that part of the command. By default (I believe) these are bound to UpArrow or Ctrl+P and DownArrow or Ctrl+N (for backward and forward respectively).
They are not working for me. Instead they just go linearly through my history instead of taking into account the characters I've already typed to (allgedly) filter my history.
I'm running IPython 0.13.2 (with Python 2 and 3) on Arch Linux from within XTerm.
If I hit Escape, Ctrl+P, then UpArrow and DownArrow work exactly as I want them to.
Additionally if I change my ipython_config.py to include
c.TerminalInteractiveShell.readline_parse_and_bind = ['"\\e[B": history-search-forward', '"\\e[A": history-search-backward']
then I can just do Escape UpArrow for the desired behaviour. (Here's the rest of my config file.)
Ctrl+V UpArrow produces ^[[A as I expect. I have the python readline library installed (which seems to fix common problems with macs running IPython).
I have these lines in my .bashrc
bind '"\e[A": history-search-backward'
bind '"\e[B": history-search-forward'
and they work exactly as I want them to within bash.
I have no idea what else to try next, so I've come here. Please help, I hope I've included enough information and done enough research.
The culprit was set keymap vi set in my .inputrc. I removed that and IPython history went back to what I expected. Thanks to #Thomas K!