/usr/share/vim/cream/addons/cream-table.vim is in cream 0.43-3.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
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 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 | "
" Filename: cream-table.vim
" Updated: 2005-01-21 23:05:30-0400
"
" Cream -- An easy-to-use configuration of the famous Vim text editor
" [ http://cream.sourceforge.net ] Copyright (C) 2001-2011 Steve Hall
"
" License:
" This program is free software; you can redistribute it and/or modify
" it under the terms of the GNU General Public License as published by
" the Free Software Foundation; either version 3 of the License, or
" (at your option) any later version.
" [ http://www.gnu.org/licenses/gpl.html ]
"
" This program is distributed in the hope that it will be useful, but
" WITHOUT ANY WARRANTY; without even the implied warranty of
" MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
" General Public License for more details.
"
" You should have received a copy of the GNU General Public License
" along with this program; if not, write to the Free Software
" Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
" 02111-1307, USA.
"
" Limitations:
"
" As this script matures, we hope to eliminate these, but they exist
" for the time being:
" o No text may exist to the right or left of the table.
" o Assumes no wrapping.
" o Assumes expandtab
" register as a Cream add-on {{{1
if exists("$CREAM")
" don't list unless developer
if !exists("g:cream_dev")
finish
endif
call Cream_addon_register(
\ 'Table Edit',
\ "Edit tables with special behaviors.",
\ "Edit tables with special behaviors.",
\ 'Table Edit',
\ 'call Cream_table()',
\ '<Nil>'
\ )
endif
" * http://table.sf.net features
" - Cell size is dynamically adjusted as contents are typed in.
" - Cells can be split horizontally and vertically.
" - Cells can span into an adjacent cell.
" - Cells maintains own justification.
" - Can be translated into HTML source.
function! Cream_table()
endfunction
function! s:Cream_table_size()
endfunction
" Cream_table_getfirstline() {{{1
function! Cream_table_get_firstlinenr()
" return line number of table's first line
" start from current line and work up
let pos = line('.')
while match(getline(pos), '^\s*[|+]') != -1
let pos = pos - 1
endwhile
" return 0 if we don't find a table above cur pos
if pos >= line('.')
return 0
endif
return pos + 1
endfunction
" Cream_table_getlastline() {{{1
function! Cream_table_get_lastlinenr()
" return line number of table's first line
" start from current line and work up
let pos = line('.')
while match(getline(pos), '^\s*[|+]') != -1
let pos = pos + 1
endwhile
" return 0 if we don't find a table above cur pos
if pos <= line('.')
return 0
endif
return pos - 1
endfunction
function! s:Cream_table_getfirstcol()
endfunction
function! s:Cream_table_getlastcol()
endfunction
function! s:Cream_table_getcols()
" returns number of columns in the current line
endfunction
function! s:Cream_table_getlines()
" returns number of columns in the current line
endfunction
function! s:Cream_table_widen()
" add one char width to current column
endfunction
function! s:Cream_table_narrow()
" remove one char width of current column
endfunction
function! s:Cream_table_add_column()
" add column after current one
endfunction
function! s:Cream_table_add_line()
" insert line after current one
endfunction
function! s:Cream_table_pos()
" return col,line of current cell
endfunction
function! s:Cream_table_nextcell()
" go to next cell, including on next line if at end
endfunction
" Cream_table_insert() {{{1
function! Cream_table_insert()
" insert a new table, prompting for number of
let n = Inputdialog("Enter number of columns:", 4)
" cancel
if n == "{cancel}"
return
" empty or 0
elseif n == "" || n == "0"
" if empty
call confirm("0 not allowed, defaulting to 4", "&Ok", 1)
let n = 4
" non-digits
elseif n =~ '\D'
call confirm(
\ "Only number values accepted.\n" .
\ "\n", "&Ok", 1, "Info")
return
endif
let cells = "|"
let rules = "+"
let i = 0
while i < n
let rules = rules . "-----+"
let cells = cells . " |"
let i = i + 1
endwhile
let rules = rules . "\n"
let cells = cells . "\n"
let x = rules . cells . rules
let @x = x
put x
endfunction
" s:Cream_columns() {{{1
function! s:Cream_columns()
endfunction
" Cream_table_isin() {{{1
function! Cream_table_isin()
" Return 1 if in a table, 0 if not.
" if no pipes preceeding current position
if match(strpart(getline('.'), 0, col('.')), '[|+]') == -1
return 0
" if no pipes following current position
elseif match(strpart(getline('.'), col('.')), '[|+]') == -1
return 0
" if not in table
elseif Cream_table_getfirstline() == 0
return 0
else
return 1
endif
endfunction
finish
"#####################################################################
+-----+-----+-----+-----+
| | | | |
| | | | |
+-----+-----+-----+-----+
| | | | |
| | | | |
+-----+-----+-----+-----+
| | | | |
| | | | |
+-----+-----+-----+-----+
| | | | |
| | | | |
+-----+-----+-----+-----+
"#####################################################################
" 1}}}
" vim:foldmethod=marker
|