Disable special characters in VIM - vim

I'm trying to "ease" into VIM as my primary coding editor. I find that I'm still making plenty of "mistrokes" as I learn the many modes/features of VIM. While I'm in insert mode, I notice that combinations of keystrokes will produce special characters - mostly characters in non-latin alphabets.) I would like to disable this for now. Is it possible? In order words, to prevent multi-byte characters from being displayed in insert mode?
EDIT: (added example)
One example of this is when I delete a character (delete key on mac keyboard) and follow this quickly with another character. For example, delete+d produces " οΊ½ " .
Thanks!
Steve

This sounds suspiciously like keys not timing out as controlled by 'timeout', 'timeoutlen', 'ttimeout' and 'ttimeoutlen'. You might try
:set timeout timeoutlen=5000 ttimeoutlen=50
which should cut the time vim will wait between keystrokes to see if they're the "same" (pseudo-)key down to 50ms.
The exact numbers you want would vary depending on your connection. If you're editing over a low-bandwidth connection, you might have to bump up the 50ms to something higher if you use function keys, 6-pack, or arrow keys (anything that transmits as a sequence of characters).

In vim, typing the two characters with a backspace between them will produce a digraph if the digraph option is set. If you want to disable this, see if there is a set digraph in your vimrc and remove it.
Your terminal settings probably map the delete key to backspace.
If you don't want that, you have to change that in the settings.

Related

Insert a specific string instead of tabs or spaces in gVim

Since I'm working with LaTeX documents in vim, I want to be able to insert \quad instead of a tab space whenever I press tab (instead of having to replace/insert them manually). Is there any setting that could do this? If not, are there any plugins that work like this?
While you can use inoremap to change Tab to \quad in insert mode, that means
that you lose the original Tab functionality...
This might be worth it if you're sure that you'll never want to use Tab, but
what will you do when you face a similar problem of wanting some
latex-specific text? You could try and find a second key to map... but each
addition will take up a new key that already had some function.
The way I would handle this would be to use iabbrev to map some unlikely
sequence of keys like ;q to \quad:
iabbrev ;q \quad
This has the advantage that you can build up a whole set of insert mode
abbreviations, all consistently starting with ; followed by a letter or two
that you can choose to be easily remembered. And you get to keep all the
original functionality.

Vim spell check automatically splits the screen

I typed z= underneath a misspelled word, and vim split the screen horizontally, thereby keeping the misspelled word in context, but also providing a list words to change the misspelled word from. Usually, this latter screen replaces the former screen when I hit z=.
I like this behavior, but can not replicate it. I must have hit something before z= but I do not know what.
The behavior you saw accidentally happens when there are only a few suggestions and they don't fill the entire window.
You can force a maximum size for the suggestion list (example: 20 suggestions) with
set spellsuggest=best,20
Now, as long as your window exceeds 20 lines, you will see the misspelled word in context, and the bottom 20 lines of your window filled with the suggestion list
I can't say what caused the behavior you saw, maybe it is some plugin.
But here are two options to stay in the context with spellchecker:
1) Use CTRL-X s in insert mode:
In Insert mode, when the cursor is after a badly spelled word, you can use
CTRL-X s to find suggestions. This works like Insert mode completion. Use
CTRL-N to use the next suggestion, CTRL-P to go back. |i_CTRL-X_s|
2) Use vimple plugin which turns few full-screen windows (including spell suggestions) into "overlays" (actually split windows where you can select the word you need).

How to skip over auto-inserted matching chars in vim insert mode?

When I'm in VIM insert mode, it wonderfully adds matching end characters. E.g. if I type " it will add another " immediately after the cursor. Similarly for parenthesis, braces etc. when programming.
How can I quickly skip over the inserted character, while staying in insert mode? The best I've found is to use the forward arrow key, but that's not conveniently located.
Accordingly, I either type the closing character, or I <esc>li (exit insert mode, move right one character, re-enter insert mode). This reduces the convenience of the auto-insertion quite dramatically, so I figure I'm missing something obvious.
(Note, for convenience I'm using the handy SPF13 curated collection of plugins and running MacVIM. Edit: This is the autoclose script providing the matching.)
There's basically no way to get out of an autoclosed pair that doesn't involve pressing at least one key.
The standard mechanism provided by all the autoclosing plugins is simple: type the closing character. You can also press <Right> or, if you are at the end of the line, <End>.
Maybe your plugin gives you another mechanism but you'll have to find out for yourself.
Whatever key you press, you'll still do at the very least exactly the same amount of typing as you'd do without autoclosing.
Autoclosing is not about saving typing, the only practical use of that feature is to prevent unmatched pairs. That's all and, I think, the "obvious" thing you are missing.
As you are using a SPF13 and don't know which plugins brought the mapping. There are two things that we can do
1) I usually esc followed by A. This will kept you in insert mode after the closed character if it is the last character. I usually prefer this over the second one.
2) You can circumvent the automatic closing by ctrl - v before the character, for instance ". This will not autoclose the corresponding character and you are responsible for the closing.

vim supertab, toward a best way to insert a tab

I really like the supertab plugin. Reaching <C-x><C-p> is a bit too long and mapping it to tab gives me a better workflow. However, sometime I just want to insert a regular tab and for this I need to insert a space first, i.e. foo<Space><Tab>bar.
This pollute my sources with useless spaces before each tab char (this assuming I don't use expandtab).
I am wondering is there is a smarter way to use auto-completion ?
Going back to <C-x><C-p> which is much slower
Using another key mapping like
Using supertab with a wiser feature:
i. Automatically insert a <Tab> if I press a char that doesn't match any of the possible completions.
ii. Inserting a real tab with
???
Any ideas?
You can suppress the Supertab trigger and insert a literal tab by pressing <C-v><Tab>. (On Windows, that frequently is <C-q><Tab>.)
Supertab also provides a mapping for direct input, by default <C-Tab>; see :help supertab-mappingtabliteral. That default key combination probably only works in GVIM, though.
Just another try.
You can have a global substitute after editing work like:
:%s/ \t /\t/g

Press pageup/pagedown after press esc when use vim in tmux

When I Press pageup/pagedown after press esc when use vim in tmux, it will lower-case/upper-case the three characters after current cursor, is there any way to fix it?
thanks.
This is a bit of a non-answer, but don't!
Using arrow keys and special keys like Home, End, etc. is generally discouraged. In addition to the speed loss of moving your hands off the home row, there are often side effects like the ones you're seeing now.
Instead, use Ctrlf and Ctrlb to go forward and backward a page (same effect as Page Down/PageUp).
Alternatively, you can use Ctrlu and Ctrld to go up and down with smaller jumps.
Specifically, the page-up key will send a sequence of characters, not a single character, to the input stream, which must then be interpeted. That sequence might be something like "^[[5~" (escape [ 5 ~), which means vim sees the ~ and performs its case-changing behavior.
You may remap case-changing key or just disable it:
if &term =~ '^screen'
" disable case-changing command to fix esc-esc-pagedown misbehavior.
map ~ <Nop>
endif

Resources