changeset 462:c7563246abb4

Added signature vim plugin
author unexist
date Fri, 19 Jun 2015 11:15:57 +0200
parents 0dd1732f9b76
children b6930493aea2
files .vim/after/plugin/signature_gitgutter.vim .vim/doc/signature.txt .vim/plugin/signature.vim .vim/plugin/signature/mark.vim .vim/plugin/signature/marker.vim .vim/plugin/signature/sign.vim .vim/plugin/signature/utils.vim
diffstat 7 files changed, 1468 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.vim/after/plugin/signature_gitgutter.vim	Fri Jun 19 11:15:57 2015 +0200
@@ -0,0 +1,34 @@
+" vim: fdm=marker:et:ts=4:sw=2:sts=2
+
+" Maintainer:  Kartik Shenoy
+""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
+
+" Exit if the signs feature is not available or if the app has already been loaded (or "compatible" mode set)
+if (  !has('signs')
+ \ || &cp
+ \ )
+  finish
+endif
+
+"" Exit if vim-signature is not loaded
+if !exists('g:loaded_Signature')
+  finish
+endif
+
+if exists('g:loaded_gitgutter')
+  if g:SignatureMarkTextHLDynamic
+    let g:SignatureMarkTextHL = 'signature#sign#GetGitGutterHLGroup(a:lnum)'
+  endif
+  if g:SignatureMarkerTextHLDynamic
+    let g:SignatureMarkerTextHL = 'signature#sign#GetGitGutterHLGroup(a:lnum)'
+  endif
+endif
+
+if exists('g:loaded_signify')
+  if g:SignatureMarkTextHLDynamic
+    let g:SignatureMarkTextHL = 'signature#sign#GetSignifyHLGroup(a:lnum)'
+  endif
+  if g:SignatureMarkerTextHLDynamic
+    let g:SignatureMarkerTextHL = 'signature#sign#GetSignifyHLGroup(a:lnum)'
+  endif
+endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.vim/doc/signature.txt	Fri Jun 19 11:15:57 2015 +0200
@@ -0,0 +1,352 @@
+*signature.txt*  A plugin to toggle, display and navigate marks
+
+     _________.__                            __                              ~
+    /   _____/|__|   ____    ____  _____   _/  |_  __ __ _______   ____      ~
+    \_____  \ |  |  / ___\  /    \ \__  \  \   __\|  |  \\_  __ \_/ __ \     ~
+    /        \|  | / /_/  >|   |  \ / __ \_ |  |  |  |  / |  | \/\  ___/     ~
+   /_______  /|__| \___  / |___|  /(____  / |__|  |____/  |__|    \___  >    ~
+           \/     /_____/       \/      \/                            \/     ~
+
+
+==============================================================================
+1. Contents                                   *signature-contents* *signature*
+
+  1. Contents         |signature-contents|
+  2. Mappings         |signature-mappings|
+  3. Commands         |signature-commands|
+  4. Customization    |signature-customization|
+  5. Contributing     |signature-contributing|
+  6. Credits          |signature-credits|
+  7. License          |signature-license|
+
+
+==============================================================================
+2. Mappings                                               *signature-mappings*
+
+Out of the box, the followings mappings are defined by default
+
+  mx           Toggle mark 'x' and display it in the leftmost column
+  dmx          Remove mark 'x' where x is a-zA-Z
+
+  m,           Place the next available mark
+  m.           If no mark on line, place the next available mark. Otherwise,
+               remove (first) existing mark.
+  m-           Delete all marks from the current line
+  m<Space>     Delete all marks from the current buffer
+  ]`           Jump to next mark
+  [`           Jump to prev mark
+  ]'           Jump to start of next line containing a mark
+  ['           Jump to start of prev line containing a mark
+  `]           Jump by alphabetical order to next mark
+  `[           Jump by alphabetical order to prev mark
+  ']           Jump by alphabetical order to start of next line having a mark
+  '[           Jump by alphabetical order to start of prev line having a mark
+  m/           Open location list and display marks from current buffer
+
+  m[0-9]       Toggle the corresponding marker !@#$%^&*()
+  m<S-[0-9]>   Remove all markers of the same type
+  ]-           Jump to next line having a marker of the same type
+  [-           Jump to prev line having a marker of the same type
+  ]=           Jump to next line having a marker of any type
+  [=           Jump to prev line having a marker of any type
+  m?           Open location list and display markers from current buffer
+  m<BS>        Remove all markers
+
+This will allow the use of default behavior of m to set marks and, if
+the line already contains the mark, it'll be unset. The default behavior
+of ]', [', ]` and [` is supported and enhanced by wrapping around when
+beginning or end of file is reached. ]-, [-, ]= and [= also accept a count.
+
+To directly jump to a given marker, the following maps can be used
+>
+  nnoremap [1 :call signature#marker#Goto('prev', 1, v:count)
+  nnoremap ]1 :call signature#marker#Goto('next', 1, v:count)
+  nnoremap [2 :call signature#marker#Goto('prev', 2, v:count)
+  nnoremap ]2 :call signature#marker#Goto('next', 2, v:count)
+<
+etc. These are not defined by default
+
+
+==============================================================================
+3. Commands                                               *signature-commands*
+
+SignatureToggleSigns
+  Toggle the display of signs. This won't affect the marks or the mappings.
+
+SignatureRefresh
+  Force the display of signs in the buffer to refresh. Use this to correct
+  the signs if things go awry
+
+SignatureListMarks
+  List all the marks used in the current buffer in the location list
+
+SignatureListMarkers [marker]
+  List all instances of the specified marker used in the current buffer in
+  the location list. If no argument is given, it lists all markers
+
+
+==============================================================================
+4. Customization                                     *signature-customization*
+
+                                                            *'g:SignatureMap'*
+  Type: Dictionary, Default:
+  To set up your own mappings copy the following dictionary and edit it
+>
+      let g:SignatureMap = {
+        \ 'Leader'             :  "m",
+        \ 'PlaceNextMark'      :  "m,",
+        \ 'ToggleMarkAtLine'   :  "m.",
+        \ 'PurgeMarksAtLine'   :  "m-",
+        \ 'DeleteMark'         :  "dm",
+        \ 'PurgeMarks'         :  "m<Space>",
+        \ 'PurgeMarkers'       :  "m<BS>",
+        \ 'GotoNextLineAlpha'  :  "']",
+        \ 'GotoPrevLineAlpha'  :  "'[",
+        \ 'GotoNextSpotAlpha'  :  "`]",
+        \ 'GotoPrevSpotAlpha'  :  "`[",
+        \ 'GotoNextLineByPos'  :  "]'",
+        \ 'GotoPrevLineByPos'  :  "['",
+        \ 'GotoNextSpotByPos'  :  "]`",
+        \ 'GotoPrevSpotByPos'  :  "[`",
+        \ 'GotoNextMarker'     :  "[+",
+        \ 'GotoPrevMarker'     :  "[-",
+        \ 'GotoNextMarkerAny'  :  "]=",
+        \ 'GotoPrevMarkerAny'  :  "[=",
+        \ 'ListLocalMarks'     :  "m/",
+        \ 'ListLocalMarkers'   :  "m?"
+        \ }
+<
+  By default, it defines the mappings as shown in |signature-mappings|
+  To disable a map entirely, specify it as an empty string.
+  If a key is not specified, the default value will be picked up.
+  These same characters will be used to invoke the shortcuts.
+
+
+                                                   *'g:SignatureIncludeMarks'*
+  String, Default : 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'
+
+  Specify the marks that can be controlled by this plugin.
+  Only supports Alphabetical marks at the moment.
+  'b:SignatureIncludeMarks' can be set separately for buffer-specific marks.
+
+
+                                                 *'g:SignatureIncludeMarkers'*
+  String, Default : '!@#$%^&*()'
+
+  Specify the markers that can be used by the plugin.
+  'b:SignatureIncludeMarkers' can be specified separately for each buffer
+
+
+                               *g:SignatureMap['Leader']* *'SignatureMapLeader'*
+  String, Default: 'm'
+
+  Set the key used to toggle marks and markers.
+  For eg. If this key is set to `<leader>m`,
+    `<leader>ma`       will toggle the mark 'a' on the current line
+    `<leader>m,`       will place the next available mark
+    `<leader>m.`       will place the next available mark if there are no
+                     marks already on the line; otherwise, will remove
+                     first mark from line
+    `<leader>m<Space>` will delete all marks
+    `<leader>m1`       will toggle the marker '!'
+    `<leader>m!`       will remove all the '!' markers
+    `<leader>m<BS>`    will remove all markers
+
+  Note:
+  Currently, either marks or markers can be displayed in front of a line.
+  Both can't be displayed simultaenously.
+
+  To set this to mapleader or maplocalleader
+>
+    let g:SignatureMap['Leader'] = '<Leader>'
+    let g:SignatureMap['Leader'] = '<LocalLeader>'
+<
+
+                                                      *'g:SignatureWrapJumps'*
+  Boolean, Default : 1
+
+  Specify if jumping to marks should wrap-around.
+  'b:SignatureWrapJumps' can be set to specify buffer-specific settings.
+
+
+                                                      *'g:SignatureMarkOrder'*
+  String, Default : "\p\m"
+
+  Signature allows you to display upto marks in front of a line. This controls
+  the order in which marks are displayed.
+    '\m' indicates the current or latest mark placed on the line
+    '\p' indicates the previous mark placed on the line
+
+  For eg,
+    `g:SignatureMarkOrder="\m."`  : Display last mark with '.' suffixed
+    `g:SignatureMarkOrder="_\m"`  : Display last mark with '_' prefixed
+    `g:SignatureMarkOrder=">"`    : Display only a ">" for a line with a mark.
+                                  The mark is not displayed
+    `g:SignatureMarkOrder="\m\p"` : Display last two marks placed
+
+  Note:
+  The signs feature allows only 2 characters to be displayed. This is not and
+  arbitratry limitation of the plugin.
+
+
+                                                     *'g:SignatureMarkTextHL'*
+  String, Default : 'Exception'
+
+  The highlight group used for mark signs. This can be set to a function
+  reference can be assigned to this to allow dynamic highlighting of signs
+  NOTE: The quotes should be a part of the assignment.
+  Eg.   let g:SignatureMarkTextHL = "'Exception'"
+
+
+                                              *'g:SignatureMarkTextHLDynamic'*
+  Boolean, Default: 0
+
+  Highlight signs of marks dynamically based upon state indicated by
+  vim-gitgutter or vim-signify
+
+
+                                                     *'g:SignatureMarkLineHL'*
+  String, Default : ''
+
+  The highlight group used for hightlighting lines having mark signs.
+
+
+                                                   *'g:SignatureMarkerTextHL'*
+  String, Default : 'WarningMsg'
+
+  The highlight group used for marker signs. This can be set to a function
+  reference can be assigned to this to allow dynamic highlighting of signs
+  NOTE: The quotes should be a part of the assignment.
+  Eg.   let g:SignatureMarkTextHL = "'WarningMsg'"
+
+
+                                            *'g:SignatureMarkerTextHLDynamic'*
+  Boolean, Default: 0
+
+  Highlight signs of markers dynamically based upon state indicated by
+  vim-gitgutter or vim-signify
+
+
+                                                   *'g:SignatureMarkerLineHL'*
+  String, Default : ''
+
+  The highlight group used for hightlighting lines having marker signs.
+
+
+                                             *'g:SignatureDeleteConfirmation'*
+  Boolean, Default: 0
+
+  An option for the more clumsy-fingered of us. Asks for confirmation before
+  moving/replacing/overwriting any marks
+
+
+                                              *'g:SignaturePurgeConfirmation'*
+  Boolean, Default: 0
+
+  Similar to g:SignatureDeleteConfirmation. Asks for confirmation before
+  deleting all marks/markers
+
+
+                                                *'g:SignaturePeriodicRefresh'*
+  Boolean, Default: 1
+
+  Enable the display to refresh periodically. Generally a good thing to have.
+  This makes use of the CursorHold autocmd event to execute periodically.
+  The frequency of this event can be controlled by changing the value of the
+  updatetime variable in milliseconds
+    `set updatetime = 100`
+
+
+                                                *'g:SignaturePrioritizeMarks'*
+  Boolean, Default: 1
+
+  When a line has both marks and markers, display the sign for marks. If set
+  to 0, it will display the sign for markers instead
+
+
+                                               *'g:SignatureEnabledAtStartup'*
+  Boolean, Default: 1
+
+  Control if the signs should be shown by default. If set to 0, the signs
+  won't be visible until `:SignatureToggleSigns` has been called
+
+
+                                                 *'g:SignatureDeferPlacement'*
+  Boolean, Default: 1
+
+  NOTE: Not supported currently. Code was highly inefficient.
+  Check if any other plugin has already placed a sign and if set to 1,
+  Signature will hold off from placing a sign. If set to 0, Signature will
+  overwrite any signs that are already present.
+
+
+                                    *'g:SignatureUnconditionallyRecycleMarks'*
+  Boolean, Default: 0
+
+  Controls behavior when trying to place next available mark and all marks
+  have been used. If set to 0, then either an error or warning message will be
+  emitted, depending on the setting of |g:SignatureErrorIfNoAvailableMarks|.
+  If set to 1, then the first local mark (e.g., 'a') will be removed from its
+  existing location and applied to the current line.
+
+
+                                        *'g:SignatureErrorIfNoAvailableMarks'*
+  Boolean, Default: 1
+
+  Controls behavior when unable to place a new mark. If set to 1, then an
+  error is raised. If set to 0, then just a warning message.
+
+
+                                              *'g:SignatureForceRemoveGlobal'*
+  Boolean, Default: 1
+
+  Vim's handling of global marks is a bit iffy. This option forces the removal
+  of global marks by deleting it from the .viminfo file.
+
+
+                                             *'g:SignatureForceMarkPlacement'*
+  Boolean, Default: 0
+
+  When set to 1, will always place marks instead of toggling them
+
+
+                                           *'g:SignatureForceMarkerPlacement'*
+  Boolean, Default: 0
+
+  When set to 1, will always place markers instead of toggling them
+
+
+
+==============================================================================
+5. Contributing                                       *signature-contributing*
+
+  Please post any issues and all your suggestions on Github
+    https://github.com/kshenoy/vim-signature
+
+  Show some love by spreading the word and rating on
+    http://www.vim.org/scripts/script.php?script_id=4118
+
+
+==============================================================================
+6. Credits                                                 *signature-credits*
+
+A great thanks to these guys for providing the idea and inspiration to develop
+Signature
+
+* Sergey Khorev for mark-tools
+  http://www.vim.org/scripts/script.php?script_id=2929
+
+* Zak Johnson for vim-showmarks
+  https://github.com/zakj/vim-showmarks
+
+I'd also like to thank Steve J. Losh for learningvimscriptthehardway.com
+without whose detailed guide this plugin would not have seen the light of day.
+
+
+==============================================================================
+7. License                                                 *signature-license*
+
+Signature is MIT/X11 licensed
+
+
+vim:tw=78:ts=2:et:sts=2:sw=2:ft=help
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.vim/plugin/signature.vim	Fri Jun 19 11:15:57 2015 +0200
@@ -0,0 +1,138 @@
+" vim: fdm=marker:et:ts=4:sw=2:sts=2
+
+" Description: vim-signature is a plugin to toggle, display and navigate marks.
+"
+" Maintainer: Kartik Shenoy
+""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
+
+" Exit if the signs feature is not available or if the app has already been loaded (or "compatible" mode set)
+if !has('signs') || &cp
+  finish
+endif
+if exists('g:loaded_Signature')
+  finish
+endif
+let g:loaded_Signature = 3
+
+
+""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
+"" Global variables                                                                                                 {{{1
+"
+call signature#utils#Set('g:SignaturePrioritizeMarks',             1                                                     )
+call signature#utils#Set('g:SignatureIncludeMarks',                'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ')
+call signature#utils#Set('g:SignatureIncludeMarkers',              ')!@#$%^&*('                                          )
+call signature#utils#Set('g:SignatureMarkTextHL',                  '"Exception"'                                         )
+call signature#utils#Set('g:SignatureMarkTextHLDynamic',           0                                                     )
+call signature#utils#Set('g:SignatureMarkLineHL',                  '""'                                                  )
+call signature#utils#Set('g:SignatureMarkerTextHL',                '"WarningMsg"'                                        )
+call signature#utils#Set('g:SignatureMarkerTextHLDynamic',         0                                                     )
+call signature#utils#Set('g:SignatureMarkerLineHL',                '""'                                                  )
+call signature#utils#Set('g:SignatureWrapJumps',                   1                                                     )
+call signature#utils#Set('g:SignatureMarkOrder',                   "\p\m"                                                )
+call signature#utils#Set('g:SignatureDeleteConfirmation',          0                                                     )
+call signature#utils#Set('g:SignaturePurgeConfirmation',           0                                                     )
+call signature#utils#Set('g:SignaturePeriodicRefresh',             1                                                     )
+call signature#utils#Set('g:SignatureEnabledAtStartup',            1                                                     )
+call signature#utils#Set('g:SignatureDeferPlacement',              1                                                     )
+call signature#utils#Set('g:SignatureUnconditionallyRecycleMarks', 0                                                     )
+call signature#utils#Set('g:SignatureErrorIfNoAvailableMarks',     1                                                     )
+call signature#utils#Set('g:SignatureForceRemoveGlobal',           1                                                     )
+call signature#utils#Set('g:SignatureForceMarkPlacement',          0                                                     )
+call signature#utils#Set('g:SignatureForceMarkerPlacement',        0                                                     )
+call signature#utils#Set('g:SignatureMap',                         {}                                                    )
+
+
+""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
+"" Commands, Autocmds and Maps                                                                                      {{{1
+"
+call signature#utils#Maps('create')
+
+if has('autocmd')
+  augroup sig_autocmds
+    autocmd!
+    autocmd BufEnter,CmdwinEnter * call signature#sign#Refresh()
+    autocmd CursorHold * if g:SignaturePeriodicRefresh | call signature#sign#Refresh() | endif
+    autocmd BufEnter,FileType * if (&filetype ==? 'nerdtree') | call signature#utils#Maps('remove') | endif
+    autocmd BufLeave * if (&filetype ==? 'nerdtree') | call signature#utils#Maps('create') | endif
+  augroup END
+endif
+
+command! -nargs=0 SignatureToggleSigns call signature#Toggle()
+command! -nargs=0 SignatureRefresh     call signature#sign#Refresh('force')
+command! -nargs=0 SignatureListMarks   call signature#mark#List('buf_curr')
+command! -nargs=? SignatureListMarkers call signature#marker#List(<args>)
+
+
+""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
+"" Misc                                                                                                             {{{1
+"
+function! signature#Input()                                                                                       " {{{2
+  " Description: Grab input char
+
+  " Obtain input from user ...
+  let l:char = nr2char(getchar())
+
+  " ... if the input is not a number eg. '!' ==> Delete all '!' markers
+  if stridx(b:SignatureIncludeMarkers, l:char) >= 0
+    return signature#marker#Purge(l:char)
+  endif
+
+  " ... but if input is a number, convert it to corresponding marker before proceeding
+  if match( l:char, '\d' ) >= 0
+    let l:char = split(')!@#$%^&*(', '\zs')[l:char]
+  endif
+
+  if stridx(b:SignatureIncludeMarkers, l:char) >= 0
+    return signature#marker#Toggle(l:char)
+  elseif stridx(b:SignatureIncludeMarks, l:char) >= 0
+    return signature#mark#Toggle(l:char)
+  else
+    " l:char is probably one of `'[]<>
+    execute 'normal! m' . l:char
+  endif
+endfunction
+
+
+function! signature#Toggle()                                                                                      " {{{2
+  " Description: Toggles and refreshes sign display in the buffer.
+
+  let b:sig_enabled = !b:sig_enabled
+
+  if b:sig_enabled
+    " Signature enabled ==> Refresh signs
+    call signature#sign#Refresh()
+
+    " Add signs for markers ...
+    for i in keys(b:sig_markers)
+      call signature#sign#Place(b:sig_markers[i], i)
+    endfor
+  else
+    " Signature disabled ==> Remove signs
+    for l:lnum in keys(b:sig_markers)
+      call signature#sign#Unplace(l:lnum)
+    endfor
+    for l:lnum in keys(b:sig_marks)
+      call signature#sign#Unplace(l:lnum)
+    endfor
+    call signature#sign#ToggleDummy('remove')
+    unlet b:sig_marks
+  endif
+endfunction
+
+
+function! signature#Remove(lnum)                                                                                  " {{{2
+  " Description: Obtain mark or marker from the user and remove it from the specified line number.
+  "              If lnum is not specified for marker, or is 0, removes the marker from current line
+  "              NOTE: lnum is meaningless for a mark
+  " Arguments:   lnum - Line no. to delete the marker from
+
+  let l:char = nr2char(getchar())
+
+  if (l:char =~ '^\d$')
+    let l:lnum = (a:lnum == 0 ? line('.') : a:lnum)
+    let l:char = split(')!@#$%^&*(', '\zs')[l:char]
+    call signature#marker#Remove(lnum, l:char)
+  elseif (l:char =~? '^[a-z]$')
+    call signature#mark#Remove(l:char)
+  endif
+endfunction
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.vim/plugin/signature/mark.vim	Fri Jun 19 11:15:57 2015 +0200
@@ -0,0 +1,407 @@
+" vim: fdm=marker:et:ts=4:sw=2:sts=2
+""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
+
+""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
+"" Place/Remove/Toggle                                                                                              {{{1
+"
+function! signature#mark#Toggle(mark)                                                                             " {{{2
+  " Description: mark = 'next' : Place new mark on current line else toggle specified mark on current line
+  " Arguments:   mark [a-z,A-Z]
+
+  if a:mark == "next"
+    " Place new mark
+    let l:marks_list = signature#mark#GetList('free', 'buf_all')
+    if empty(l:marks_list)
+      if (!g:SignatureUnconditionallyRecycleMarks)
+        " No marks available and mark re-use not in effect
+        call s:ReportNoAvailableMarks()
+        return
+      endif
+      " Remove a local mark
+      let l:marks_list = signature#mark#GetList('used', 'buf_curr')[0]
+      call signature#mark#Remove(l:marks_list[0])
+    endif
+    call signature#mark#Place(l:marks_list[0])
+
+  else
+    " Toggle Mark
+    let l:used_marks = filter(signature#mark#GetList('used', 'buf_all'), 'v:val[0] ==# a:mark')
+    if (len(l:used_marks) > 0)
+      let l:mark_pos = l:used_marks[0][1]
+      let l:mark_buf = l:used_marks[0][2]
+
+      if (l:mark_buf == bufnr('%'))
+        " If the mark is not in use in current buffer then it's a global ==> Don't worry about deleting it
+        if (  (l:mark_pos == line('.'))
+         \ && !g:SignatureForceMarkPlacement
+         \ )
+          " Mark is present on the current line. Remove it and return
+          call signature#mark#Remove(a:mark)
+          call signature#sign#ToggleDummy()
+          return
+        else
+          " Mark is present elsewhere in the current buffer ==> Remove it and fall-through to place new mark.
+          " If g:SignatureForceMarkPlacement is set, we remove and re-place it so that the sign string can be true
+          " to the order in which the marks were placed.
+          " For eg. if we place 'a, 'b and then 'a again, the sign string changes from "ab" to "ba"
+          " Ask for confirmation before moving mark
+          if (g:SignatureDeleteConfirmation)
+            let choice = confirm("Mark '" . a:mark . "' has been used elsewhere. Reuse it?", "&Yes\n&No", 1)
+            if choice == 2 | return | endif
+          endif
+          call signature#mark#Remove(a:mark)
+        endif
+      endif
+    endif
+
+    " Place new mark
+    call signature#mark#Place(a:mark)
+  endif
+endfunction
+
+
+function! signature#mark#Remove(mark)                                                                             " {{{2
+  " Description: Remove 'mark' and its associated sign. If called without an argument, obtain it from the user
+  " Arguments:   mark = [a-z,A-Z]
+
+  if stridx(b:SignatureIncludeMarks, a:mark) == -1
+    return
+  endif
+
+  let l:lnum = line("'" . a:mark)
+  call signature#sign#Remove(a:mark, l:lnum)
+  execute 'delmarks ' . a:mark
+  call signature#mark#ForceGlobalRemoval(a:mark)
+endfunction
+
+
+function! signature#mark#Place(mark)                                                                              " {{{2
+  " Description: Place new mark at current cursor position
+  " Arguments:   mark = [a-z,A-Z]
+  " If a line is deleted or mark is manipulated using any non-signature method then b:sig_marks can go out of sync
+  " Thus, we forcibly remove signs for the mark present on any line before proceeding
+  call signature#sign#Remove(a:mark, 0)
+  execute 'normal! m' . a:mark
+  call signature#sign#Place(a:mark, line('.'))
+endfunction
+
+
+function! signature#mark#ToggleAtLine()                                                                           " {{{2
+  " Description: If no mark on current line, add one. If marks are on the current line, remove one.
+  let l:marks_here = filter(signature#mark#GetList('used', 'buf_curr'), 'v:val[1] == ' . line('.'))
+  if empty(l:marks_here)
+    " Set up for adding a mark
+    call signature#mark#Toggle('next')
+  else
+    " Delete first mark
+    call signature#mark#Remove(l:marks_here[0][0])
+  endif
+endfunction
+
+
+function! signature#mark#Purge(mode)                                                                              " {{{2
+  " Description: Delete all marks from current line
+  " Arguments:   mode = 'line' : Delete all marks from current line
+  "                     'all'  : Delete all marks used in the buffer
+
+  let l:used_marks = signature#mark#GetList('used', 'buf_curr')
+  if (a:mode ==? 'line')
+    call filter(l:used_marks, 'v:val[1] == ' . line('.'))
+  endif
+
+  if (  !empty(l:used_marks)
+   \ && g:SignaturePurgeConfirmation
+   \ )
+    let l:msg = 'Are you sure you want to delete all marks' . (a:mode ==? 'line' ? ' from the current line' : '') . '?'
+    let l:ans = confirm(l:msg . ' This cannot be undone.', "&Yes\n&No", 1)
+    if (l:ans == 2) | return | endif
+  endif
+
+  for i in l:used_marks
+    call signature#mark#Remove(i[0])
+  endfor
+
+  " If marks are modified using any non-signature method, b:sig_marks can go out of sync
+  if (a:mode ==? 'all')
+    for l:lnum in keys(b:sig_marks)
+      call signature#sign#Unplace(l:lnum)
+    endfor
+  endif
+  call signature#sign#ToggleDummy()
+endfunction
+" }}}2
+
+
+""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
+"" Navigation                                                                                                       {{{1
+"
+function! signature#mark#Goto(dir, loc, mode)                                                                     " {{{2
+  " Arguments:
+  "   dir   = next   : Jump forward
+  "           prev   : Jump backward
+  "   loc   = line   : Jump to first column of line with mark
+  "           spot   : Jump to exact column of the mark
+  "   mode  = pos    : Jump to next mark by position
+  "           alpha  : Jump to next mark by alphabetical order
+  "           global : Jump only to global marks (applies to all buffers and alphabetical order)
+
+  let l:mark = ""
+  let l:dir  = a:dir
+
+  if a:mode ==? "global"
+    let l:mark = s:GotoByAlphaGlobal(a:dir)
+  elseif a:mode ==? "alpha"
+    let l:mark = s:GotoByAlpha(a:dir)
+  elseif a:mode ==? "pos"
+    let l:mark = s:GotoByPos(a:dir)
+  endif
+
+  " NOTE: If l:mark is an empty string then no movement will be made
+  if l:mark == "" | return | endif
+
+  if a:loc ==? "line"
+    execute "normal! '" . l:mark
+  elseif a:loc ==? "spot"
+    execute 'normal! `' . l:mark
+  endif
+endfunction
+
+
+function! s:GotoByPos(dir)                                                                                        " {{{2
+  " Description: Jump to next/prev mark by location.
+  " Arguments: dir  = next   : Jump forward
+  "                   prev   : Jump backward
+
+  " We need at least one mark to be present. If not, then return an empty string so that no movement will be made
+  if empty( b:sig_marks ) | return "" | endif
+
+  let l:lnum = line('.')
+
+  " Get list of line numbers of lines with marks.
+  if a:dir ==? "next"
+    let l:targ = min( sort( keys( b:sig_marks ), "signature#utils#NumericSort" ))
+    let l:mark_lnums = sort( keys( filter( copy( b:sig_marks ), 'v:key > l:lnum')), "signature#utils#NumericSort" )
+  elseif a:dir ==? "prev"
+    let l:targ = max( sort( keys( b:sig_marks ), "signature#utils#NumericSort" ))
+    let l:mark_lnums = reverse( sort( keys( filter( copy( b:sig_marks ), 'v:key < l:lnum')), "signature#utils#NumericSort" ))
+  endif
+  let l:targ = ( empty( l:mark_lnums ) && b:SignatureWrapJumps ? l:targ : l:mark_lnums[0] )
+  let l:mark = strpart( b:sig_marks[l:targ], 0, 1 )
+
+  return l:mark
+endfunction
+
+
+function! s:GotoByAlpha(dir)                                                                                      " {{{2
+  " Description: Jump to next/prev mark by alphabetical order. Direction specified as input argument
+
+  let l:used_marks = signature#mark#GetList('used', 'buf_curr')
+  let l:line_marks = filter(copy(l:used_marks), 'v:val[1] == ' . line('.'))
+
+  " If there is only one mark in the current file, then return the same
+  if (len(l:used_marks) == 1)
+    return l:used_marks[0][0]
+  endif
+
+  " Since we can place multiple marks on a line, to jump by alphabetical order we need to know what the current mark is.
+  " This information is kept in the b:sig_GotoByAlpha_CurrMark variable. For instance, if we have marks a, b and c
+  " on the current line and b:sig_GotoByAlpha_CurrMark has the value 'a' then we jump to 'b' and set the value of
+  " the variable to 'b'. Reinvoking this function will thus now jump to 'c'
+  if empty(l:line_marks)
+    if exists('b:sig_GotoByAlpha_CurrMark')
+      unlet b:sig_GotoByAlpha_CurrMark
+    endif
+    " If there are no marks present on the current line then call GotoByPos to jump to the next line with a mark
+    return s:GotoByPos(a:dir)
+  endif
+
+  if (( len(l:line_marks) == 1 ) || !exists('b:sig_GotoByAlpha_CurrMark') || (b:sig_GotoByAlpha_CurrMark ==? ""))
+    let b:sig_GotoByAlpha_CurrMark = l:line_marks[0][0]
+  endif
+
+  for i in range( 0, len(l:used_marks) - 1 )
+    if l:used_marks[i][0] ==# b:sig_GotoByAlpha_CurrMark
+      if a:dir ==? "next"
+        if (( i != len(l:used_marks)-1 ) || b:SignatureWrapJumps)
+          let b:sig_GotoByAlpha_CurrMark = l:used_marks[(i+1)%len(l:used_marks)][0]
+        endif
+      elseif a:dir ==? "prev"
+        if ((i != 0) || b:SignatureWrapJumps)
+          let b:sig_GotoByAlpha_CurrMark = l:used_marks[i-1][0]
+        endif
+      endif
+      return b:sig_GotoByAlpha_CurrMark
+    endif
+  endfor
+endfunction
+
+
+function! s:GotoByAlphaGlobal(dir)                                                                                " {{{2
+  " Description: Jump to next/prev Global mark in any buffer by alphabetical order.
+  "              Direction is specified as input argument
+
+  let l:used_marks = signature#mark#GetList('used', 'buf_all', 'global')
+  let l:line_marks = filter(copy(l:used_marks), 'v:val[1] == ' . line('.'))
+
+  " If there is only one mark in the current file, return it
+  if (len(l:used_marks) == 1)
+    return l:used_marks[0][0]
+  endif
+  " If current line does not have a global mark on it then return the first used global mark
+  if empty(l:line_marks)
+    if exists('b:sig_GotoByAlphaGlobal_CurrMark')
+      unlet b:sig_GotoByAlphaGlobal_CurrMark
+    endif
+    return l:used_marks[0][0]
+  endif
+
+  " Since we can place multiple marks on a line, to jump by alphabetical order we need to know what the current mark is.
+  " This information is kept in the b:sig_GotoByAlphaGlobal_CurrMark variable. For instance, if we have marks A, B & C
+  " on the current line and b:sig_GotoByAlphaGlobal_CurrMark has the value 'A' then we jump to 'B' and set the value of
+  " the variable to 'B'. Reinvoking this function will thus now jump to 'C'
+  if (  (len(l:line_marks) == 1)
+   \ || !exists('b:sig_GotoByAlpha_CurrMark')
+   \ || (b:sig_GotoByAlphaGlobal_CurrMark ==? "")
+   \ )
+    let b:sig_GotoByAlphaGlobal_CurrMark = l:line_marks[0][0]
+  endif
+
+  for i in range( 0, len(l:used_marks) - 1 )
+    if l:used_marks[i][0] ==# b:sig_GotoByAlphaGlobal_CurrMark
+      if a:dir ==? "next"
+        if (( i != len(l:used_marks)-1 ) || b:SignatureWrapJumps)
+          let b:sig_GotoByAlphaGlobal_CurrMark = l:used_marks[(i+1)%len(l:used_marks)][0]
+        endif
+      elseif a:dir ==? "prev"
+        if ((i != 0) || b:SignatureWrapJumps)
+          let b:sig_GotoByAlphaGlobal_CurrMark = l:used_marks[i-1][0]
+        endif
+      endif
+      return b:sig_GotoByAlphaGlobal_CurrMark
+    endif
+  endfor
+endfunction
+" }}}2
+
+
+""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
+"" Misc                                                                                                             {{{1
+"
+function! signature#mark#GetList(mode, scope, ...)                                                                " {{{2
+  " Description: Takes two optional arguments - mode/line no. and scope
+  "              If no arguments are specified, returns a list of [mark, line no.] pairs that are in use in the buffer
+  "              or are free to be placed in which case, line no. is 0
+  "
+  "   Arguments: mode   = 'used'     : Returns list of [ [used marks, line no., buf no.] ]
+  "                       'free'     : Returns list of [ free marks ]
+  "              scope  = 'buf_curr' : Limits scope to current buffer i.e used/free marks in current buffer
+  "                       'buf_all'  : Set scope to all buffers i.e used/free marks from all buffers
+  "              [type] = 'global'   : Return only global marks
+  "
+  "        NOTE: If type is specified as 'global', it will override and set scope to 'buf_all'.
+
+  let l:marks_list = []
+  let l:line_tot = line('$')
+  let l:buf_curr = bufnr('%')
+  let l:type     = (a:0 ? a:1 : "")
+
+  " Add local marks first
+  if (l:type !=? "global")
+    for i in filter(split(b:SignatureIncludeMarks, '\zs'), 'v:val =~# "[a-z]"')
+      let l:marks_list = add(l:marks_list, [i, line("'" .i), l:buf_curr])
+    endfor
+  endif
+  " Add global (uppercase) marks to list
+  for i in filter( split( b:SignatureIncludeMarks, '\zs' ), 'v:val =~# "[A-Z]"' )
+    let [ l:buf, l:line, l:col, l:off ] = getpos( "'" . i )
+    let l:marks_list = add(l:marks_list, [i, l:line, l:buf])
+  endfor
+
+  if (a:mode ==? 'used')
+    if (a:scope ==? 'buf_curr')
+      call filter( l:marks_list, '(v:val[2] == l:buf_curr) && (v:val[1] > 0)' )
+    else
+      call filter( l:marks_list, 'v:val[1] > 0' )
+    endif
+  else
+    if (a:scope ==? 'buf_all')
+      call filter( l:marks_list, 'v:val[1] == 0' )
+    else
+      " NOTE: This mode is not being used currently
+      call filter( l:marks_list, '(v:val[1] == 0) || (v:val[2] != l:buf_curr)' )
+    endif
+    call map( filter( l:marks_list, 'v:val[1] == 0' ), 'v:val[0]' )
+  endif
+
+  return l:marks_list
+endfunction
+
+
+function! signature#mark#ForceGlobalRemoval(mark)                                                                 " {{{2
+  " Description: Edit .viminfo file to forcibly delete Global mark since vim's handling is iffy
+  " Arguments:   mark - The mark to delete
+
+  if (  (a:mark !~# '[A-Z]')
+   \ || !g:SignatureForceRemoveGlobal
+   \ )
+    return
+  endif
+
+  let l:filename = expand($HOME . '/' . (has('unix') ? '.' : '_') . 'viminfo')
+  if (filewritable(l:filename) != 1)
+    echohl WarningMsg
+    echomsg "Signature: Unable to read/write .viminfo ('" . l:filename . "')"
+    echohl None
+    return
+  endif
+
+  let l:lines = readfile(l:filename, 'b')
+  call filter(l:lines, 'v:val !~ "^''' . a:mark. '"')
+  if has('win32')
+    " for some reason writefile(_viminfo) only works after editing directly
+    execute "noautocmd split " . l:filename
+    noautocmd write
+    noautocmd bdelete
+  endif
+  call writefile(l:lines, l:filename, 'b')
+endfunction
+
+
+function! s:ReportNoAvailableMarks()                                                                              " {{{2
+  if g:SignatureErrorIfNoAvailableMarks
+    echoe "Signature: No free marks left."
+  else
+    echohl WarningMsg
+    echomsg "Signature: No free marks left."
+    echohl None
+  endif
+endfunction
+
+
+function! signature#mark#List(scope)                                                                              " {{{2
+  " Description: Opens and populates location list with marks from current buffer
+  " Arguments:   scope = buf_curr : List marks from current buffer
+  "          ~~~FIXME~~~ buf_all  : List marks from all buffers
+
+  let l:list_map = map(signature#mark#GetList('used', a:scope),
+                   \   '{
+                   \     "bufnr": v:val[2],
+                   \     "lnum" : v:val[1],
+                   \     "col"  : col("' . "'" . '"  . v:val[0]),
+                   \     "type" : "m",
+                   \     "text" : v:val[0] . ": " . getline(v:val[1])
+                   \   }'
+                   \  )
+
+  if (a:scope ==? 'buf_curr')
+    call setloclist(0, l:list_map,)|lopen
+  "else
+  "  call setqflist(l:list_map,)|copen
+  endif
+
+  if !exists("g:signature_set_location_list_convenience_maps") || g:signature_set_location_list_convenience_maps
+    nnoremap <buffer> <silent> q        :q<CR>
+    noremap  <buffer> <silent> <ENTER>  <CR>:lcl<CR>
+  endif
+endfunction
+" }}}2
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.vim/plugin/signature/marker.vim	Fri Jun 19 11:15:57 2015 +0200
@@ -0,0 +1,153 @@
+" vim: fdm=marker:et:ts=4:sw=2:sts=2
+""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
+
+""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
+"" Place/Remove/Toggle                                                                                              {{{1
+"
+function! signature#marker#Toggle(marker)                                                                         " {{{2
+  " Description: Toggle marker on current line
+  " Arguments: marker [!@#$%^&*()]
+
+  let l:lnum = line('.')
+  " If marker is found on current line, remove it, else place it
+  if (  (get(b:sig_markers, l:lnum, "") =~# escape(a:marker, '$^'))
+   \ && !g:SignatureForceMarkerPlacement
+   \ )
+    call signature#sign#Remove(a:marker, l:lnum)
+    call signature#sign#ToggleDummy()
+  else
+    call signature#sign#Place(a:marker, l:lnum)
+  endif
+endfunction
+
+
+function! signature#marker#Remove(lnum, marker)                                                                   " {{{2
+  " Description: Remove marker from specified line number
+  " Arguments:   lnum - Line no. to delete marker from. If is 0, removes marker from current line
+  "              a:2  - Marker to delete. If not specified, obtains input from user
+
+  if (get(b:sig_markers, a:lnum, '') =~ a:marker)
+    call signature#sign#Remove(a:marker, a:lnum)
+  endif
+endfunction
+
+
+function! signature#marker#Purge(...)                                                                             " {{{2
+  " Description: If argument is given, removes marker only of the specified type else all markers are removed
+
+  if empty(b:sig_markers) | return | endif
+  if g:SignaturePurgeConfirmation
+    let choice = confirm('Are you sure you want to delete all markers? This cannot be undone.', '&Yes\n&No', 1)
+    if choice == 2 | return | endif
+  endif
+
+  if a:0 > 0
+    let l:markers = [ a:1 ]
+  else
+    let l:markers = split(b:SignatureIncludeMarkers, '\zs')
+  endif
+
+  for l:marker in l:markers
+    for l:lnum in keys(filter(copy(b:sig_markers), 'v:val =~# l:marker'))
+      call signature#marker#Remove(l:lnum, l:marker)
+    endfor
+  endfor
+  call signature#sign#ToggleDummy()
+endfunction
+
+
+""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
+"" Navigation                                                                                                       {{{1
+"
+function! signature#marker#Goto( dir, marker_num, count )                                                         " {{{2
+  " Description: Jump to next/prev marker by location.
+  " Arguments: dir    = next  : Jump forward
+  "                     prev  : Jump backward
+  "            marker = same  : Jump to a marker of the same type
+  "                     any   : Jump to a marker of any type
+  "                     [1-9] : Jump to the corresponding marker
+
+  let l:lnum = line('.')
+
+  let l:marker = ''
+  if (a:marker_num =~ '\v<[1-9]>')
+    let l:marker = split(b:SignatureIncludeMarkers, '\zs')[a:marker_num]
+  elseif (  (a:marker_num ==? 'same')
+       \ && has_key(b:sig_markers, l:lnum)
+       \ )
+    let l:marker = strpart(b:sig_markers[l:lnum], 0, 1)
+  endif
+
+  " Get list of line numbers of lines with markers.
+  " If current line has a marker, filter out line numbers of other markers ...
+  if (l:marker != '')
+    let l:marker_lnums = sort(keys(filter(copy(b:sig_markers),
+          \ 'strpart(v:val, 0, 1) == l:marker')), "signature#utils#NumericSort")
+  else
+    let l:marker_lnums = sort(keys(b:sig_markers), "signature#utils#NumericSort")
+  endif
+
+  if (a:dir ==? 'next')
+    let l:marker_lnums = filter(copy(l:marker_lnums), ' v:val >  l:lnum')
+                     \ + filter(copy(l:marker_lnums), '(v:val <= l:lnum) && b:SignatureWrapJumps')
+  elseif (a:dir ==? 'prev')
+    call reverse(l:marker_lnums)
+    let l:marker_lnums = filter(copy(l:marker_lnums), ' v:val <  l:lnum')
+                     \ + filter(copy(l:marker_lnums), '(v:val >= l:lnum) && b:SignatureWrapJumps')
+  endif
+
+  if (len(l:marker_lnums) == 0)
+    return
+  endif
+
+  let l:count = (a:count == 0 ? 1 : a:count)
+  if (b:SignatureWrapJumps)
+    let l:count = l:count % len(l:marker_lnums)
+  elseif (l:count > len(l:marker_lnums))
+    let l:count = 0
+  endif
+
+  let l:targ = l:marker_lnums[l:count - 1]
+  execute 'normal! ' . l:targ . 'G'
+endfunction
+
+
+""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
+"" Misc                                                                                                             {{{1
+"
+function! signature#marker#List(...)                                                                              " {{{2
+  " Description: Opens and populates location list with markers from current buffer
+  " Argument:    Show all markers in location list. If any particular marker is specified, list only that
+
+  " If a:1 == 0                    ==> No count was specified, list all markers
+  " If a:1 == ')'                  ==> List only the ')' marker
+  " If a:1 == [1-9] or '!@#$%^&*(' ==> List the corresponding marker
+  let l:marker = ''
+  if (a:0 != '')
+    let l:marker = a:1
+    if (l:marker =~ '^\d$')
+      let l:marker = (l:marker == 0 ? '' : split(')!@#$%^&*(', '\zs')[l:marker])
+    endif
+  endif
+  if (  (l:marker != '')
+   \ && (stridx(b:SignatureIncludeMarkers, l:marker) == -1)
+   \ )
+    return
+  endif
+
+  let l:list_map = map(
+                   \   sort(
+                   \     keys(l:marker != "" ? filter(copy(b:sig_markers), 'v:val == l:marker') : b:sig_markers),
+                   \     'signature#utils#NumericSort'
+                   \   ),
+                   \   '{
+                   \     "bufnr": ' . bufnr('%') . ',
+                   \     "lnum" : v:val,
+                   \     "col"  : 1,
+                   \     "type" : "M",
+                   \     "text" : b:sig_markers[v:val] . ": " . getline(v:val)
+                   \   }'
+                   \  )
+  call setloclist(0, l:list_map,)|lopen
+endfunction
+" }}}2
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.vim/plugin/signature/sign.vim	Fri Jun 19 11:15:57 2015 +0200
@@ -0,0 +1,289 @@
+" vim: fdm=marker:et:ts=4:sw=2:sts=2
+""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
+
+function! signature#sign#Place(sign, lnum)                                                                        " {{{1
+  " Description: Place signs for marks/markers on the specified line number
+  " Arguments:
+  "   sign : The mark/marker whose sign is to be placed
+  "   lnum : Line number on/from which the sign is to be placed/removed
+
+  "echom "DEBUG: sign = " . a:sign . ",  lnum = " . a:lnum
+
+  " If Signature is not enabled, return
+  if !b:sig_enabled | return | endif
+
+  " FIXME: Highly inefficient. Needs work
+  " Place sign only if there are no signs from other plugins (eg. syntastic)
+  "let l:present_signs = signature#sign#GetInfo(1)
+  "if (  b:SignatureDeferPlacement
+  " \ && has_key(l:present_signs, a:lnum)
+  " \ && (l:present_signs[a:lnum]['name'] !~# '^sig_Sign_')
+  " \ )
+  "  return
+  "endif
+
+  if stridx( b:SignatureIncludeMarkers, a:sign ) >= 0
+    let b:sig_markers[a:lnum] = a:sign . get(b:sig_markers, a:lnum, "")
+  else
+    let b:sig_marks[a:lnum] = a:sign . get(b:sig_marks, a:lnum, "")
+  endif
+  "}}}3
+
+  call signature#sign#RefreshLine(a:lnum)
+endfunction
+
+
+function! signature#sign#Remove(sign, lnum)                                                                       " {{{1
+  " Description: Remove signs for marks/markers from the specified line number
+  " Arguments:
+  "   sign : The mark/marker whose sign is to be placed/removed/toggled
+  "   lnum : Line number from which the sign is to be removed
+  "          If line number is 0, the 'sign' will be removed from all lines
+
+  "echom "DEBUG: sign = " . a:sign . ",  lnum = " . a:lnum
+
+  " If Signature is not enabled, return
+  if !b:sig_enabled | return | endif
+
+  " Remove sign for markers
+  if stridx( b:SignatureIncludeMarkers, a:sign ) >= 0
+    let b:sig_markers[a:lnum] = substitute(b:sig_markers[a:lnum], "\\C" . escape( a:sign, '$^' ), "", "")
+
+    " If there are no markers on the line, delete signs on that line
+    if b:sig_markers[a:lnum] == ""
+      call remove(b:sig_markers, a:lnum)
+    endif
+    call signature#sign#RefreshLine(a:lnum)
+
+  " Remove sign for marks
+  else
+    " If a:lnum == 0, remove from all lines
+    if a:lnum == 0
+      let l:arr = keys(filter(copy(b:sig_marks), 'v:val =~# a:sign'))
+      if empty(l:arr) | return | endif
+    else
+      let l:arr = [a:lnum]
+    endif
+
+    for l:lnum in l:arr
+      " FIXME: Placed guard to avoid triggering issue #53
+      if has_key(b:sig_marks, l:lnum)
+        let b:sig_marks[l:lnum] = substitute(b:sig_marks[l:lnum], "\\C" . a:sign, "", "")
+        " If there are no marks on the line, delete signs on that line
+        if b:sig_marks[l:lnum] == ""
+          call remove(b:sig_marks, l:lnum)
+        endif
+      endif
+      call signature#sign#RefreshLine(l:lnum)
+    endfor
+  endif
+endfunction
+
+
+function! signature#sign#RefreshLine(lnum)                                                                        " {{{1
+  " Description: Decides what the sign string should be based on if there are any marks or markers (using b:sig_marks
+  "              and b:sig_markers) on the current line and the value of b:SignaturePrioritizeMarks.
+  " Arguments:
+  "   lnum : Line number for which the sign string is to be modified
+
+  let l:id = a:lnum * 1000 + bufnr('%')
+
+  " Place the sign
+  if ( has_key(b:sig_marks, a:lnum)
+   \ && (  b:SignaturePrioritizeMarks
+   \    || !has_key(b:sig_markers, a:lnum)
+   \    )
+   \ )
+    let l:str = substitute(b:SignatureMarkOrder, "\m", strpart( b:sig_marks[a:lnum], 0, 1 ), "")
+    let l:str = substitute(l:str,                "\p", strpart( b:sig_marks[a:lnum], 1, 1 ), "")
+
+    " If g:SignatureMarkTextHL points to a function, call it and use its output as the highlight group.
+    " If it is a string, use it directly
+    let l:SignatureMarkLineHL = eval( g:SignatureMarkLineHL )
+    let l:SignatureMarkTextHL = eval( g:SignatureMarkTextHL )
+    execute 'sign define Signature_' . l:str . ' text=' . l:str . ' texthl=' . l:SignatureMarkTextHL . ' linehl=' . l:SignatureMarkLineHL
+
+  elseif has_key(b:sig_markers, a:lnum)
+    let l:str = strpart(b:sig_markers[a:lnum], 0, 1)
+
+    " If g:SignatureMarkerTextHL points to a function, call it and use its output as the highlight group.
+    " If it is a string, use it directly
+    let l:SignatureMarkerLineHL = eval( g:SignatureMarkerLineHL )
+    let l:SignatureMarkerTextHL = eval( g:SignatureMarkerTextHL )
+    execute 'sign define Signature_' . l:str . ' text=' . l:str . ' texthl=' . l:SignatureMarkerTextHL . ' linehl=' . l:SignatureMarkerLineHL
+
+  else
+    " FIXME: Clean-up. Undefine the sign
+    call signature#sign#Unplace(a:lnum)
+    return
+  endif
+  execute 'sign place ' . l:id . ' line=' . a:lnum . ' name=Signature_' . l:str . ' buffer=' . bufnr('%')
+
+  " If there is only 1 mark/marker in the file, place a dummy to prevent flickering of the gutter when it is moved
+  call signature#sign#ToggleDummy('place')
+endfunction
+
+
+function! signature#sign#Refresh(...)                                                                             " {{{1
+  " Description: Add signs for new marks/markers and remove signs for deleted marks/markers
+  " Arguments: '1' to force a sign refresh
+
+  call signature#utils#Init()
+  " If Signature is not enabled, return
+  if !b:sig_enabled | return | endif
+
+  for i in signature#mark#GetList('free', 'buf_curr')
+    " ... remove it
+    call signature#sign#Remove(i, 0)
+  endfor
+
+  " Add signs for marks ...
+  for j in signature#mark#GetList('used', 'buf_curr')
+    " ... if mark is not present in our b:sig_marks list or if it is present but at the wrong line,
+    " remove the old sign and add a new one
+    if !has_key(b:sig_marks, j[1]) || b:sig_marks[j[1]] !~# j[0] || a:0
+      call signature#sign#Remove(j[0], 0   )
+      call signature#sign#Place (j[0], j[1])
+    endif
+  endfor
+
+  " We do not add signs for markers as SignRefresh is executed periodically and we don't have a way to determine if the
+  " marker already has a sign or not
+endfunction
+
+
+function! signature#sign#Unplace(lnum)                                                                            " {{{1
+  " Description: Remove the sign from the specified line number
+  let l:id = a:lnum * 1000 + bufnr('%')
+  silent! execute 'sign unplace ' . l:id
+endfunction
+
+
+function! signature#sign#ToggleDummy(...)                                                                         " {{{1
+  " Description: Places a dummy sign to prevent flickering of the gutter when the mark is moved or the line containing
+  "              a mark/marker is deleted and then the delete is undone
+  " Arguments:   a:1 (place/remove) - Force mode
+
+  if (a:0)
+    let l:place  = (a:1 =~# 'place' )
+    let l:remove = (a:1 =~# 'remove')
+  else
+    let l:place  = (len(b:sig_marks) + len(b:sig_markers) == 1)
+    let l:remove = (len(b:sig_marks) + len(b:sig_markers) == 0)
+  endif
+
+  if (l:place)
+    sign define Signature_Dummy
+    execute 'sign place 666 line=1 name=Signature_Dummy buffer=' . bufnr('%')
+  elseif (l:remove)
+    silent! execute 'sign unplace 666 buffer=' . bufnr('%')
+  endif
+endfunction
+
+
+function! signature#sign#GetInfo(...)                                                                             " {{{1
+  " Description: Returns a dic of filenames, each of which is a dic of line numbers on which signs are placed
+  " Arguments: filename (optional).
+  "            If filename is provided, the return value will contain signs only present in the given file
+  " Eg. {
+  "       'vimrc': {
+  "         '711': {
+  "           'id': '1422',
+  "           'name': 'sig_Sign_1422'
+  "         },
+  "         '676': {
+  "           'id': '1352',
+  "           'name': 'sig_Sign_1352'
+  "         }
+  "       }
+  "     }
+
+  " Redirect the input to a variable
+  redir => l:sign_str
+  silent! sign place
+  redir END
+
+  " Create a Hash of files to store the info.
+  let l:signs_dic = {}
+  " The file that is currently being processed is stored into l:file
+  let l:match_file = ""
+  let l:file_found = 0
+
+  " Split the string into an array of sentences and filter out empty lines
+  for i in filter( split( l:sign_str, '\n' ), 'v:val =~ "^[S ]"' )
+    let l:temp_file = matchstr( i, '\v(Signs for )@<=\S+:@=' )
+
+    if l:temp_file != ""
+      let l:match_file = l:temp_file
+      let l:signs_dic[l:match_file] = {}
+    elseif l:match_file != ""
+      " Get sign info
+      let l:info_match = matchlist( i, '\vline\=(\d+)\s*id\=(\S+)\s*name\=(\S+)' )
+      if !empty( l:info_match )
+        let l:signs_dic[l:match_file][l:info_match[1]] = {
+              \ 'id'   : l:info_match[2],
+              \ 'name' : l:info_match[3],
+              \ }
+      endif
+    endif
+  endfor
+
+  if a:0
+    "" Search for the full path first in the hash ...
+    "let l:curr_filepath = expand('%:p')
+    "if has_key( l:signs_dic, l:curr_filepath )
+    "  return filter( l:signs_dic, 'v:key ==# l:curr_filepath' )[l:curr_filepath]
+    "else
+    " ... if no entry is found for the full path, search for the filename in the hash ...
+    " Since we're searching for the current file, if present in the hash, it'll be as a filename and not the full path
+    let l:curr_filename = expand('%:t')
+    if has_key( l:signs_dic, l:curr_filename )
+      return filter( l:signs_dic, 'v:key ==# l:curr_filename' )[l:curr_filename]
+    endif
+
+    " ... if nothing is found, then return an empty hash to indicate that no signs are present in the current file
+    return {}
+  endif
+
+  return l:signs_dic
+endfunction
+
+
+function! signature#sign#GetGitGutterHLGroup(lnum)
+  " Description: This returns the highlight group used by vim-gitgutter depending on how the line was edited
+
+  let l:line_state = filter(copy(gitgutter#diff#process_hunks(gitgutter#hunk#hunks())), 'v:val[0] == a:lnum')
+
+  if len(l:line_state) == 0
+    return 'Exception'
+  endif
+
+  if l:line_state[0][1] =~ 'added'
+    return 'GitGutterAdd'
+  elseif l:line_state[0][1] =~ 'modified'
+    return 'GitGutterChange'
+  elseif l:line_state[0][1] =~ 'removed'
+    return 'GitGutterDelete'
+  endif
+endfunction
+
+
+function! signature#sign#GetSignifyHLGroup(lnum)
+  " Description: This returns the highlight group used by vim-signify depending on how the line was edited
+  "              Thanks to @michaelmior
+
+  call sy#sign#get_current_signs()
+
+  if has_key(b:sy.internal, a:lnum)
+    let type = b:sy.internal[a:lnum]['type']
+    if type =~ 'SignifyAdd'
+      return 'DiffAdd'
+    elseif type =~ 'SignifyChange'
+      return 'DiffChange'
+    elseif type =~ 'SignifyDelete'
+      return 'DiffDelete'
+    end
+  else
+    return 'Exception'
+  endif
+endfunction
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.vim/plugin/signature/utils.vim	Fri Jun 19 11:15:57 2015 +0200
@@ -0,0 +1,95 @@
+" vim: fdm=marker:et:ts=4:sw=2:sts=2
+""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
+
+function! signature#utils#Init()                                                                                  " {{{1
+  " Description: Initialize variables
+
+  if !exists('b:sig_marks')
+    " b:sig_marks = { lnum => signs_str }
+    let b:sig_marks = {}
+  else
+    " Lines can be removed using an external tool. Hence, we need to filter out marks placed on line numbers that are
+    " now greater than the total number of lines in the file.
+    let l:line_tot = line('$')
+    call filter( b:sig_marks, 'v:key <= l:line_tot' )
+  endif
+
+  if !exists('b:sig_markers')
+    " b:sig_markers = { lnum => marker }
+    let b:sig_markers = {}
+  else
+    " Lines can be removed using an external tool. Hence, we need to filter out marks placed on line numbers that are
+    " now greater than the total number of lines in the file.
+    let l:line_tot = line('$')
+    call filter( b:sig_markers, 'v:key <= l:line_tot' )
+  endif
+
+  call signature#utils#Set('b:sig_enabled'             , g:SignatureEnabledAtStartup)
+  call signature#utils#Set('b:SignatureIncludeMarks'   , g:SignatureIncludeMarks    )
+  call signature#utils#Set('b:SignatureIncludeMarkers' , g:SignatureIncludeMarkers  )
+  call signature#utils#Set('b:SignatureMarkOrder'      , g:SignatureMarkOrder       )
+  call signature#utils#Set('b:SignaturePrioritizeMarks', g:SignaturePrioritizeMarks )
+  call signature#utils#Set('b:SignatureDeferPlacement' , g:SignatureDeferPlacement  )
+  call signature#utils#Set('b:SignatureWrapJumps'      , g:SignatureWrapJumps       )
+endfunction
+
+
+function! signature#utils#Set(var, default)                                                                       " {{{1
+  if !exists(a:var)
+    if type(a:default)
+      execute 'let' a:var '=' string(a:default)
+    else
+      execute 'let' a:var '=' a:default
+    endif
+  endif
+  return a:var
+endfunction
+
+
+function! signature#utils#NumericSort(x, y)                                                                       " {{{1
+  return a:x - a:y
+endfunction
+
+
+function! s:Map(mode, key, map_lhs_default, map_rhs)                                                              " {{{1
+  let l:map_lhs = get(g:SignatureMap, a:key, a:map_lhs_default)
+  if (l:map_lhs ==? '')
+    return
+  endif
+  if (a:mode ==? 'create')
+    silent! execute 'nnoremap <silent> <unique> ' . l:map_lhs . ' ' . ':<C-U>call signature#' . a:map_rhs . '<CR>'
+  elseif (a:mode ==? 'remove')
+    silent! execute 'nunmap ' . l:map_lhs
+  endif
+endfunction
+
+function! signature#utils#Maps(mode)                                                                              " {{{1
+  " We create separate mappings for PlaceNextMark, mark#Purge('all') and PurgeMarkers instead of combining it with
+  " Leader/Input as if the user chooses to use some weird key like <BS> or <CR> for any of these 3, we need to be able
+  " to identify it. Eg. the nr2char(getchar()) will fail if the user presses a <BS>
+  let s:SignatureMapLeader = get(g:SignatureMap, 'Leader', 'm')
+  if (s:SignatureMapLeader == "")
+    echoe "Signature: g:SignatureMap.Leader shouldn't be left blank"
+  endif
+  call s:Map(a:mode, 'Leader'           , s:SignatureMapLeader            , 'Input()'                             )
+  call s:Map(a:mode, 'PlaceNextMark'    , s:SignatureMapLeader . ","      , 'mark#Toggle("next")'                 )
+  call s:Map(a:mode, 'ToggleMarkAtLine' , s:SignatureMapLeader . "."      , 'mark#ToggleAtLine()'                 )
+  call s:Map(a:mode, 'PurgeMarksAtLine' , s:SignatureMapLeader . "-"      , 'mark#Purge("line")'                  )
+  call s:Map(a:mode, 'PurgeMarks'       , s:SignatureMapLeader . "<Space>", 'mark#Purge("all")'                   )
+  call s:Map(a:mode, 'PurgeMarkers'     , s:SignatureMapLeader . "<BS>"   , 'marker#Purge()'                      )
+  call s:Map(a:mode, 'DeleteMark'       , "dm"                            , 'Remove(v:count)'                     )
+  call s:Map(a:mode, 'GotoNextLineAlpha', "']"                            , 'mark#Goto("next", "line", "alpha")'  )
+  call s:Map(a:mode, 'GotoPrevLineAlpha', "'["                            , 'mark#Goto("prev", "line", "alpha")'  )
+  call s:Map(a:mode, 'GotoNextSpotAlpha', "`]"                            , 'mark#Goto("next", "spot", "alpha")'  )
+  call s:Map(a:mode, 'GotoPrevSpotAlpha', "`["                            , 'mark#Goto("prev", "spot", "alpha")'  )
+  call s:Map(a:mode, 'GotoNextLineByPos', "]'"                            , 'mark#Goto("next", "line", "pos")'    )
+  call s:Map(a:mode, 'GotoPrevLineByPos', "['"                            , 'mark#Goto("prev", "line", "pos")'    )
+  call s:Map(a:mode, 'GotoNextSpotByPos', "]`"                            , 'mark#Goto("next", "spot", "pos")'    )
+  call s:Map(a:mode, 'GotoPrevSpotByPos', "[`"                            , 'mark#Goto("prev", "spot", "pos")'    )
+  call s:Map(a:mode, 'GotoNextMarker'   , "]-"                            , 'marker#Goto("next", "same", v:count)')
+  call s:Map(a:mode, 'GotoPrevMarker'   , "[-"                            , 'marker#Goto("prev", "same", v:count)')
+  call s:Map(a:mode, 'GotoNextMarkerAny', "]="                            , 'marker#Goto("next", "any",  v:count)')
+  call s:Map(a:mode, 'GotoPrevMarkerAny', "[="                            , 'marker#Goto("prev", "any",  v:count)')
+  call s:Map(a:mode, 'ListLocalMarks'   , 'm/'                            , 'mark#List("buf_curr")'               )
+  call s:Map(a:mode, 'ListLocalMarkers' , 'm?'                            , 'marker#List()'                       )
+endfunction