Reputation: 597
I'm working on a little vim plugin for a new language. I'm currently working on some cool effects to change some characters and words into badass unicode character such as \
turns into λ
.
I now want to make not
turn into ¬
but this causes some complications since I cant just match on not
since that would cause a word like nottingham
to turn into ¬tingham
so I created the imap:
inoremap <space>not<space> ¬
But this causes an annoying delay every time space is pressed. Is there anyway to fix this?
NOTE:
I'm not using conceal
since it causes the characters to flip back and fourth and it messes with the highlighting.
Upvotes: 0
Views: 61
Reputation: 10391
Simplified and default behaviour is timeout delay is controlled by timeoutlen=1000
when timeout
is on
, default value is on
.
So, to reduce to half the current timeout value, :set timeoutlen=500
.
More at :h timeout
.
Not sure, if this is what you are looking but is more flexible than abbr
approach.
Upvotes: 0
Reputation: 24812
Use an abbreviation for this:
:abbrev not ¬
For the "space before 'not' part":
from :help abbreviations
('not' is a full-id
abbreviation, see the help for all abbreviation types):
The characters before the cursor must match the abbreviation. Each type has
an additional rule:
full-id In front of the match is a non-keyword character, or this is where
the line or insertion starts. Exception: When the abbreviation is
only one character, it is not recognized if there is a non-keyword
character in front of it, other than a space or a tab.
For the "space after 'not' part":
An abbreviation is only recognized when you type a non-keyword character.
This can also be the <Esc> that ends insert mode or the <CR> that ends a
command.
Upvotes: 2
Reputation: 3405
You can use
iabbrev not ¬
This uses the built-in abbreviation system which is much faster than inoremap with spaces.
Upvotes: 0