Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add option to exclude buffers by &buftype #75

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
10 changes: 7 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,16 +35,20 @@ a `:BundleInstall`:
Numbers Don't Belong
--------------------

If you see numbers where they don't belong like in the help menus or other vim plugins be sure to add your plugins to the excludes list in your vimrc like so
If you see numbers where they don't belong like in the help menus or other vim plugins be sure to add
the filetypes used by your plugins to the excludes list in your vimrc like so

let g:numbers_exclude = ['tagbar', 'gundo', 'minibufexpl', 'nerdtree']

The plugin by default contains the following:

let g:numbers_exclude = ['unite', 'tagbar', 'startify', 'gundo', 'vimshell', 'w3m']$
let g:numbers_exclude = ['unite', 'tagbar', 'startify', 'gundo', 'vimshell', 'w3m']

So be sure to include the superset in your vimrc or gvimrc.

So be sure to include the superset in your vimrc or gvimrc
You can also exclude buffers by buftype to exclude buffers Vim uses for some native features. The default is

let g:numbers_exclude_buftypes = [ 'acwrite', 'help', 'nofile', 'nowrite', 'quickfix', 'terminal' ]

Usage
-----
Expand Down
11 changes: 7 additions & 4 deletions plugin/numbers.vim
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,12 @@ if (!exists('g:enable_numbers'))
let g:enable_numbers = 1
endif

if (!exists('g:numbers_exclude'))
let g:numbers_exclude = ['unite', 'tagbar', 'startify', 'gundo', 'vimshell', 'w3m', 'nerdtree', 'Mundo', 'MundoDiff']
if (!exists('g:numbers_exclude_filetypes'))
let g:numbers_exclude_filetypes = ['unite', 'tagbar', 'startify', 'gundo', 'vimshell', 'w3m', 'nerdtree', 'Mundo', 'MundoDiff']
endif

if (!exists('g:numbers_exclude_buftypes'))
let g:numbers_exclude_buftypes = [ 'acwrite', 'help', 'nofile', 'nowrite', 'quickfix', 'terminal' ]
endif

if v:version < 703 || &cp
Expand All @@ -35,7 +39,6 @@ if v:version < 703 || &cp
finish
endif


"Allow use of line continuation
let s:save_cpo = &cpo
set cpo&vim
Expand Down Expand Up @@ -82,7 +85,7 @@ function! ResetNumbers()
else
call NumbersRelativeOff()
end
if index(g:numbers_exclude, &ft) >= 0
if index(g:numbers_exclude_filetypes, &ft) >= 0 || index(g:numbers_exclude_buftypes, &bt) >= 0
setlocal norelativenumber
setlocal nonumber
endif
Expand Down