Language:
Vim/Vim script     Change language:
Pastebin: 132684
Author: Araxia
Subject: AutoTagCompletion
Created: 2010-02-08 23:00:48
Download and save
Toggle line numbers
1function! TagComplete() 
2    normal aa 
3    normal! r> 
4    let l:save_position = getpos(".") 
5    let [l:ignore, l:close_tag_pos] = searchpos("</\\zs\\S\\+", "bn", line(".")) 
6    let [l:ignore, l:open_tag_pos] = searchpos("<[^/]\\zs\\S\\+", "bW", line(".")) 
7    if l:open_tag_pos == 0 || l:open_tag_pos < l:close_tag_pos 
8        call setpos('.', l:save_position) 
9    else 
10        normal yiw 
11        call setpos('.', l:save_position) 
12        normal a</ 
13        normal
14        normal aa 
15        normal! r> 
16        call search("<", "bW", line(".")) 
17    endif 
18    if l:save_position[2] == len(getline(".")) 
19        startinsert
20    else 
21        startinsert 
22    endif 
23endfunction 
24imap > <Esc>:call TagComplete()<CR> 
Thread:
[132684] AutoTagCompletion by Araxia at 2010-02-08 23:00:48
  [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 (diff)
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.