Stack Exchange Network

Stack Exchange network consists of 174 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

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.

0
votes
0answers
24 views

Make abbreviations trigger only with ^]

Is it possible to define a set of abbreviations that trigger only on ^]. For example, in LaTeX I would like to define the abbreviation iabbrev <buffer> (( \left( without giving up on the ...
0
votes
1answer
28 views

iabbrev starting with semicolon

I want some abbreviations for common things typed in e-mails want to start them with a semicolon. iabbrev ;ph 555123467 But this gives me an error: E474: Invalid argument I can have semicolon ...
2
votes
1answer
95 views

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 /*__*/<Left><Left><Left> This one produces the following (...
3
votes
1answer
39 views

autocmd changes only applying to new files

I've been going through learn vim the hard way and am currently adding abbreviations via autocmd. I've added the following to my .vimrc augroup outputs autocmd! autocmd FileType php :...
2
votes
1answer
43 views

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? ...
2
votes
1answer
62 views

vim-latex: sometimes abbreviations do not expand in tex buffers [duplicate]

I have installed vim-latex v1.10.0 on Fedora 28, using vim-plug: Plug 'vim-latex/vim-latex' I've defined an insert mode abbreviation: :iab bd text I can trigger bd to expand to "text" only with ...
3
votes
1answer
112 views

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 ...
1
vote
1answer
49 views

How to make abbrev ignore my custom keybindings?

For example, I've mapped inoremap ( (), and if I do iabbrev if if(then it will expand to if(then) instead of if()then (the inoremap is executed after the iabbrev). Is it possible to make iabbrev ...
1
vote
0answers
31 views

Abbreviations do not work when space is conditionally remapped

I want to change the behavior of <Space> when the popup menu is open using this map inoremap <expr> <Space> pumvisible() ? "\<Down>\<Enter>" : "\<Space>" However, ...
1
vote
3answers
50 views

Substitute an insert-mode input immediately

I would like to type begin! in insert mode and having it immediately replaced by: begin [cursor here] end I considered mappings: :inoremap begin! begin end<Left><Left><Left><...
1
vote
1answer
161 views

How to make command-line abbreviations that only trigger at begining of line

I have a custom save function, and bound it to :w by using an abbreviation: cabbrev w call SaveBuffer() This works, but I ran into issues when I wanted to reference window local variables because w: ...
0
votes
1answer
51 views

Why won't Ctrl-C complete abbreviations when mapped to Esc?

I'm running vim -u NONE -U NONE, then doing :inoremap <c-c> <c-[> (or :inoremap ^C ^[, which I understand to be equivalent), and set an abbreviation, :abb dyca dynamic_cast. The problem ...
4
votes
2answers
197 views

Case-insensitive abbreviations

I use abbreviations extensively to make writing in languages other than English easier. For example, I have something like this set up for when I'm writing in Italian: inoreabbrev perche' perché ...
0
votes
1answer
49 views

Creating fillable “mini templates”

I am using somebody else's vim script that has a neat plugin that allows me type in something like sub<tab> and it will generate the following for me: sub ___ { ___ } The blank lines act ...
2
votes
1answer
62 views

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```<left><left><left>&...
1
vote
2answers
165 views

Abbreviation-likes containing spaces

Let's get directly to it. I was working with some python code and realized I had written a bunch of elif blocks as else if after working too much in Javascript. My natural thought was "cool, I can ...
4
votes
2answers
91 views

Expand abbreviation when the following non-keyword character is mapped to something else

I've got the following mappings and abbreviations in my .vimrc let mapleader = "," inoremap <leader>( ()<ESC>i iabbrev pirnt print Now abbreviations won't expand if the following ...
1
vote
1answer
321 views

Remap <ENTER> so it makes new line and insert a datestamp

I'm making a program for taking statistics during sports, where I script the games. I'm would like to make a VIM shortcut/remap, so every time I press that it does exactly what the ENTER-key normally ...
1
vote
1answer
58 views

How to get abbreviations to work inside nnoremap

I would like to have an abbreviation (xdate in this case) expanded when I use it in nnoremap. Is this possible? Here is what I've tried: iab xdate <c-r>=strftime('%c')<cr> nnoremap <...
2
votes
2answers
368 views

Shortcut / abbreviation to insert text block

I'm trying to do something fairly simple. I'm writing latex and I have all these blocks of code, that I'm trying to comment out (and disregard the words in the word count). So I have to write these ...
2
votes
1answer
81 views

Something like iabbrev that works in the middle of words?

In LaTeX the \ldots command is used to make an ellipsis, so I wanted something like iabbrev ... \ldots that would work in the middle of words, so whatever... would become whatever\ldots. Any ideas?
9
votes
2answers
905 views

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 ...
1
vote
2answers
288 views

How do I make abbreviations expand for minimal prefixes?

I want to create abbreviation for a large word, say configuration. Vim command works even if we type part of it. Example, s[ubstitute]. When you type s, su, sub, subs, subst, substi, substit, etc., ...
3
votes
1answer
315 views

How to create multi-line abbreviations

I want to create an abbreviation for multiple lines. For example, when I type Doc, it has to print a four line text like ############### # function : # returns : # ############## When I tried to do ...
1
vote
0answers
49 views

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<space> = foobar?
4
votes
1answer
160 views

insert mode Abbreviations work in command mode, but not in insert mode

I have: au BufRead,BufNewFile *.tex set filetype=tex au BufRead,BufNewFile *.tex inoreabbrev ß \ss{} au BufRead,BufNewFile *.tex inoreabbrev ö \"{o} au BufRead,BufNewFile *.tex inoreabbrev ä \"{a} au ...
4
votes
2answers
181 views

cabbr definitions disturb searching in Vim

I like to define some abbreviations like: cabbr csf cscope find I thought cabbr would just be interpreted in the : command line. However, when I entered the search mode \, I found that \csf would ...
6
votes
1answer
67 views

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 ...
8
votes
4answers
369 views

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. ...
5
votes
1answer
108 views

Is it possible to put vim comments in lines that include `iabbrev`

Is it possible to put vim comments in lines that include iabbrev, as in: iabbrev hte the " common typo
3
votes
1answer
370 views

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 ...
0
votes
1answer
30 views

How to fix :cmap breaking :cabbrev [closed]

I have a few :cabbrev mappings that I use frequently, like :qq as a shortcut for :q!. Recently I installed a nifty plugin and these abbreviations no longer triggered with Enter, although Space would ...
3
votes
1answer
71 views

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?
3
votes
1answer
135 views

Disabling Automatic Latex Plugin (ATP) mappings

I’m trying to use the Automatic LATEX Plugin for Vim (ATP), and found it has quite neat features. However, I do not like input abbreviations, so I tried to disable them using let g:atp_no_env_maps=1 ...
10
votes
2answers
178 views

Context sensitive insert mode mapping or abbreviation

I'm planning to implement some utility mappings for my LaTeX plugin to simplify typing of mathematics. For instance, I want to create abbreviations similar to `a : \alpha `b : \beta -> : \to => ...
5
votes
2answers
632 views

Is there a way to set an abbreviation in a modeline so it is always available local to one file buffer?

I have a handful of files (LaTeX documents) that have one specific proper name that is really obnoxious to type out but used frequently. I've eased the pain of this with an abbreviation like so: iab ...
0
votes
1answer
201 views

Strange behaviour of abbreviations triggered with shift+enter in gvim+vim-latex

Playing with abbreviation in insert mode i noticed the following unexpected behaviour, when using gvim with vim-latex plugin: Defining an abbreviation such as :iab m <m> or any similar "...
17
votes
1answer
3k views

What are the differences between the map, noremap, abbrev and noreabbrev commands?

These commands transform one set of keystrokes to another in some way, but I am somewhat fuzzy on which one is most appropriate for some situation. In addition, there are the ! variants of them as ...
5
votes
1answer
121 views

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 ...