sponsor Vim development Vim logo Vim Book Ad

sign-marks : Unlimited marks. Save/restore marks. Display marks quickfix/window. MarksConfig

 script karma  Rating 5/2, Downloaded by 1436  Comments, bugs, improvements  Vim wiki

created by
Javier Puigdevall
 
script type
utility
 
description
Sign-marks allows you to have unlimited marks by making use of the vim signs.

Sign-marks is a plugin to:
- Add signs with different levels.
- Display the marks and signs on a quickfix or new window
- Save and restore the marks and signs.
- Navigate the signs and marks.

This plugin is a perfect complement for plugin vim-signature (https://www.vim.org/scripts/script.php?script_id=4118)

I use sign-marks to
- Add signs to lines (:Sm or :Sma) on large logs.
- Remove signs (:Sm or Smd).
- Navigate the log sigsn/marks (:Smn/:Smp)
- Open a view window with all signs and marks (:Smw or SmW) or quickfix window (:Smq or :SmQ).
- Open a menu to choose the view (:Smv).
- Save the signs and marks to a config file (:Smsv) or restore them from file (:Sml)
- Save the marks and signs on the file itself as a config line on the bottom of the file (:Smcl).
- Synchronize main and view window (:Smg)
- Show signs resume on new window but filter signs by level (:Smw s1 s3 s10:s15 s30:)
- Show all signs and marks used on current vim session (:Smw a or :Smq a, :SmW a, SmQ a)
- Show all signs and marks used on current vim session filter by file name and sign level (:Smw s3:s14 a +cpp)

In case the file's highlighted using hi.vim plugin (https://www.vim.org/scripts/script.php?script_id=5887), the highlighting configuration is also aplied to the marks when opening them on a new window (:Smw) or quickfix window .(:Smq)

Mappings:
s+1 to s+0 to add/delete a sign on the current line or selected lines.
s+tab+1 to s+tab+5 to open the different view windows.
s+enter to switch between main and view window
s+del or s+supr to remove a sign on current or selected lines.

This last option I use it mainly when navigating code and I want to search one line a previously marked or just to understand the code viewing just the code snippets I need. Very handy when using it along with bookmarks.vim (https://www.vim.org/scripts/script.php?script_id=5956)

The doc is still pending meanwhile you can check :Smh for an abridged command help and examples:

Any feedback will be welcome.



ADVANCED:
Customizations you can add to your .vimrc file.

Overwrite maps s+1 to s+0 used on any other plugin.
let g:SignMarks_remapPrevMappings = "yes"

Remap s+0 to sign 24:
let g:SignMarks_userSignMappinsList  = []
let g:SignMarks_userSignMappinsList += [['s0', 24]]

Add new view command :Smwt, will show all marks and signs on new tab applying options:"FH1IMSU.fn.lf"
let g:SignMarks_userViewList  = []
let g:SignMarks_userViewList += [ ['' , "tabnew" , "marks&signs" , "FH1IMSU.fn.lf"  , "wt"] ]

Same as above but assign also map s+6 and add new command Smv6:
let g:SignMarks_userViewList  = []
let g:SignMarks_userViewList += [ [6 , "tabnew" , "marks&signs" , "FH1IMSU.fn.lf"  , "wt"] ]

You can see the new signs with command :Smv

Add new sign with symbol '=='
let g:SignMarks_userSignsList   = []
let g:SignMarks_userSignsList += [ ["==", "", ""] ]

Add new sign with symbol '=>', use sign highlighing: Error, and content highlighting: ErrorMsg
let g:SignMarks_userSignsList += [ ["=>", "Error", "ErrorMsg"] ]

You can see the new signs with command :Smsh



 
install details
Minimum version: Vim 7.0+
Recomended version: Vim 8.0+

Install vimball:
download signmarks.vmb
vim signmarks.vmb
:so %
:q
 

rate this script Life Changing Helpful Unfulfilling 
script versions (upload new version)

Click on the package to download.

package script version date Vim version user release notes
signmarks_0.3.1.vmb 0.3.1 2022-07-08 7.0 Javier Puigdevall - Fix: gvim menu issues.
- New: command Smclw to save current signs and marks replacing any
  existant config line and save the file, all without user confirmation.
- New: (On commands Sm, Sma, Smo, Smd) when only one sign changed, show a
  one line message only.
- New: Smqf2f by default shows only signs and marks on current window
  unless options A or W used.
- New: option W for function signmarks#OpenView.
- Fix: remove <unique> from all mappings.
- New: add mapping s++ for :Sma
- New: add mapping s+- and s+supr for :Smd
signmarks_0.3.0.vmb 0.3.0 2021-11-30 7.0 Javier Puigdevall - NEW: change plugin name from marksConfig.vim to signmarks.vim.
- NEW: change all 'Mk...' commands to 'Sm...'.
- New: commands :Smc, SmC, Smo, Smv 1, Smg (map+enter).
- New: when no level selected on Smsa and Sm commands show menu to choose the sign level.
marksConfig_0.2.0.vmb 0.2.0 2021-11-11 7.0 Javier Puigdevall - New: mapping m+0 to m+9 to add sign with different level.
- New: mapping m+tab+1 to m+tab+5 to open a view.
- New: option "a" to show all windows's signs on the view window.
- New: option "sN", "sN:M", to filter signs on view window by level.
- New: option "+pattern", "-pattern", to filter files on view window.
- New: option "M" to replicate all marks on view window.
- New: option "I" to replicate all signs on view window.
- New: option "_" to switch to another view window.
- New: command :Mkqf2f to dump all marks and signs to file in quickfix format.
- New: command :Mkg, mapping m+enter to switch to same line on main window.
- Change: all Mkm... commands to Mks
- Change: Mks commands to Mkcl and all Mkm... commands to Mks... (Mks, Mksa, Mksd, MksD).
marksConfig_0.1.1.vmb 0.1.1 2021-10-15 7.0 Javier Puigdevall - New: complete refactoring of function OpenInWindow.
- New: allow to add user options on commands: Mkw, MkW, MkQ and Mkq.
- New: commands Mkqo and Mkwo for user to set all options.
- New: option 'help', to show the available options on OpenInWindow function.
- New: option T, for OpenInWindow function's to preserve line indentation on
  quickfix window when the marks/sings names are not displayed.
- New global variables to configure sign's character and highlight:
  g:MarksConfig_signCharacater and g:MarksConfig_signHighlight.
marksConfig_0.1.0.vmb 0.1.0 2021-10-05 7.0 Javier Puigdevall - New unnamed marks concept usign vim signs, unnamed marks only exist on the plugin.
  They allow to extend marks behind the 25 letters allowed from vim Marks.
- New Mkm, Mkma and Mkmd, MkmD to add/delete unnamed marks.
- New Mkn and Mkp to navigate the marks, goto line previous/next
- Link with hi.vim plugin, allow to colorize the buffer window containing all marks
  Apply the colors on the main window to the split with marks opened with Mkw
- Set config line default position at end of the file.
marksConfig_0.0.1.vmb 0.0.1 2021-09-30 7.0 Javier Puigdevall Initial upload
ip used for rating: 216.73.216.103

Questions about Vim should go to the maillist. Help Uganda.     Vim at Github