summaryrefslogtreecommitdiff
path: root/vim/extline/plugin/extline.vim
blob: 4eea7930f4a072bd65a69f10088b620381eab1d9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
" Vim global plugin for extending lines (e.g., underlined titles).

if exists('g:loaded_extline')
    finish
endif
let g:loaded_extline = 1

" Save 'cpoptions' and set Vim default to enable line continuations.
let s:save_cpoptions = &cpoptions
set cpoptions&vim

xnoremap <silent> <C-L><C-L>  <ESC>:call extline#autoTitle()<CR>^
inoremap <silent> <C-L><C-L>  <C-G>u<C-O>:call extline#autoTitle()<CR>
xnoremap <silent> <C-L><C-H>  <ESC>:call extline#makeHline()<CR>^
inoremap <silent> <C-L><C-H>  <C-G>u<C-O>:call extline#makeHline()<CR>

xnoremap <silent> <C-L><C-U>  <ESC>:call extline#makeTitle("",  0, 1)<CR>^
xnoremap <silent> <C-L><C-O>  <ESC>:call extline#makeTitle("",  1, 0)<CR>^
xnoremap <silent> <C-L><C-I>  <ESC>:call extline#makeTitle("",  1, 1)<CR>^
xnoremap <silent> <C-L>1      <ESC>:call extline#makeTitle("=", 0, 1)<CR>^
xnoremap <silent> <C-L>=      <ESC>:call extline#makeTitle("=", 0, 1)<CR>^
xnoremap <silent> <C-L>2      <ESC>:call extline#makeTitle("-", 0, 1)<CR>^
xnoremap <silent> <C-L>-      <ESC>:call extline#makeTitle("-", 0, 1)<CR>^
xnoremap <silent> <C-L>3      <ESC>:call extline#makeTitle("^", 0, 1)<CR>^
xnoremap <silent> <C-L>^      <ESC>:call extline#makeTitle("^", 0, 1)<CR>^
xnoremap <silent> <C-L>4      <ESC>:call extline#makeTitle('"', 0, 1)<CR>^
xnoremap <silent> <C-L>"      <ESC>:call extline#makeTitle('"', 0, 1)<CR>^
xnoremap <silent> <C-L>5      <ESC>:call extline#makeTitle("'", 0, 1)<CR>^
xnoremap <silent> <C-L>'      <ESC>:call extline#makeTitle("'", 0, 1)<CR>^
xnoremap <silent> <C-L>9      <ESC>:call extline#makeTitle("#", 1, 1)<CR>^
xnoremap <silent> <C-L>#      <ESC>:call extline#makeTitle("#", 1, 1)<CR>^
xnoremap <silent> <C-L>0      <ESC>:call extline#makeTitle("*", 1, 1)<CR>^
xnoremap <silent> <C-L>*      <ESC>:call extline#makeTitle("*", 1, 1)<CR>^

" Undo-break via CTRL-G u.
inoremap <silent> <C-L><C-I>  <C-G>u<C-O>:call extline#makeTitle("",  1, 1)<CR>
inoremap <silent> <C-L><C-O>  <C-G>u<C-O>:call extline#makeTitle("",  1, 0)<CR>
inoremap <silent> <C-L><C-U>  <C-G>u<C-O>:call extline#makeTitle("",  0, 1)<CR>
inoremap <silent> <C-L>1      <C-G>u<C-O>:call extline#makeTitle("=", 0, 1)<CR>
inoremap <silent> <C-L>=      <C-G>u<C-O>:call extline#makeTitle("=", 0, 1)<CR>
inoremap <silent> <C-L>2      <C-G>u<C-O>:call extline#makeTitle("-", 0, 1)<CR>
inoremap <silent> <C-L>-      <C-G>u<C-O>:call extline#makeTitle("-", 0, 1)<CR>
inoremap <silent> <C-L>3      <C-G>u<C-O>:call extline#makeTitle("^", 0, 1)<CR>
inoremap <silent> <C-L>^      <C-G>u<C-O>:call extline#makeTitle("^", 0, 1)<CR>
inoremap <silent> <C-L>4      <C-G>u<C-O>:call extline#makeTitle('"', 0, 1)<CR>
inoremap <silent> <C-L>"      <C-G>u<C-O>:call extline#makeTitle('"', 0, 1)<CR>
inoremap <silent> <C-L>5      <C-G>u<C-O>:call extline#makeTitle("'", 0, 1)<CR>
inoremap <silent> <C-L>'      <C-G>u<C-O>:call extline#makeTitle("'", 0, 1)<CR>
inoremap <silent> <C-L>9      <C-G>u<C-O>:call extline#makeTitle("#", 1, 1)<CR>
inoremap <silent> <C-L>#      <C-G>u<C-O>:call extline#makeTitle("#", 1, 1)<CR>
inoremap <silent> <C-L>0      <C-G>u<C-O>:call extline#makeTitle("*", 1, 1)<CR>
inoremap <silent> <C-L>*      <C-G>u<C-O>:call extline#makeTitle("*", 1, 1)<CR>

" Restore saved 'cpoptions'.
let &cpoptions = s:save_cpoptions

finish

" ----------------------------------------------------------------------------


Types of single lines of text
-----------------------------

- Monoline:

  - Start of line
  - Optional leading whitespace
  - One or more identical non-alphanumeric non-white characters, c
  - Optional trailing whitespace
  - End of line

- Genline:
    prefix <longest run of characters> postfix

    postfix might contain optional column number

  - Start of line
  - Optional leading whitespace
  - Optional prefix with final character, L
  - One or more identical non-white characters, c, with c != L
  - Optional suffix with first character, R, with R != c
  - Optional white (ignored)
  - Optional integer column number
  --------------------------------

- Title:

  - Non-blank

Title types
-----------

- NoTitle:


- BareTitle::


    Title


- UnderTitle::


    Title
    =====


- OverTitle::


    =====
    Title


- OverUnderTitle::


    =====
    Title
    =====


HLine types
-----------

    =============================

    /****************************

    ****************************/

    /***************************/

    # ---------------------------
    # --------------------------- #



" vim: sts=4 sw=4 tw=80 et ai: