diff options
Diffstat (limited to 'ftplugin')
-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 |