├── .gitignore ├── README.md ├── autoload └── blockit.vim ├── doc └── blockit.txt └── plugin └── blockit.vim /.gitignore: -------------------------------------------------------------------------------- 1 | *.swp 2 | *.swo 3 | *.*~ 4 | *.bak 5 | tags 6 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | **blockit** readme 2 | 3 | !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 4 | .. <><><><><><><><><><><><><><><><><><><><><><><><><><><> .. 5 | .. ^ -------------------------------------------------- ^ .. 6 | .. ^ | ____ __ __ ____ __ | ^ .. 7 | .. ^ | / __ ) / /____ _____ / /__ / _// /_ | ^ .. 8 | .. ^ | / __ |/ // __ \ / ___// //_/ / / / __/ | ^ .. 9 | .. ^ | / /_/ // // /_/ // /__ / ,< _/ / / /_ | ^ .. 10 | .. ^ | /_____//_/ \____/ \___//_/|_| /___/ \__/ | ^ .. 11 | .. ^ | - wrap text in block | ^ .. 12 | .. ^ -------------------------------------------------- ^ .. 13 | .. <><><><><><><><><><><><><><><><><><><><><><><><><><><> .. 14 | !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 15 | 16 | (http://www.vim.org/scripts/script.php?script_id=4848) 17 | 18 | ## Introduction 19 | 20 | When we are coding or editing text in vim, sometimes we want to wrap some lines of text (or in visual selections) in a 21 | block, which built by ASCII chars. **blockit** is the vim plugin, to make this work easily to be done. One can "draw" 22 | block in different style. Please read next section for detailed features. 23 | 24 | 25 | ## Features 26 | 27 | - horizontal/vertical char of the block border could be defined separately 28 | - margin between text and block border can be customized 29 | - block width can be dynamic (auto fit text width) or fixed 30 | - supports 4 in-block text alignment (No align., left-align., right align. center align.) 31 | - supports line-wise and block-wise visual selection text blocking (via key-mapping) 32 | - provide command to block line range 33 | 34 | 35 | ## Configuration 36 | 37 | There are 5 variables could be customized to configure block style: (more detailed information please check the plugin 38 | doc.) 39 | 40 | variable |values |default 41 | --- |--- |--- 42 | `g:blockit_H_char` |`string:` horizontal border char(s) |`'-'` 43 | `g:blockit_V_char` |`string:` vertical border char(s) |'|' 44 | `g:blockit_margin` |`int:` margin between text and border |`1` 45 | `*g:blockit_fixed_length`|`int:` if you want the block has fixed width, value >=5|`0` 46 | `g:blockit_align` |`string:` one of `'c','l','r','n'` |`'n'` (no alignment) 47 | 48 | **`*`** for the fixed length, please read the plugin docs for details. 49 | 50 | 51 | ## Usage 52 | 53 | It is easy to use the **blockit** plugin. There are two commands and one mapping ready to use. 54 | 55 | 56 | ### command 57 | 58 | - `[range]:Block`: This command will block the line range, with the settings in "Configuration" section. 59 | - `:BlockitVersion` will print the current version info of installed **blockit** 60 | 61 | 62 | ### Mapping 63 | 64 | Mapping is **only** available in `line-wise` or `block-wise` visual selection mode. 65 | 66 | Default: 67 | 68 | bi 69 | 70 | This mapping will block the visual selected text. 71 | 72 | You can customize the mapping in this way: 73 | 74 | vmap (Your_Mapping) BlockitVisual 75 | 76 | ## Demo 77 | 78 | 79 | ### Demo1 80 | 81 | - dynamic block width 82 | - H-border `'@'` (`g:blockit_H_char='@'`) 83 | - V-border `'*'` (`g:blockit_V_char='*'`) 84 | - blockit via command 85 | - text alignment: `center` (`g:blockit_align='c'`) 86 | 87 | ![demo1](https://raw.github.com/sk1418/sharedResources/master/blockit/demo1.gif) 88 | 89 | 90 | ### Demo2 91 | 92 | Use all default configurations: 93 | 94 | - dynamic block width 95 | - H-char in border: `'-'` (default) 96 | - V-char in border: `'|'` (default) 97 | - blockit via visual selection (`bi`) 98 | - text alignment: no alignment (default) 99 | 100 | ![demo2](https://raw.github.com/sk1418/sharedResources/master/blockit/demo2.gif) 101 | 102 | ### Demo3 103 | 104 | - fixed block width: `40` (`g:blockit_fixed_length=40`) 105 | - H-char in border: `'.-'` (`g:blockit_H_char='.-'`) 106 | - V-char in border: `'..'` (`g:blockit_V_char='..'`) 107 | - blockit via visual selection (`bi`) 108 | - text alignment: `right` (`g:blockit_align='r'`) 109 | 110 | ![demo3](https://raw.github.com/sk1418/sharedResources/master/blockit/demo3.gif) 111 | 112 | -------------------------------------------------------------------------------- /autoload/blockit.vim: -------------------------------------------------------------------------------- 1 | " blockit : wrap lines in a block 2 | " Author : Kai Yuan 3 | " License: {{{ 4 | "Copyright (c) 2014-2016 Kai Yuan 5 | "Permission is hereby granted, free of charge, to any person obtaining a copy of 6 | "this software and associated documentation files (the "Software"), to deal in 7 | "the Software without restriction, including without limitation the rights to 8 | "use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of 9 | "the Software, and to permit persons to whom the Software is furnished to do so, 10 | "subject to the following conditions: 11 | " 12 | "The above copyright notice and this permission notice shall be included in all 13 | "copies or substantial portions of the Software. 14 | " 15 | "THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | "IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 17 | "FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 18 | "COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 19 | "IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 20 | "CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 21 | " }}} 22 | 23 | if exists("g:autoloaded_blockit") 24 | finish 25 | endif 26 | let g:autoloaded_blockit = 1 27 | 28 | 29 | "////////////////////////////////////////////////////////////////////// 30 | " Variables / 31 | "////////////////////////////////////////////////////////////////////// 32 | "{{{ 33 | let g:blockit_H_char = exists('g:blockit_H_char')? g:blockit_H_char : '-' 34 | let g:blockit_V_char = exists('g:blockit_V_char')? g:blockit_V_char : '|' 35 | let g:blockit_margin = exists('g:blockit_margin')? g:blockit_margin : 1 36 | let g:blockit_fixed_length = exists('g:blockit_fixed_length')? g:blockit_fixed_length : 0 37 | let g:blockit_align = exists('g:blockit_align')? g:blockit_align : 'n' 38 | 39 | "min value of fixed length 40 | let s:fixed_min = 4 41 | 42 | "}}} 43 | 44 | "////////////////////////////////////////////////////////////////////// 45 | " Helper functions 46 | "////////////////////////////////////////////////////////////////////// 47 | "{{{ 48 | 49 | "================================= 50 | " calculate the header/bottom border 51 | " length, and return the built line 52 | " the "block" should look pretty 53 | "================================= 54 | function! blockit#calc_header(maxlen) 55 | let n = a:maxlen+(g:blockit_margin+strdisplaywidth(g:blockit_V_char))*2 56 | let line = repeat(g:blockit_H_char, n) 57 | return strpart(line, 0, n) 58 | endfunction 59 | 60 | 61 | "================================= 62 | "get the max length of the line in 63 | "given list. 64 | "================================= 65 | function! blockit#max_len(lines) 66 | let maxl = 0 67 | "calculate the maxl 68 | for l in a:lines 69 | let maxl = strdisplaywidth(l)>maxl? strdisplaywidth(l):maxl 70 | endfor 71 | return maxl 72 | endfunction 73 | 74 | 75 | function! blockit#no_align(line, maxlen) 76 | return a:line . repeat(' ', a:maxlen - strdisplaywidth(a:line)) 77 | endfunction 78 | 79 | 80 | "================================= 81 | "do left align and extend the text 82 | "with spaces 83 | "return the processed line 84 | "================================= 85 | function! blockit#align_left(line, maxlen) 86 | let result = substitute(a:line, '^\s*', '', 'g') 87 | let diff = a:maxlen - strdisplaywidth(result) 88 | if diff > 0 89 | let result = result . repeat(' ', diff) 90 | endif 91 | return result 92 | endfunction 93 | 94 | 95 | "================================= 96 | "do right align and extend the text 97 | "with spaces 98 | " 99 | "return the processed line 100 | "================================= 101 | function! blockit#align_right(line, maxlen) 102 | let result = substitute(a:line, '\s*$', '', 'g') 103 | let diff = a:maxlen - strdisplaywidth(result) 104 | if diff > 0 105 | let result = repeat(' ', diff). result 106 | endif 107 | return result 108 | endfunction 109 | 110 | "================================= 111 | "do central align and extend the text 112 | "with spaces 113 | " 114 | "return the processed line 115 | "================================= 116 | function! blockit#align_center(line, maxlen) 117 | let result = substitute(a:line, '\s*$', '', 'g') 118 | let result = substitute(result, '^\s*', '', 'g') 119 | let diff = a:maxlen - strdisplaywidth(result) 120 | let diff_l = diff/2 121 | let diff_r = diff - diff_l 122 | 123 | return repeat(' ', diff_l). result . repeat(' ', diff_r) 124 | endfunction 125 | 126 | "============================ 127 | " get visual selected text 128 | "============================ 129 | function! blockit#get_visual_text() 130 | try 131 | let v_save = @v 132 | normal! gv"vy 133 | return @v 134 | finally 135 | let @v = v_save 136 | endtry 137 | endfunction 138 | 139 | "============================ 140 | " build HowMuch error message 141 | "============================ 142 | function! blockit#err(msg) 143 | echohl ErrorMsg 144 | echon "[blockit Err]" . a:msg 145 | echohl None 146 | endfunction 147 | "}}} 148 | 149 | 150 | 151 | "////////////////////////////////////////////////////////////////////// 152 | " Main Logic functions / 153 | "////////////////////////////////////////////////////////////////////// 154 | 155 | "============================ 156 | " validate the fixed_length if it is set 157 | "============================ 158 | function! blockit#validate(lines) 159 | let maxl = blockit#max_len(a:lines) 160 | if g:blockit_fixed_length>s:fixed_min 161 | if g:blockit_fixed_length <= (g:blockit_margin + g:blockit_V_char)*2 162 | call blockit#err('Fixed length is too short') 163 | return -1 164 | "error & exit if fixed_length was set (>5) but less than maxl+margin+V(chars) 165 | elseif g:blockit_fixed_length < ((g:blockit_margin + strdisplaywidth(g:blockit_V_char))*2 + maxl) 166 | call blockit#err('The fixed_length was defined, does not fit the longest line') 167 | return -1 168 | endif 169 | endif 170 | 171 | return 1 172 | endfunction 173 | 174 | "============================ 175 | "the block main logic 176 | "parameters: 177 | " 178 | "lines : a list, contains all text needs to be blocked, 179 | "the text in line is already be extened with spaces to 180 | "fit the maxlen (len of the longest line) 181 | " 182 | "return a list, with block characters 183 | "============================ 184 | function! blockit#block(lines) 185 | let my_lines = a:lines 186 | let maxl = 0 187 | if g:blockit_fixed_length > s:fixed_min 188 | let maxl = g:blockit_fixed_length - 2* (g:blockit_margin + strdisplaywidth(g:blockit_V_char)) 189 | else 190 | " get maxlen 191 | let maxl = blockit#max_len(my_lines) 192 | endif 193 | 194 | "the header/bottom line 195 | let h = blockit#calc_header(maxl) 196 | 197 | " block and align each line using map() 198 | call map(my_lines, 'blockit#block_single_line(v:val, maxl)') 199 | 200 | let result = [h] 201 | call extend(result, my_lines) 202 | call add(result,h) 203 | return result 204 | endfunction 205 | 206 | 207 | "============================ 208 | " block the given line 209 | " align logic will be applied too 210 | " 211 | " return the aligned and blocked line 212 | "============================ 213 | function! blockit#block_single_line(line, maxlen) 214 | let result = a:line 215 | 216 | "align 217 | if g:blockit_align == 'l' 218 | let result = blockit#align_left(result, a:maxlen) 219 | elseif g:blockit_align == 'r' 220 | let result = blockit#align_right(result, a:maxlen) 221 | elseif g:blockit_align == 'c' 222 | let result = blockit#align_center(result, a:maxlen) 223 | else " no align 224 | let result = blockit#no_align(result, a:maxlen) 225 | endif 226 | "block the line 227 | let result = g:blockit_V_char . repeat(' ', g:blockit_margin). result 228 | let result = result . repeat(' ', g:blockit_margin) . g:blockit_V_char 229 | 230 | return result 231 | endfunction 232 | "============================ 233 | " block the text from command 234 | "============================ 235 | function! blockit#block_cmd() range 236 | let lines = getline(a:firstline,a:lastline) 237 | "validation 238 | if blockit#validate(lines) < 0 239 | return 240 | endif 241 | execute a:firstline.','.a:lastline . ' d _' 242 | let real_first = a:firstline-1<0?0:a:firstline-1 243 | let result = blockit#block(lines) 244 | call append(real_first, result) 245 | endfunction 246 | 247 | 248 | "============================ 249 | " handle visual selection, in fact 250 | " only block-wise select needs special 251 | " handling 252 | " 253 | " the invokation of this function should 254 | " be come from mapping, instread of command 255 | "============================ 256 | function! blockit#block_visual() 257 | if visualmode() ==# 'v' 258 | call blockit#err("char-wise selection is not supported") 259 | return 260 | endif 261 | 262 | let txt = blockit#get_visual_text() 263 | let lines = split(txt, '\n') 264 | "validation 265 | if blockit#validate(lines) < 0 266 | return 267 | endif 268 | 269 | "line range 270 | let first = line("'<") 271 | let last = line("'>") 272 | 273 | let result_txt = join(blockit#block(lines), "\n") 274 | "replace the original selection with blocked text 275 | let ve_save = &virtualedit 276 | let v_save = @v 277 | let &virtualedit = 'all' 278 | let pos = getpos("'<") 279 | let end_pos = getpos("'>") 280 | 281 | call setreg('v', result_txt,visualmode()) 282 | "remove the visual selected text 283 | normal! gvx 284 | 285 | if visualmode() !=# 'V' 286 | "C-V visual:add empty line before and after the visual area 287 | execute pos[1] . 'pu! _' 288 | execute end_pos[1]+1 . 'pu _' 289 | endif 290 | 291 | call setpos('.',pos) 292 | normal! "vP 293 | 294 | "restore the @v reg 295 | let @v = v_save 296 | let &virtualedit = ve_save 297 | 298 | endfunction 299 | 300 | " vim: fdm=marker ts=2 sw=2 tw=78 expandtab 301 | -------------------------------------------------------------------------------- /doc/blockit.txt: -------------------------------------------------------------------------------- 1 | *blockit.txt* A vim plugin to wrap text in block 2 | *blockit* *BlockIt* 3 | 4 | ============================================================================== 5 | > 6 | !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 7 | .. <><><><><><><><><><><><><><><><><><><><><><><><><><><> .. 8 | .. ^ -------------------------------------------------- ^ .. 9 | .. ^ | ____ __ __ ____ __ | ^ .. 10 | .. ^ | / __ ) / /____ _____ / /__ / _// /_ | ^ .. 11 | .. ^ | / __ |/ // __ \ / ___// //_/ / / / __/ | ^ .. 12 | .. ^ | / /_/ // // /_/ // /__ / ,< _/ / / /_ | ^ .. 13 | .. ^ | /_____//_/ \____/ \___//_/|_| /___/ \__/ | ^ .. 14 | .. ^ | - wrap text in block | ^ .. 15 | .. ^ -------------------------------------------------- ^ .. 16 | .. <><><><><><><><><><><><><><><><><><><><><><><><><><><> .. 17 | !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 18 | < 19 | ============================================================================== 20 | 21 | Author: Kai Yuan (kent.yuan at gmail dot com) 22 | 23 | The blockit plugin was written and tested under Vim 7.4 24 | 25 | ============================================================================== 26 | CONTENTS *blockit-contents* 27 | 28 | 1. Introduction ...................................... |blockit-intro| 29 | 2. Features .......................................... |blockit-features| 30 | 3. Configuration ..................................... |blockit-config| 31 | 3.1 Options ........................................ |blockit-options| 32 | 4. Usage ............................................. |blockit-usage| 33 | 4.1 Command ........................................ |blockit-command| 34 | 4.2 mapping ........................................ |blockit-mapping| 35 | 5. Examples .......................................... |blockit-examples| 36 | 6. Change Log ........................................ |blockit-changelog| 37 | 38 | ============================================================================== 39 | INTRODUCTION *blockit-intro* 40 | 41 | When we are coding or editing text in vim, sometimes we want to wrap some 42 | lines of text (or in visual selections) in a block, which built by ASCII 43 | chars. blockit is the vim plugin, to make this work easily to be done. One can 44 | "draw" block in different style. 45 | 46 | For more detailed information please check next section: |blockit-features|. 47 | 48 | ============================================================================== 49 | FEATURES *blockit-features* 50 | 51 | - horizontal/vertical char of the block border could be defined separately 52 | - margin between text and block border can be customized 53 | - block width can be dynamic (auto fit text width) or fixed 54 | - supports 4 in-block text alignment (No align., left-align., right align. 55 | center align.) 56 | - supports line-wise and block-wise visual selection text blocking (via 57 | key-mapping) 58 | - provide command to block line range 59 | 60 | =============================================================================== 61 | CONFIGURATION *blockit-config* 62 | 63 | blockit has pre-defined configuration as default. User could just install and 64 | use without customization. However, if you want to have different border 65 | style, or text alignment etc, please read this section. blockit could be 66 | configured by setting global variables. You can set the required options in 67 | specific buffer or in ~/.vimrc file. 68 | 69 | ------------------------------------------------------------------------------- 70 | OPTIONS *blockit-options* 71 | 72 | |g:loaded_blockit| ................... disable blockit plugin 73 | |g:blockit_H_char| ................... set the char in horizontal border 74 | |g:blockit_V_char| ................... set the char in vertical border 75 | |g:blockit_margin| ................... margin between text and border 76 | |g:blockit_align| .................... alignment of in-block text 77 | |g:blockit_fixed_length| ............. fixed the border width 78 | 79 | ------------------------------------------------------------------------------- 80 | Detailed descriptions~ 81 | 82 | *g:loaded_blockit* 83 | Use this option to disable blockit plugin: 84 | > 85 | let g:loaded_blockit = 1 86 | < 87 | *g:blockit_H_char* 88 | Type: string 89 | Default value: '-' 90 | Set the char(s) to build the horizontal border. 91 | 92 | NOTE: If more than one char was set, it would be automatically adjusted by the 93 | block width. E.g. set the value with '12345', but the width of block was 7, 94 | then the border would look like '1234512'. 95 | > 96 | let g:blockit_H_char = '-' 97 | < 98 | 99 | *g:blockit_V_char* 100 | Type: string 101 | Default value: '|' 102 | Set the char(s) to build the vertical border. The value could be longer than 103 | 1. 104 | 105 | > 106 | let g:blockit_V_char = '|' 107 | < 108 | 109 | *g:blockit_margin* 110 | Type: int 111 | Default value: 1 112 | Set the margin (number of spaces) between text and block borders. 113 | > 114 | let g:blockit_margin = 1 115 | < 116 | 117 | *g:blockit_align* 118 | Type string 119 | Default value: 'n' 120 | Handle the alignment of the text in block. There are 4 possible values: 121 | 122 | 'n' : no alignment 123 | 'c' : center alignment 124 | 'l' : left alignment 125 | 'r' : right alignment 126 | 127 | NOTE: If one of 'c', 'l' or 'r' was set, the leading and trailing spaces of 128 | original text could be re-arranged in block to do the alignment. 129 | > 130 | let g:blockit_align = 'n' 131 | < 132 | 133 | *g:blockit_fixed_length* 134 | Type int 135 | Default value: 0 136 | Normally blockit will calculate the width of block based on the longest 137 | selected line dynamically. However if this option was set, blockit will use 138 | the given value as the width of block. 139 | 140 | NOTE: 141 | - if given value < 5, it would be ignored. Because the default 142 | 2 x default_margin + 2 x default V_char + 1 = 4. 143 | - if value < (2 x margin + 2 x V_char + length of longest selected line), the 144 | blockit operation will be stopped, error message will be displayed. 145 | 146 | > 147 | let g:blockit_fixed_length = 0 148 | < 149 | 150 | ============================================================================== 151 | USAGE *blockit-usage* 152 | 153 | There are two ways to use blockit plugin. Using command or via visual 154 | selection. 155 | 156 | 157 | 158 | ------------------------------------------------------------------------------- 159 | Commands~ 160 | *blockit-command* 161 | 162 | blockit has two commands: 163 | 164 | *:BlockitVersion* 165 | print the current installed blockit version. 166 | 167 | *:Block* 168 | :[range]Block 169 | 170 | The :Block command will wrap [range] lines in block. 171 | 172 | ------------------------------------------------------------------------------- 173 | Mappings~ 174 | *blockit-mapping* 175 | 176 | blockit supports wrap visual selected text in a block by pressing visual mode 177 | mapping keys. Only block-wise(Ctrl-v) and line-wise(V) selection are 178 | supported. The default mapping is: 179 | 180 | > 181 | bi 182 | < 183 | 184 | The mapping could be customized by: 185 | > 186 | vmap (Your_Mapping) BlockitVisual 187 | < 188 | 189 | ============================================================================== 190 | EXAMPLES *blockit-examples* 191 | 192 | examples and demos please check the project homepage: 193 | https://github.com/sk1418/blockit 194 | 195 | ============================================================================== 196 | CHANGELOG *blockit-changelog* 197 | 198 | 2014-01-23 Version 1.0.0~ 199 | - first release 200 | 201 | 202 | vim:tw=78:ts=2:sw=2:sts=2:ft=help:norl 203 | -------------------------------------------------------------------------------- /plugin/blockit.vim: -------------------------------------------------------------------------------- 1 | " blockit : wrap lines in a block 2 | " Author : Kai Yuan 3 | " License: {{{ 4 | "Copyright (c) 2014-2016 Kai Yuan 5 | "Permission is hereby granted, free of charge, to any person obtaining a copy of 6 | "this software and associated documentation files (the "Software"), to deal in 7 | "the Software without restriction, including without limitation the rights to 8 | "use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of 9 | "the Software, and to permit persons to whom the Software is furnished to do so, 10 | "subject to the following conditions: 11 | " 12 | "The above copyright notice and this permission notice shall be included in all 13 | "copies or substantial portions of the Software. 14 | " 15 | "THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | "IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 17 | "FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 18 | "COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 19 | "IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 20 | "CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 21 | " }}} 22 | 23 | if exists("g:loaded_blockit") 24 | finish 25 | endif 26 | 27 | let g:loaded_blockit = 1 28 | 29 | let s:version = '1.0.0' 30 | command! BlockitVersion echo "[blockit] Version: " . s:version 31 | 32 | " mappings for visual selection 33 | "{{{ 34 | 35 | vnoremap BlockitVisual :call blockit#block_visual() 36 | 37 | if !hasmapto('BlockitVisual', 'v') 38 | vmap bi BlockitVisual 39 | endif 40 | "}}} 41 | " 42 | " blockit command 43 | command! -range Block ,call blockit#block_cmd() 44 | 45 | 46 | " vim: fdm=marker ts=2 sw=2 tw=78 expandtab foldlevel=0 47 | --------------------------------------------------------------------------------