Language:
Vim/Vim script     Change language:
Pastebin: 132688
Author: Araxia
Subject: Re: AutoTagCompletion
Created: 2010-02-09 00:03:01
Download and save
Toggle line numbers
1function! TagComplete() 
2    normal aa 
3    normal! r> 
4    let l:save_position = getpos(".") 
5    exe "normal i\<C-g>u" 
6    let [l:ignore, l:close_tag_pos] = searchpos("</\\zs\\S\\+", "bnW", line(".")) 
7    let [l:ignore, l:open_tag_pos] = searchpos("<[^/]\\zs[^[:space:]>]\\+", "bcW", line(".")) 
8    if l:open_tag_pos == 0 || l:open_tag_pos < l:close_tag_pos 
9        call setpos('.', l:save_position) 
10    else 
11        normal yiw 
12        call setpos('.', l:save_position) 
13        normal a</ 
14        normal
15        normal aa 
16        normal! r> 
17        call search("<", "bW", line(".")) 
18    endif 
19    if l:save_position[2] == len(getline(".")) 
20        startinsert
21    else 
22        startinsert 
23    endif 
24endfunction 
25imap > <Esc>:call TagComplete()<CR> 
Thread:
[132684] AutoTagCompletion by Araxia at 2010-02-08 23:00:48 (diff)
  [132685] Re: AutoTagCompletion by Araxia at 2010-02-08 23:32:58 (diff)
    [132686] Re: AutoTagCompletion by Araxia at 2010-02-08 23:35:43 (diff)
      [132688] Re: AutoTagCompletion by Araxia at 2010-02-09 00:03:01
Tip: Click the line numbers to toggle highliting on that line.

Paste followup:

Language:
Author:
Subject:


    Tabstop:     bigger biggest
Note: You can prefix a line with "@@@" to highlight it.