diff --git a/README.md b/README.md index 09d532b..082262b 100644 --- a/README.md +++ b/README.md @@ -939,9 +939,12 @@ In csv files, you can also use the :CSVTabularize command, in different filetypes you can use the :CSVTable command (and is available as plugin so it will be available for non-CSV filetypes). -Set the variable g:csv_table_leftalign=1 if you want the columns to be +Set the variable `g:csv_table_leftalign=1` if you want the columns to be leftaligned. +Set the variable `g:csv_table_use_ascii=1` if you do not want to use unicode +drawing characters. + Note: Each row must contain exactly as many fields as columns. This command is available as default plugin. To disable this feature, set the diff --git a/autoload/csv.vim b/autoload/csv.vim index a2e7e4d..6ea376f 100644 --- a/autoload/csv.vim +++ b/autoload/csv.vim @@ -2650,21 +2650,21 @@ fu! csv#Tabularize(bang, first, last) "{{{3 endif let _c = winsaveview() " Table delimiter definition "{{{4 - if !exists("s:td") - let s:td = { - \ 'hbar': (&enc =~# 'utf-8' ? '─' : '-'), - \ 'vbar': (&enc =~# 'utf-8' ? '│' : '|'), - \ 'scol': (&enc =~# 'utf-8' ? '├' : '|'), - \ 'ecol': (&enc =~# 'utf-8' ? '┤' : '|'), - \ 'ltop': (&enc =~# 'utf-8' ? '┌' : '+'), - \ 'rtop': (&enc =~# 'utf-8' ? '┐' : '+'), - \ 'lbot': (&enc =~# 'utf-8' ? '└' : '+'), - \ 'rbot': (&enc =~# 'utf-8' ? '┘' : '+'), - \ 'cros': (&enc =~# 'utf-8' ? '┼' : '+'), - \ 'dhor': (&enc =~# 'utf-8' ? '┬' : '-'), - \ 'uhor': (&enc =~# 'utf-8' ? '┴' : '-') + let use_unicode = &enc =~# 'utf-8' && get(g:, 'csv_table_use_ascii', 0) == 0 + let s:td = { + \ 'hbar': (use_unicode ? '─' : '-'), + \ 'vbar': (use_unicode ? '│' : '|'), + \ 'scol': (use_unicode ? '├' : '|'), + \ 'ecol': (use_unicode ? '┤' : '|'), + \ 'ltop': (use_unicode ? '┌' : '+'), + \ 'rtop': (use_unicode ? '┐' : '+'), + \ 'lbot': (use_unicode ? '└' : '+'), + \ 'rbot': (use_unicode ? '┘' : '+'), + \ 'cros': (use_unicode ? '┼' : '+'), + \ 'dhor': (use_unicode ? '┬' : '-'), + \ 'uhor': (use_unicode ? '┴' : '-') \ } - endif "}}}4 + "}}}4 if match(getline(a:first), '^'.s:td.ltop) > -1 " Already tabularized, done call csv#Warn("Looks already Tabularized, aborting!") diff --git a/doc/ft-csv.txt b/doc/ft-csv.txt index 2374fa5..6621208 100644 --- a/doc/ft-csv.txt +++ b/doc/ft-csv.txt @@ -911,9 +911,12 @@ In csv files, you can also use the :CSVTabularize command, in different filetypes you can use the :CSVTable command (and is available as plugin so it will be available for non-CSV filetypes). -Set the variable g:csv_table_leftalign=1 if you want the columns to be +Set the variable `g:csv_table_leftalign=1` if you want the columns to be leftaligned. +Set the variable `g:csv_table_use_ascii=1` if you do not want to use unicode +drawing characters. + Note: Each row must contain exactly as many fields as columns. This command is available as default plugin. To disable this feature, set the