Don't map things to keys that terminals might eat.
Thanks to Sven Hergenhahn for reporting this.
author |
Steve Losh <steve@stevelosh.com> |
date |
Wed, 31 Oct 2012 18:28:40 -0400 |
parents |
52cc06ab5af8
|
children |
ce37028052fe
|
branches/tags |
(none) |
files |
chapters/38.markdown |
Changes
--- a/chapters/38.markdown Tue Oct 16 19:55:18 2012 -0400
+++ b/chapters/38.markdown Wed Oct 31 18:28:40 2012 -0400
@@ -26,13 +26,13 @@
a separate file in `~/.vim/plugin/` if you prefer):
:::vim
- nnoremap <c-f> :call FoldColumnToggle()<cr>
+ nnoremap <leader>f :call FoldColumnToggle()<cr>
function! FoldColumnToggle()
echom &foldcolumn
endfunction
-Write and source the file, then try it out by pressing `<c-f>`. Vim will
+Write and source the file, then try it out by pressing `<leader>f` Vim will
display the current value of the `foldcolumn` option. Go ahead and read `:help
foldcolumn` if you're unfamiliar with this option.
@@ -40,7 +40,7 @@
this:
:::vim
- nnoremap <c-f> :call FoldColumnToggle()<cr>
+ nnoremap <leader>f :call FoldColumnToggle()<cr>
function! FoldColumnToggle()
if &foldcolumn
@@ -68,7 +68,7 @@
skeleton as before. Add the following code to your file:
:::vim
- nnoremap <c-q> :call QuickfixToggle()<cr>
+ nnoremap <leader>q :call QuickfixToggle()<cr>
function! QuickfixToggle()
return
@@ -79,7 +79,7 @@
look like this:
:::vim
- nnoremap <c-q> :call QuickfixToggle()<cr>
+ nnoremap <leader>q :call QuickfixToggle()<cr>
function! QuickfixToggle()
copen
@@ -92,7 +92,7 @@
solution: a global variable. Change the code to look like this:
:::vim
- nnoremap <c-q> :call QuickfixToggle()<cr>
+ nnoremap <leader>q :call QuickfixToggle()<cr>
function! QuickfixToggle()
if g:quickfix_is_open
@@ -112,7 +112,7 @@
the variable is not defined yet! Let's fix that by initializing it once:
:::vim
- nnoremap <c-q> :call QuickfixToggle()<cr>
+ nnoremap <leader>q :call QuickfixToggle()<cr>
let g:quickfix_is_open = 0
@@ -160,7 +160,7 @@
Vim plugins. Edit your code to look like this:
:::vim
- nnoremap <c-q> :call QuickfixToggle()<cr>
+ nnoremap <leader>q :call QuickfixToggle()<cr>
let g:quickfix_is_open = 0
@@ -202,7 +202,4 @@
Read `:help wincmd`.
-Read `:help ctrl-q` and `:help ctrl-f` to see what you overwrote with these
-mappings.
-
Namespace the functions by adding `s:` and `<SID>` where necessary.