Skip to content

Commit

Permalink
Correctly handle nomaps for e.g. <C-Left>
Browse files Browse the repository at this point in the history
E.g. make sure that the nomap variable for <C-Left>
is called `g:csv_nomap_c_left` (because `-` is invalid in variable
names.)

Fixes #165
  • Loading branch information
chrisbra committed May 7, 2020
1 parent 4ec2a32 commit 61144a3
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
1 change: 1 addition & 0 deletions autoload/csv.vim
Original file line number Diff line number Diff line change
Expand Up @@ -2345,6 +2345,7 @@ endfu

fu! csv#Map(map, name, definition, ...) "{{{3
let keyname = substitute(a:name, '[<>]', '', 'g')
let keyname = substitute(a:name, '-', '_', 'g')
let expr = (exists("a:1") && a:1 == 'expr' ? '<expr>' : '')
if !get(g:, "csv_nomap_". tolower(keyname), 0)
" All mappings are buffer local
Expand Down
4 changes: 3 additions & 1 deletion doc/ft-csv.txt
Original file line number Diff line number Diff line change
Expand Up @@ -614,9 +614,11 @@ is equival to a single backslash '\', e.g. \K would run the lookup function on
the word under the cursor and \J would join this line with the previous line.

If you want to prevent the mapping of keys, simply set the global variable
g:csv_nomap_<key> to 1, e.g. to prevent mapping of <CR> in csv files, put >
g:csv_nomap_<key> to 1, (remove the special characters `<>` and replace `-` by
`_`), e.g. to prevent mapping of <CR> and <C-Left> in csv files, put >
let g:csv_nomap_cr = 1
let g:csv_nomap_c_left = 1
<
into your |.vimrc|. Note, the keyname must be lower case.

Expand Down

0 comments on commit 61144a3

Please sign in to comment.