diff options
author | VG <vg@devys.org> | 2015-07-24 17:38:46 +0200 |
---|---|---|
committer | VG <vg@devys.org> | 2015-07-24 17:38:46 +0200 |
commit | bb4fe07722676c04d0bd29b8265327da29d9997c (patch) | |
tree | c07e998fd931974f4261383d9d462019db6a8d33 | |
parent | 531ad8f2baa5fefdf2f92c6473d5098f4bbeb1b5 (diff) | |
download | vim-rst-tables-master.tar.gz vim-rst-tables-master.tar.bz2 vim-rst-tables-master.zip |
-rw-r--r-- | ftplugin/rst_tables.vim | 19 |
1 files changed, 8 insertions, 11 deletions
diff --git a/ftplugin/rst_tables.vim b/ftplugin/rst_tables.vim index 6c994ce..be45597 100644 --- a/ftplugin/rst_tables.vim +++ b/ftplugin/rst_tables.vim @@ -22,7 +22,6 @@ import re import textwrap import unicodedata import codecs -from vim_bridge import bridged def get_table_bounds(): @@ -285,39 +284,37 @@ def draw_table(indent, table, manual_widths=None): return output -@bridged def reformat_table(): upper, lower, indent = get_table_bounds() encoding = vim.eval("&encoding") slice = map(lambda x: codecs.decode(x, encoding), \ - vim.current.buffer[upper - 1:lower]) + vim.current.buffer[upper - 1:lower]) table = parse_table(slice) slice = draw_table(indent, table) vim.current.buffer[upper - 1:lower] = map(lambda x: \ - codecs.encode(x, encoding), slice) + codecs.encode(x, encoding), slice) -@bridged def reflow_table(): upper, lower, indent = get_table_bounds() encoding = vim.eval("&encoding") slice = map(lambda x: codecs.decode(x, encoding), \ - vim.current.buffer[upper - 1:lower]) + vim.current.buffer[upper - 1:lower]) widths = get_column_widths_from_border_spec(slice) table = parse_table(slice) slice = draw_table(indent, table, widths) vim.current.buffer[upper - 1:lower] = map(lambda x: \ - codecs.encode(x, encoding), slice) + codecs.encode(x, encoding), slice) endpython " Add mappings, unless the user didn't want this. " The default mapping is registered, unless the user remapped it already. if !exists("no_plugin_maps") && !exists("no_rst_table_maps") - if !hasmapto('ReformatTable(') - noremap <silent> <leader><leader>c :call ReformatTable()<CR> + if !hasmapto(' reformat_table(') + noremap <silent> <leader><leader>c :python reformat_table()<CR> endif - if !hasmapto('ReflowTable(') - noremap <silent> <leader><leader>f :call ReflowTable()<CR> + if !hasmapto(' reflow_table(') + noremap <silent> <leader><leader>f :python reflow_table()<CR> endif endif |