Skip to content

Commit

Permalink
Properly use Unicode bullets in generated "All tags" note
Browse files Browse the repository at this point in the history
  • Loading branch information
xolox committed Jul 22, 2011
1 parent 16093e8 commit 1b928a1
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 8 deletions.
14 changes: 8 additions & 6 deletions autoload/xolox/notes.vim
@@ -1,6 +1,6 @@
" Vim auto-load script
" Author: Peter Odding <peter@peterodding.com>
" Last Change: July 9, 2011
" Last Change: July 22, 2011
" URL: http://peterodding.com/code/vim/notes/

" Note: This file is encoded in UTF-8 including a byte order mark so
Expand Down Expand Up @@ -237,7 +237,7 @@ function! xolox#notes#index_tagged_notes(verbose) " {{{1
" doesn't give a complete picture (doing so would slow down the indexing
" and complicate this code significantly) but it's better than nothing!
let lines = ['All tags', '', printf("You have used %i tags in your notes, they're listed below.", len(known_tags))]
let bullet = xolox#notes#insert_bullet('*')
let bullet = s:get_bullet('*')
for tagname in tagnames
call extend(lines, ['', '# ' . tagname, ''])
let fnames = keys(known_tags[tagname])
Expand Down Expand Up @@ -694,14 +694,16 @@ endfunction

function! xolox#notes#insert_bullet(chr) " {{{3
" Insert a UTF-8 list bullet when the user types "*".
if xolox#notes#unicode_enabled()
if getline('.')[0 : max([0, col('.') - 2])] =~ '^\s*$'
return ''
endif
if getline('.')[0 : max([0, col('.') - 2])] =~ '^\s*$'
return s:get_bullet(a:chr)
endif
return a:chr
endfunction

function! s:get_bullet(chr)
return xolox#notes#unicode_enabled() ? '' : a:chr
endfunction

function! xolox#notes#indent_list(command, line1, line2) " {{{3
" Change indent of list items from {line1} to {line2} using {command}.
if a:line1 == a:line2 && getline(a:line1) == ''
Expand Down
4 changes: 2 additions & 2 deletions plugin/notes.vim
@@ -1,6 +1,6 @@
" Vim plug-in
" Author: Peter Odding <peter@peterodding.com>
" Last Change: July 9, 2011
" Last Change: July 22, 2011
" URL: http://peterodding.com/code/vim/notes/

" Support for automatic update using the GLVS plug-in.
Expand All @@ -11,7 +11,7 @@ if &cp || exists('g:loaded_notes')
finish
endif

let g:notes_version = '0.10'
let g:notes_version = '0.10.1'

" Make sure the default paths below are compatible with Pathogen.
let s:plugindir = expand('<sfile>:p:h') . '/../misc/notes'
Expand Down

0 comments on commit 1b928a1

Please sign in to comment.