Questions tagged [abbreviations]

Vim can handle abbreviations to replace some text by some other text. Question about creating these abbreviations and how to make them work.

From :h abbreviations:

Abbreviations are used in Insert mode, Replace mode and Command-line mode. If you enter a word that is an abbreviation, it is replaced with the word it stands for. This can be used to save typing for often used long words. And you can use it to automatically correct obvious spelling errors.

65 questions
10
votes
3 answers

How do I manage and remember many abbreviations in my vimrc?

I have over 500 abbreviations(iabbr, abbr) and some mappings in my vimrc file from Java, PHP, C/C++ and Latex. It is not easy to remember right away when I don't use the languages for some time. I'm wondering whether I can do completion on…
1234
  • 235
  • 2
  • 6
9
votes
4 answers

Backspace in insert abbreviation

To work, abbreviations need to be separated by whitespace. E.g., if I have an iab fo FOOBAR then typing whatfo will not trigger the abbreviation. There are some obvious sensible reasons for this. However, I'd like an abbreviation that could be…
goldilocks
  • 801
  • 6
  • 23
7
votes
1 answer

Undo a single iab abbreviation expansion

Vim has an "abbreviation" feature built-in that can automatically expand certain abbreviations: :iab SE Stack Exchange However, sometimes I might want to type "SE" without it expanding to "Stack Exchange." Is there any way to undo a single…
Doorknob
  • 15,237
  • 3
  • 48
  • 70
5
votes
1 answer

Can vim automatically correct a spelling mistake if the word doesn't end in a space?

I use vim for writing code and often accidentally type this: funciton() {} instead of function() {} It's irritating and I know vim supports iabbrev for this purpose. But it doesn't work in this case since there is not a space after the word…
user37078
  • 153
  • 3
4
votes
2 answers

Autocorrecting final sigma

When writing Greek, sigmas at the ends of words should have a different form. Can I do something automatically to replace: μῖσοσ by μῖσος, and so in all such cases?
Toothrot
  • 3,129
  • 13
  • 27
4
votes
1 answer

How to put a new line character in an abbreviation?

I tried the following commands: :abb sm Summary:\n :abb sm Summary:\\n but it didn't work, nothing escaped, I ended up with the long form instead of a break. Is there a way to do that from ex mode? Is it something with one of those ^M characters? I…
leeand00
  • 3,555
  • 5
  • 24
  • 40
3
votes
1 answer

Special characters in iskeywords

I wonder how one can add characters such as (yes, space!), ' (single quote), " (double quote), etc., to iskeyword. This is not a theoretical exercise. The purpose is iabbrev for these. I noticed that if you add a character to iskeyword, then use it…
Yossi Gil
  • 755
  • 5
  • 19
3
votes
1 answer

iabbrev with and

I use vim to develop with Python and it works fine. However I want to improve the behavior for documenting my code. For instance I wrote this in vimrc : :iabbrev """ """ """3hi It works fine but I would like to differentiate the behavior…
Nimu Nobdy
  • 33
  • 3
3
votes
2 answers

abbrev for multiwords

How to add abbrevs made of more than one word? I've been trying: iabbrev a aquilo àquilo iabbrev a aquele àquele iabbrev a aquela àquela What I want to do is have the two words "a aquilo" expand to "àquilo". But it won't work. Also, I see in the…
3
votes
1 answer

Wrong abbreviation expansion

I have these abbreviations in my .vimrc: iab seq sequent iab seqs sequents seqs expands to sequents i seq sequent in a tex file (I have installed vim-latex). In an empty buffer seqs expands correctly to sequents. How could I get the correct…
Romas
  • 75
  • 4
2
votes
1 answer

Abbreviations add spaces when they shouldn't

I'm trying to create an abbreviations to insert a comment and to insert a TODO comment. I wrote them as following: iab co /*__*/ This one produces the following (where it has three spaces) /*__|_*/ And for the TODO comment, I…
Salahuddin Ahmed
  • 441
  • 3
  • 14
2
votes
1 answer

One abbreviation for various commands with different prefix?

To take a short cut in writing markdown files I need an abbreviation which can combine these abbreviations, autocmd FileType * iabbrev pythoncode ```python```jjO=Eatchar('\s') autocmd FileType * iabbrev vimcode…
Lerner Zhang
  • 740
  • 7
  • 19
1
vote
0 answers

vim insert abbreviation with text in front of the map

Is there an option to make vim expand an abbreviaiation at the end of a word? In other words let's say I map :iab bb bar, how can I get the expansion: foobb = foobar?
nicmus
  • 141
  • 2
1
vote
1 answer

Abbreviations: Count backslash as part of the word

I am usually writing LaTeX documents. I like to use :iab iso isomorphism so that if I write a sentence like This map is an iso., it will expand to This map is an isomorphism.. However, I also quite frequently use the command \iso in math mode. So…
user17723
1
vote
0 answers

Abbreviations do not work when space is conditionally remapped

I want to change the behavior of when the popup menu is open using this map inoremap pumvisible() ? "\\" : "\" However, with this map my abbreviations no longer get triggered when terminated by a…
Mewer
  • 11
  • 2
1
2