Questions tagged [abbrev]

is for the abbreviation feature of Emacs where a string of characters are expanded to a longer string. Mainly used to reduce typing, `abbrev` are recorded in a table that is shared locally, among buffers of the same major mode, or even globally. Some Emacs features, such as mail, implement their own `abbrev` functionality. Use additional tags when appropriate.

Filter by
Sorted by
Tagged with
15
votes
1answer
5k views

How add company-dabbrev to the Company completion popup?

Setup: GUI version GNU Emacs 25.0.50.1 (x86_64-w64-mingw32) of 2015-07-25 on KAEL Compiled from EmacsW64. , using the latest version of from MELPA Windows 7 x64 bit. Situation: For example, I'm ...
10
votes
3answers
2k views

Is it possible to auto-correct spelling “on space”?

I was about to post the question but then I saw it on Stack Overflow while searching for auto-correct possibilities. The linked question has no answers, so I thought it'd have more luck on this site. ...
7
votes
2answers
147 views

How to use abbrevs

I find using abbrevs in Emacs confusing. Despite reading the manual and the EmacsWiki, I continue to have problems using them. Goal: Define a quick, throw-away abbrev for a single Emacs session. ...
7
votes
1answer
139 views

abbrev table inherit properties from other tables?

Q: how can I get abbrev tables to inherit properties? Motivation: I'd like to mix and match abbrevs such that some expand automatically when typing, while others expand only when I explicitly tell ...
6
votes
1answer
114 views

Is it possible to have conditional abbrev expansion?

I have defined some abbreviations for org-mode, but I want them to conditionally expand. For example, n2 expands to N_{2}, and I want to prevent that from happening in src-blocks. The bottom of this ...
6
votes
1answer
39 views

In undo history, how to separate abbrev expansion from self-insert?

Very occasionally, hit SPC during regular typing and get an unexpected abbrev expansion. What I usually do in this case is undo (which reverts the expansion and the inserted space) and then manually C-...
5
votes
2answers
241 views

How to expand abbrevs without hitting another extra key?

How can I expand oe to ö immediately after hitting the e without hitting any extra key like space for expansion? Why? For better ergonomics I've remapped some keys like ö, ü and thus must write them ...
5
votes
1answer
88 views

Do not expand a given abbrev when followed by “:”

Let's say I use abbrev to expand eq into equation. Now I want eq to always expand, except when followed by a colon (:). The logic is that in LaTeX I do not want equation identifiers (e.g., eq:xyz) ...
5
votes
3answers
102 views

mixing automatic abbrev expansions with explicit-only expansions?

Q: can I mix abbrev expansions such that some expand automatically, and some only with an explicit call? When abbrev-mode is enabled, an abbrev expands whenever typing a self-inserting whitespace or ...
5
votes
1answer
122 views

Context sensitive skeleton triggered by abbrev stuck in loop

I want to create a skeleton, triggered by the abbrev keyword 'func' which checks its context and runs one of two possible sub-skeletons. Here's what I have: (define-skeleton my-func-skeleton "func ...
5
votes
1answer
159 views

Do not expand abbreviation if preceded by “.”

Let's say abbrev expands "com" into "commission". The problem is that this expands "google.com" into "google.commission". Is there a way to disable this expansion if "com" is preceded by a "."?
5
votes
1answer
220 views

Using a common set of abbreviation for multiple major modes

I use multiple programming languages, and there are a considerable number of abbreviations that I use across all of their corresponding major mode (they are usually name of certain variables, but not ...
5
votes
2answers
172 views

How to inherit one abbrev table in another abbrev table?

I've defined a lot of abbrevs in latex-mode-abbrev-table and I'd like to use all the contents in latex-mode-abbrev-table and org-mode-abbrev-table when in org-mode. A possible "solution" would be to ...
4
votes
1answer
868 views

abbrev vs yasnippet for this use case

I have not done much with abbrev-mode or yasnippet, but I recently started using AucTex mode with great success, and I think some common TeX markup I'm inputting could benefit from expansion. Example:...
4
votes
4answers
439 views

Prevent abbrev-mode from expanding on underscore

Abbrev-mode seems to think an underscore signals a new word, which is not the case in many programming languages. I want it to expand after spaces, newlines, and tabs; not after underscores. Is there ...
4
votes
2answers
95 views

Use abbrev to expand “-->”

I want to type "--> " and have it automatically converted into "→ ". Is there a way to do this using Abbrev?
4
votes
1answer
128 views

Abbrev expansion after quotation mark

I've looked for a solution to this a number of times. Suppose 'kg' normally expands to 'knowledge' in my abbrev file. I wonder if there is any way to get emacs to expand after a single or double ...
3
votes
1answer
66 views

Prevent abbrev expansion on capitalization

Is there a way to get abbrev expansion on a lower case abbrev but not on its upper case version? E.g.: I have "r" expanding to "are". I'd like "R" to stay "R". I don't necessarily want to get rid of ...
3
votes
1answer
374 views

do not insert space after abbreviation if there's a space already there

I would like expand-abbrev to operate differently depending on what is just after the abbreviation to be expanded. In particular, if there is a space after the cursor, then expand-abbrev should not ...
3
votes
1answer
999 views

How to disable `abbrev-mode`?

I am using Spacemacs and it always ask me to save .cache/abbrev_defs which is very annoying. I tried to put (abbrev-mode -1) in dotspacemacs/user-config function. But it still ask for save the ...
3
votes
2answers
446 views

How to use abbrev for words with dollar-sign ($) as prefix?

My setup GNU Emacs GUI (version 24.4.51.1 (x86_64-w64-mingw32) compiled from Harroogan Emacs.) Situation I would like to type a word in PHP-mode, and it will automatically ...
3
votes
1answer
84 views

how to keep my abbrevs table files separate?

I'd like to maintain several distinct abbrevs files for different types of abbreviation expansions. I have this: (read-abbrev-file "~/Dropbox/elisp/main-abbrevs-file.abbrev_defs") (read-abbrev-file ...
3
votes
1answer
139 views

rotate between abbrev expansions?

Q: is there a way to rotate between multiple expansions bound to the same abbrev? I'm experimenting with abbrev-mode, and I have some abbreviations that I'd like to use for different expansions of ...
3
votes
1answer
209 views

How do I set the directory-abbrev-alist values?

I'd like to customize this value - it's briefly mentioned in the manual. How can this be done?
2
votes
2answers
1k views

File name autocomplete with dropdown

I like vim's tabcomplete feature - filename completion for its dropdown choices. Like this vi popdown, I use hippie-expand with functions, try-complete-file-name-partially try-complete-file-name. It ...
2
votes
1answer
81 views

Abbreviation expansion without spaces

I would like to set up things so that when I type Iuulius, the sequence uu is seamlessly replaced by ū (and a few more such pairs), as soon as I type the second u. I.e. the keystrokes and buffer text ...
2
votes
1answer
44 views

Org-mode: disable abbrev-mode in source blocks

I use org-mode to write an executable paper, combining text and code. I make use of abbrev-mode to insert text more efficiently (e.g. type 'bc' to insert 'because') and to correct spelling errors. Is ...
2
votes
2answers
472 views

Disable “Autocompletion”/“Abbreviation” in Verilog-Mode

When I use the Verilog Mode in spacemacs with evil keybindings, every time I type e.g. wire and press ESC, an automatic dialouge pops up and asks me msb:, lsb: and name (RET to end). This is super ...
2
votes
1answer
453 views

Alternative to abbrev-mode that supports special characters in abbreviations?

I already use abbrev-mode to correct common typos, e.g. I have an abbrev setup for expanding functino to function, etc... I'm currently writing a large document, and I keep stumbling over the ...
2
votes
1answer
116 views

Highlight abbrev upon expansion

I don't really like the feeling of not being in control when using emacs' abbreviations feature. On the one hand, I don't want to be asked all the time but on the other hand I'd like to know when an ...
2
votes
0answers
104 views

How to cycle between language specific abbrev tables in a buffer?

I have (human-)language-specific abbrev-tables named like lang-francais-mode-abbrev-table, lang-castellano8-mode-abbrev-table backed by my ~/.emacs.d/abbrev_defs file. The language names are the ...
2
votes
0answers
94 views

specify global-abbrev-table in a separate file

I know one can define where abbrev files are saved with something like this (setq abbrev-file-name "/home/zeltak/.emacs.d/abbrv/personal_abbrv.txt") but this file has several section like (define-...
1
vote
1answer
103 views

How to insert the current date into a file using abbrev or similar?

I'd like to replicate something in emacs that I do in AutoHotkey all the time: type td have that string be replaced with the current date I'm trying to do this with Emacs abbrevs but I'm running ...
1
vote
3answers
256 views

Regexp only matching one character when using abbreviations

I'm trying to expand abbreviations with some additional characters, so I'm using the regexp option on an abbrev-table to try and add these characters. The expression I used was found on this tutorial ...
1
vote
2answers
367 views

abbrev-mode - Expansion with trailing / does not work

I want to have w/ expand to with globally. Defining the abbrev in the usual way works (e.g. typingwith C-x ag w/), and the entry in the abbrev_defs file looks fine - output of M-x list-abbrevs under (...
1
vote
1answer
74 views

Don't consider space and tab as abbrev-expand commands, but keep the C-x whatever shortcuts intact

I read the docs (at bottom) but can't figure this out. I just started using "abbrev.el", and find that pressing space, tab, C-x ', C-x a ', C-x a e can cause the expansion to happen. what if I find ...
1
vote
1answer
87 views

Change key for f90-start-abbrev

Emacs defines ` to be used for abbrevs in f90 mode. How do I change this so some other key, like e.g. # ? I think, I found the relevant lines in f90.el: (defvar f90-mode-map (let ((map (make-sparse-...
1
vote
1answer
85 views

Adding abbrevs in ess-mode

I can't seem to get abbrevs working in ess-mode when editing .R files. I have ess-mode hook to activate abbrev-mode, but I get no expansion for my global abbrevs. When I do add-mode-abbrev I can ...
1
vote
1answer
65 views

Replace a character with a string as it is typed

I would like to do the following: activate some mode so that whenener I type the $ character in my buffer, it immediately gets replaced by <m>. Even better: when I type $ it puts <m></m&...
1
vote
1answer
70 views

abbreviations do not expand

My abbreviations are not expanding when I type the abbreviations I have the following in my ~/.emacs for initiating the abbrev mode (setq-default abbrev-mode t) (setq save-abbrevs t) (setq abbrev-...
1
vote
1answer
129 views

abbrevs not expanding

I have wrote the following abbrev definition file, and saved it as my_abbrev.el: (define-abbrev-table 'global-abbrev-table '( ("else__" "else begin end") )) ;; turn on abbrev mode globally (...
1
vote
1answer
39 views

Abbrevs with interstitial capital letters

Whenever I type YouTrack, abbrev erroneously corrects it to Youtrack. I noticed that in my abbrevs file it has ("youtrack" "youtrack" nil :count 7). Why is that there, and how can I get abbrev to ...
1
vote
1answer
37 views

Define abbrev for `helm-mini`

I am trying to define an abbreviation for helm-mini, I would like d to expand to *dired. When I try my usual way of *dired C-x a i l, I get an error saying Command attempted to use minibuffer while in ...
1
vote
1answer
392 views

use a single abbrev-table for multiple modes?

I would like for all my text-based modes (org, markdown, message, mu4e-compose, etc) to use a single abbrev-table, and especially, to add new abbrevs to that shared table whenever I'm in one of those ...
1
vote
1answer
114 views

Emacs' default `expand-abbrev` does not work

I try to use emacs -Q and then input RET RET dd in *scratch* buffer and then M-x add-mode-abbrev, then after the prompting message Mode abbrev for "dd":, I input abcdefg RET. So I defined an mode ...
1
vote
1answer
84 views

How can I get “this->” by inputting “this.”?

I want to input this. and get this-> in c++-mode. I tried abbrev-mode and yasnippet, but failed. In abbrev-mode, I defined an abbrev this to get this using . as a trigger key, but soon as I typed ...
1
vote
0answers
13 views

How can I always expand abbrevs with prefixes?

How can I remove the need to use M-' for abbrevs with a prefix? From the manual: You may wish to expand an abbrev and attach a prefix to the expansion; for example, if cnst expands into ...
1
vote
0answers
66 views

Can you use a regexp in an abbrev definition?

I want to replace words like 1st with 1^{st} and 102nd with 102^{nd} while typing in emacs. Basically I want to replace things that match this: "\([0-9]+\)\(st\|nd\|rd\|th\)" with this \1^{\2} as I ...
1
vote
0answers
151 views

Triggering abbreviation expansion or auto completion automatically from a regular expression match?

With abbrev mode, I can define abbreviations that trigger when I type a certain term. For example, typing "yn" would be expanded to "Your Name". For this, "yn" must have been defined as an ...
0
votes
2answers
141 views

Quick/electric text expansion

I've seen in some Emacs videos, the author would type #+BEGIN_SRC in their buffer, and emacs auto inserts #+END_SRC. Is this a feature I can "turn on" in vanilla Emacs? If not, which package can I ...