Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Add options to disable Tab/Alt indent/dedent mappings (issue #25)

Issue #25 on GitHub:

  Optionally disable tab indent/outdent of lists
  #25
  • Loading branch information...
commit f4a2bd8aded86c99734b189a4f7bc8803f2fcc17 1 parent ac3e0f5
@xolox authored
View
12 README.md
@@ -73,6 +73,18 @@ When you change the nesting level (indentation) of a line containing a bullet po
The first level of list items gets the first bullet point in `g:notes_list_bullets`, the second level gets the second, etc. When you're indenting a list item to a level where the `g:notes_list_bullets` doesn't have enough bullets, the plug-in starts again at the first bullet in the list (in other words the selection of bullets wraps around).
+### The `g:notes_tab_indents` option
+
+By default `Tab` is mapped to indent list items and `Shift-Tab` is mapped to dedent list items. You can disable these mappings by adding the following to your [vimrc script] [vimrc]:
+
+ :let g:notes_tab_indents = 0
+
+### The `g:notes_alt_indents` option
+
+By default `Alt-Right` is mapped to indent list items and `Alt-Left` is mapped to dedent list items. You can disable these mappings by adding the following to your [vimrc script] [vimrc]:
+
+ :let g:notes_alt_indents = 0
+
### The `g:notes_shadowdir` option
The notes plug-in comes with some default notes containing documentation about the plug-in. This option defines the path of the directory containing these notes.
View
10 autoload/xolox/notes.vim
@@ -6,7 +6,7 @@
" Note: This file is encoded in UTF-8 including a byte order mark so
" that Vim loads the script using the right encoding transparently.
-let g:xolox#notes#version = '0.18'
+let g:xolox#notes#version = '0.18.1'
let s:scriptdir = expand('<sfile>:p:h')
call xolox#misc#compat#check('notes', 2)
@@ -60,6 +60,14 @@ function! xolox#notes#init() " {{{1
if !exists('g:notes_smart_quotes')
let g:notes_smart_quotes = 1
endif
+ " Tab/Shift-Tab is used to indent/dedent list items by default.
+ if !exists('g:notes_tab_indents')
+ let g:notes_tab_indents = 1
+ endif
+ " Alt-Left/Alt-Right is used to indent/dedent list items by default.
+ if !exists('g:notes_alt_indents')
+ let g:notes_alt_indents = 1
+ endif
" Text used for horizontal rulers.
if !exists('g:notes_ruler_text')
let g:notes_ruler_text = repeat(' ', ((&tw > 0 ? &tw : 79) - 5) / 2) . '* * *'
View
28 doc/notes.txt
@@ -13,10 +13,12 @@ Contents ~
4. The |g:notes_smart_quotes| option
5. The |g:notes_ruler_text| option
6. The |g:notes_list_bullets| option
- 7. The |g:notes_shadowdir| option
- 8. The |g:notes_indexfile| option
- 9. The |g:notes_indexscript| option
- 10. The |g:notes_tagsindex| option
+ 7. The |g:notes_tab_indents| option
+ 8. The |g:notes_alt_indents| option
+ 9. The |g:notes_shadowdir| option
+ 10. The |g:notes_indexfile| option
+ 11. The |g:notes_indexscript| option
+ 12. The |g:notes_tagsindex| option
4. Commands |notes-commands|
1. The |:Note| command
2. The |:NoteFromSelectedText| command
@@ -216,6 +218,24 @@ enough bullets, the plug-in starts again at the first bullet in the list (in
other words the selection of bullets wraps around).
-------------------------------------------------------------------------------
+The *g:notes_tab_indents* option
+
+By default 'Tab' is mapped to indent list items and 'Shift-Tab' is mapped to
+dedent list items. You can disable these mappings by adding the following to
+your |vimrc| script:
+>
+ :let g:notes_tab_indents = 0
+
+-------------------------------------------------------------------------------
+The *g:notes_alt_indents* option
+
+By default 'Alt-Right' is mapped to indent list items and 'Alt-Left' is mapped
+to dedent list items. You can disable these mappings by adding the following
+to your |vimrc| script:
+>
+ :let g:notes_alt_indents = 0
+
+-------------------------------------------------------------------------------
The *g:notes_shadowdir* option
The notes plug-in comes with some default notes containing documentation about
View
44 ftplugin/notes.vim
@@ -1,6 +1,6 @@
" Vim file type plug-in
" Author: Peter Odding <peter@peterodding.com>
-" Last Change: December 1, 2011
+" Last Change: May 5, 2013
" URL: http://peterodding.com/code/vim/notes/
if exists('b:did_ftplugin')
@@ -91,25 +91,29 @@ endif
inoremap <buffer> *** <C-o>:call xolox#notes#insert_ruler()<CR>
let b:undo_ftplugin .= ' | execute "iunmap <buffer> ***"'
-" Indent list items using <Tab> and <Shift-Tab>. {{{1
-inoremap <buffer> <silent> <Tab> <C-o>:call xolox#notes#indent_list(1, line('.'), line('.'))<CR>
-snoremap <buffer> <silent> <Tab> <C-o>:<C-u>call xolox#notes#indent_list(1, line("'<"), line("'>"))<CR><C-o>gv
-let b:undo_ftplugin .= ' | execute "iunmap <buffer> <Tab>"'
-let b:undo_ftplugin .= ' | execute "sunmap <buffer> <Tab>"'
-inoremap <buffer> <silent> <S-Tab> <C-o>:call xolox#notes#indent_list(-1, line('.'), line('.'))<CR>
-snoremap <buffer> <silent> <S-Tab> <C-o>:<C-u>call xolox#notes#indent_list(-1, line("'<"), line("'>"))<CR><C-o>gv
-let b:undo_ftplugin .= ' | execute "iunmap <buffer> <S-Tab>"'
-let b:undo_ftplugin .= ' | execute "sunmap <buffer> <S-Tab>"'
-
-" Indent list items using <Alt-Left> and <Alt-Right>. {{{1
-inoremap <buffer> <silent> <A-Right> <C-o>:call xolox#notes#indent_list(1, line('.'), line('.'))<CR>
-snoremap <buffer> <silent> <A-Right> <C-o>:<C-u>call xolox#notes#indent_list(1, line("'<"), line("'>"))<CR><C-o>gv
-let b:undo_ftplugin .= ' | execute "iunmap <buffer> <A-Right>"'
-let b:undo_ftplugin .= ' | execute "sunmap <buffer> <A-Right>"'
-inoremap <buffer> <silent> <A-Left> <C-o>:call xolox#notes#indent_list(-1, line('.'), line('.'))<CR>
-snoremap <buffer> <silent> <A-Left> <C-o>:<C-u>call xolox#notes#indent_list(-1, line("'<"), line("'>"))<CR><C-o>gv
-let b:undo_ftplugin .= ' | execute "iunmap <buffer> <A-Left>"'
-let b:undo_ftplugin .= ' | execute "sunmap <buffer> <A-Left>"'
+" Indent list items using <Tab> and <Shift-Tab>? {{{1
+if g:notes_tab_indents
+ inoremap <buffer> <silent> <Tab> <C-o>:call xolox#notes#indent_list(1, line('.'), line('.'))<CR>
+ snoremap <buffer> <silent> <Tab> <C-o>:<C-u>call xolox#notes#indent_list(1, line("'<"), line("'>"))<CR><C-o>gv
+ let b:undo_ftplugin .= ' | execute "iunmap <buffer> <Tab>"'
+ let b:undo_ftplugin .= ' | execute "sunmap <buffer> <Tab>"'
+ inoremap <buffer> <silent> <S-Tab> <C-o>:call xolox#notes#indent_list(-1, line('.'), line('.'))<CR>
+ snoremap <buffer> <silent> <S-Tab> <C-o>:<C-u>call xolox#notes#indent_list(-1, line("'<"), line("'>"))<CR><C-o>gv
+ let b:undo_ftplugin .= ' | execute "iunmap <buffer> <S-Tab>"'
+ let b:undo_ftplugin .= ' | execute "sunmap <buffer> <S-Tab>"'
+endif
+
+" Indent list items using <Alt-Left> and <Alt-Right>? {{{1
+if g:notes_alt_indents
+ inoremap <buffer> <silent> <A-Right> <C-o>:call xolox#notes#indent_list(1, line('.'), line('.'))<CR>
+ snoremap <buffer> <silent> <A-Right> <C-o>:<C-u>call xolox#notes#indent_list(1, line("'<"), line("'>"))<CR><C-o>gv
+ let b:undo_ftplugin .= ' | execute "iunmap <buffer> <A-Right>"'
+ let b:undo_ftplugin .= ' | execute "sunmap <buffer> <A-Right>"'
+ inoremap <buffer> <silent> <A-Left> <C-o>:call xolox#notes#indent_list(-1, line('.'), line('.'))<CR>
+ snoremap <buffer> <silent> <A-Left> <C-o>:<C-u>call xolox#notes#indent_list(-1, line("'<"), line("'>"))<CR><C-o>gv
+ let b:undo_ftplugin .= ' | execute "iunmap <buffer> <A-Left>"'
+ let b:undo_ftplugin .= ' | execute "sunmap <buffer> <A-Left>"'
+endif
" Automatically remove empty list items on Enter. {{{1
inoremap <buffer> <silent> <expr> <CR> xolox#notes#cleanup_list()
Please sign in to comment.
Something went wrong with that request. Please try again.