Skip to content

MarcWeber/vim-addon-signs

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 

Repository files navigation

example usage:
==============
  See plugin/vim-addon-signs.vim

  To support this plugin in your plugin copy paste one of the following lines after settming the quickfix or location list:

      if exists(':UpdateLocationlistSigns') | UpdateLocationlistSigns | endif

      if exists(':UpdateQuickfixSigns') | UpdateQuickfixSigns | endif

  Users can then opt out by adding this to their .vimrc:
  let g:vim_addon_signs = { 'provide_qf_command' : 0, 'provide_el_command' : 0 }

why?
====

- the signs api is broken (You can't ensure that you're not using an ID a different plugin is used).
  By providing a sane interface (asking all plugins to use it) you can get rid of
  possible issues of using the same id twice by accident

- avoid redrawing.
  exec 'sign unplace 3454324' | exec 'sign place 3454324 line=3  name=ensime_marker_error file='.expand('%')
  Will make the sign area go away and popup again. If you place the same sign no redrawing should take place

design choices
==============

- differential: Only apply differences

- push: You tell the plugin when a set of signs has changed.
  Its not the responsibility of this plugin to find out - nor is it
  to overcome missing "quickfix list changed" events in Vim.
  So if you want to do fancy stuff such as tracking cursor position its your
  responsibility to push the new location list when needed

  This means if you want to track quickfix list you have to tell this list when
  it changed. (see example usage)

- its your responsibility to register sign types
  Eg use such a line to define error markers once:
  sign define NAME text=! linehl=ErrorMsg

- stop after X signs for speed reasons (defaults to 1000)

alternatives to this plugin:
============================
  An alternative implementation is provided by quickfixsigns (by Tim Pope). Here
  the signs are reevaluated on BufEnter events etc. It can also show balloons.
  I think its overkill for some use cases. Also the "buffer" orientated nature of it
  doesn't fit my use case - I don't want to workaround it by something like this:
  tlib#win#WinCmd("reset signs for this visible buffer")

  The process_max setting is inspired by quickfixsigns though.


  mark errors using syntax highlighting:
  http://www.vim.org/account/profile.php?user_id=9552

more examples
===============
  As example how to implement to show the last cursor position in all windows
  (Note: If you show the same buffer multiple times .. this won't be correct, but there is no way setting a marker for a window + buffer only)

  sign define cursor_location text=-
  augroup TRACK_LAST_CURSOR_POS_FOR_EACH_WINDOW
    au!
    autocmd CursorHold,CursorHoldI,CursorMoved,CursorMovedI *
      \   let b:last_cursor_pos = [bufnr('%'), line('.'), 'cursor_location']
      \ | call vim_addon_signs#Push("last_cursor_pos", map(filter(range(1, bufnr('$')), 'bufexists(v:val) && has_key(getbufvar(v:val,""),"last_cursor_pos")'), 'getbufvar(v:val, "last_cursor_pos")' ))
  augroup end

  Add a dummy sign so that the left column showing the signs is always present:
  " can't use an opaque sign :-(
  sign define dummy text=.
  augroup TRACK_LAST_CURSOR_POS_FOR_EACH_WINDOW
    au!
    autocmd BufNew * call vim_addon_signs#Push("dummy", map(filter(range(1, bufnr('$')), 'bufexists(v:val)'), '[v:val, 1, "dummy"]' ))
  augroup end

BUGS: if you insert lines above a sign they'll move. Thus the remembered line
number in b:placed_signs and the actual line number will differ. For most use
cases this will not be a problem though.


upstream
========
http://github.com/MarcWeber/vim-addon-signs


About

simple abstraction over the bad signs api of Vim

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published