In insert mode, <c-v>O will let you insert ascii keycodes as octal
numbers. Hence, an 'O' must not be preceeded by <c-v>. However, <c-v> is
necessary, if a:char is <c-\>.
Fix#59
commands to do the following:
1. change the EOL style of all vim files to be just LF.
2. changed the mime-type of all files to text/plain
3. removed the executable flag on all files.
This should hopefully make the repo look better on all platforms etc.
:iab zzz whatever
then typing 'z<space>' triggers the abbreviation in the presence of
latex-suite. (Cristian Rigamonti)
Why: The reg-exp used to find out if a iab existed was faulty.
Fix: Fix the regexp to use an exact match of the previous word.
>>> \begin{array}
>>> \end{}
results in
>>> \begin{array}
>>> \end{<++>}
with the cursor at the end (Berta Milan)
Why: When the indentation of a line changes while typing the text returned
by IMAP_PutTextWithMovement, then IMAP_Mark('go') does not go to the
same location as set by IMAP_Mark('set'). This causes the cursor to be
located not before the first placeholder causing the first
placeholder to be "missed".
Fix: Check to see if the indentation of the line remembered by
IMAP_Mark('set') has changed and if so, move a little to the left or
right to adjust for the indentation changing.
Why: With 'ignorecase' set, 'etB' matches 'ETB', therefore, LookupCharacter
assumes that a map exists for 'etB' and tries to find the value of
s:Map_Tex_etB which doesn't exist.
Fix: Force matching case with the \C pattern.
IMAP_Jumpfunc().
Why: s:RemoveLastHistoryItem sets @/ to the last search item in the @/
history, but @/ is not necessarily always the last item in the @/
history.
Fix: Remember @/ in Tex_LastSearchPattern and then restore it.
abbreviations starting with the letter 'a', then typing 'a<space>'
would trigger an expansion.
Cause: The :iab command also echoes for partial completions.
Solution: Check more thoroughly whether a word is an abbreviation LHS or
not.
(Preben Randhol, Sanip P Deshmukh)
Cause: If a mapping ends in a letter (say '\'), then abbreviations are not
triggered by that letter. For example, if we have
imap \ <C-r>='\'<CR>
iab 12 twelve
Then typing 12\ doesn't expand to twelve\.
(Strangely enough "imap \ ?" doesn't have this problem and we get
twelve?. Vim bug?)
This problem is aggravated by the fact that latex-suite "protects"
most letters to avoid expansions such as ``2 -> `\sqrt{}
Solution: After checking for mappings ending in a letter, if that letter is
not in 'iskeyword', then also check whether the previous word has
an abbreviation. Since vim does not have the equivalent of
mapcheck() for abbreviations, this is complicated (maybe even hacky).
:behave mswin
is set, which in turn sets &selection=inclusive. This makes
IMAP_Jumpfunc() skip selecting the last character of
Imap_PlaceHolderEnd. (Sumit Bhardwaj)
Solution: Temporarily set &selection = exclusive in IMAP_Jumpfunc().
- IMAP_Jumpfunc() is now able to handle <+placeholders
withlinebreaks+>
- Bug: If we were selecting in the backward direction, and we want to move
backwards, then 2 <Plug>IMAP_JumpBack's are needed. i.e, if we have
<+1+> <+2+> <+3+>
and we do (with <C-k> mapped to <Plug>IMAP_JumpBack)
<C-j><C-j><C-k>, from before <+1+>, then we remain in <+2+>.
(Bug pointed out by LH)
Cause: In visual mode, <Plug>IMAP_JumpBack deselects the text but remains
at the end of the selection. (this is default vim behavior).
Therefore searching back for the placeholder start character lands
us up in the template.
Solution: In visual mode, make <Plug>IMAP_JumpBack goto `< after
deselecting text. This strategy also leads to considerable
simplification at other places.
to position the cursor instead of adding a marker string and searching for it.
The marker would cause serious trouble if it occurred anywhere in the inserted
text, and minor trouble if it was too long and caused an unwanted line break.
* Fix a bug (mea culpa) in s:LookupCharacter() and IMAP_list(). If there was
a global map for "foo" and a local (filetype) map for "bozo" then these
functions would look at the last character, "o", see that there were local
maps ending in "o", and only look for local maps.
* Do not make a call to iconv() when it is not needed. This is important when
vim is compiled with -iconv.
* Wrap the call to iconv, and the test for whether it is needed, in a new,
heavily commented, helper function, s:Iconv().
the marker string being too long triggers a line break.
Therefore, just for the time being check to see if phs != phe, and if
so, then use phs.phs as the marker (improbable string).
We would like ultimately to completeley get over this hack and use
movement instead.
2. Problem: The <C-K> map for jumping back was interfering with the
dictionary completion mode of vim. Therefore change default mapping for
jumping back to <S-C-J> instead of <C-K>. Ofcourse this makes it
invisible to non-gui users (I think).
3. Tried to do the "right" thing for mapping. First provide a number of
mappings using <plug>. These mappings call IMAP_Jumpfunc() in various
ways. Various <plug> mappings for various modes have been provided.
After this, we map the default keys to the <plug> mappings checking for
hasmapto() each time. This provides for a robust and easy user
customization. Initially, the user had to do something like:
inoremap <C-J> <C-r>=IMAP_Jumpfunc('', 0)<CR>
in his .vimrc to be able to override our mapping. Now he will do
inoremap <C-J> <Plug>IMAP_JumpForward
Doing this also has the advantage that changes in IMAP_Jumpfunc() will
not affect the user customization.
NOTE: This <plug> things were inspired by looking at the excellent
cvscommand.vim plugin I've begun using...
Cause: The "marker" or the "very improbable string" which is used by
IMAP_PutTextWithMovement() to mark the beginning of the left-hand side
contains spaces! This causes expansions near the end of a line to
trigger line breaks (if 'fo' contains t, which is default and tw != 0),
so that the marker text is broken across lines... Havoc ensues.
Solution: remove spaces from marker text.
edited.
Cause: In a recent chage, when IMAP(lhs, rhs, ft) is called with a
a:ft != '', then it sets the mapping to be buffer local. This
breaks latex-suite which calls the IMAP() functions only once when
it is first started, not for every buffer. Changing things so that
the mappings are called with every filetype event will be
1. quite time consuming
2. kind of inefficient in that a _lot_ of lines will need to be
resourced with every filetype event.
So until a better solution presents itself, make all maps created by
IMAP() global (not buffer-local).
IMAP_GetPlaceHolderStart/End() functions. They need to be visible to
templates.vim.
. changed fun! and endfun to function! and endfunction
(another one of those consistent coding thingies)
need to robustify imaps.vim was felt. Before, it had a big dependence on
"funky" characters. Since imaps.vim affected a lot of files, this commit
has a lot of modified files.
Briefly, it changes the <<, >> and the <a-umlaut> characters throughout
latex-suite to 'unfunky' characters.
<< --- <+
>> --- +>
<a-umlaut> --- <++>
The syntax of IMAP and IMAP_PutTextWithMovement was also changed to accept
2 new optional arguments which specify the placeholder characters in the
a:rhs. This allows scriptwriters to generate long term maps which will not
depend on the internals of imaps.vim
The b-newimaps tip at the time of this merge has been tagged as
b-newimaps-merge-sa-1
flickers. Therefore only change encoding if the original encoding is not
latin1. This will at least cause it to be smoother on machines using latin1
encoding.
The problem ofcourse will still be there for other locales. Therefore, look
for a more long term solution which does not require the encoding to be
changed back and forth with each imap execution.
If only someone had told me at the beginning not to use ascii > 127
characters!! I think in the next major rev, we will have to undertake a
major overhaul of all the macros to not use any of the higher ascii
characters. Maybe modify IMAP() to allow for multiple character placeholder
characters... (maybe '{+' and '+}' like in cream).
This will instantly remove all the internationalization and localization
problems.
function SAImaps_RemoveLastHistoryItem(). Also, clean up some comment
lines from a previous change to this file.
NOTE: This is a changed log message using the cvs admin command.
.
Bug: When 'encoding' is set to utf8, then macros dont work. i.e, typing
() results in (�)�� with the cursor placed at the end.
Cause: The behavior of vim changes according to the current encoding.
Solution:
1. When latex-suite is first called, temporarily set encoding to
latin1, source all the files and then reset it to the original
value. This ensures that the scripts rely on a consistent encoding
scheme.
2. Whenever we do encoding specific stuff, then switch back to latin1,
do our stuff and then switch back.
This is complicated by the fact that while inserting text (using the
Imap_PutText...() function), we need to insert the placeholders in the
curret locale, not latin1, otherwise the user will see things like <ab>
and <bb> instead of � and �. Therefore, the jump function needs to
account for the fact that the characters are no longer in latin1...
TODO: Document these changes asap otherwise I will completeley forget why I
did what I did...
history. I commented out a line, and added a comment, in case this
depends on version and patch number of vim; I think this should work
with vim any vim 6.0+. Please test. If this change is correct, it
should be possible to simplify the code a bit.