├── .gitignore ├── doc └── showmarks.txt └── plugin └── showmarks.vim /.gitignore: -------------------------------------------------------------------------------- 1 | /doc/tags 2 | -------------------------------------------------------------------------------- /doc/showmarks.txt: -------------------------------------------------------------------------------- 1 | *showmarks.txt* Visually show the location of marks 2 | 3 | By Anthony Kruize 4 | Michael Geddes 5 | 6 | 7 | ShowMarks provides a visual representation of |marks| local to a buffer. 8 | Marks are useful for jumping back and forth between interesting points in a 9 | buffer, but can be hard to keep track of without any way to see where you have 10 | placed them. 11 | 12 | ShowMarks hopefully makes life easier by placing a |sign| in the 13 | leftmost column of the buffer. The sign indicates the label of the mark and 14 | its location. 15 | 16 | ShowMarks is activated by the |CursorHold| |autocommand| which is triggered 17 | every |updatetime| milliseconds. This is set to 4000(4 seconds) by default. 18 | If this is too slow, setting it to a lower value will make it more responsive. 19 | 20 | Note: This plugin requires Vim 6.x compiled with the |+signs| feature. 21 | 22 | =============================================================================== 23 | 1. Contents *showmarks* *showmarks-contents* 24 | 25 | 1. Contents |showmarks-contents| 26 | 2. Configuration |showmarks-configuration| 27 | 3. Highlighting |showmarks-highlighting| 28 | 4. Key mappings |showmarks-mappings| 29 | 5. Commands |showmarks-commands| 30 | 6. ChangeLog |showmarks-changelog| 31 | 32 | Appendix 33 | A. Using marks |marks| 34 | B. Using signs |sign| 35 | C. Defining updatetime |updatetime| 36 | D. Defining a mapleader |mapleader| 37 | E. Defining highlighting |highlight| 38 | 39 | =============================================================================== 40 | 2. Configuration *showmarks-configuration* 41 | 42 | ShowMarks can be configured to suit your needs. 43 | The following options can be added to your |vimrc| to change how ShowMarks 44 | behaves: 45 | 46 | *'showmarks_enable'* 47 | 'showmarks_enable' boolean (default: 1) 48 | global 49 | This option enables or disables ShowMarks on startup. Normally ShowMarks 50 | will be enabled when Vim starts, setting this to 0 will disable ShowMarks 51 | by default. 52 | ShowMarks can be turned back on using the |ShowMarksToggle| command. 53 | 54 | *'showmarks_include'* 55 | 'showmarks_include' string (default: 56 | "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789.'`^<>[]{}()\"") 57 | global or local to buffer 58 | This option specifies which marks will be shown and in which order if 59 | placed on the same line. Marks earlier in the list take precedence over 60 | marks later in the list. 61 | This option can also be specified as a buffer option which will override 62 | the global version. 63 | 64 | NOTE: When including the " mark, it must be escaped with a \. 65 | 66 | For example to only include marks 'abcdefzxABHJio', in that order: 67 | > 68 | let g:showmarks_include="abcdefzxABJio" 69 | < 70 | To override this for a particular buffer with 'ABCDhj.'^': 71 | > 72 | let b:showmarks_include="abcdefzxABJio" 73 | < 74 | *'showmarks_ignore_type'* 75 | 'showmarks_ignore_type' string (default: "hq") 76 | global 77 | This option defines which types of buffers should be ignored. 78 | Each type is represented by a letter. This option is not case-sensitive. 79 | Valid buffer types are: 80 | - h : Help 81 | - m : Non-modifiable 82 | - p : Preview 83 | - q : Quickfix 84 | - r : Readonly 85 | 86 | For example to ignore help, preview and readonly files: 87 | > 88 | let g:showmarks_ignore_type="hpr" 89 | < 90 | *'showmarks_ignore_name'* 91 | 'showmarks_textlower' string (default: ">" ) 92 | global 93 | This option defines how the marks a-z will be displayed. 94 | A maximum of two characters can be defined. 95 | To include the mark in the text use a tab(\t) character. A single 96 | character will display as the mark with the character suffixed (same as 97 | "\t"). Specifying two characters will simply display those two 98 | characters. 99 | 100 | Some examples: 101 | To display the mark with a > suffixed: > 102 | let g:showmarks_textlower="\t>" 103 | < or > 104 | let g:showmarks_textlower=">" 105 | < 106 | To display the mark with a ( prefixed: > 107 | let g:showmarks_textlower="(\t" 108 | < 109 | To display two > characters: > 110 | let g:showmarks_textlower=">>" 111 | < 112 | *'showmarks_textupper'* 113 | 'showmarks_textupper' string (default: ">") 114 | global 115 | This option defines how the marks A-Z will be displayed. It behaves the same 116 | as the |'showmarks_textlower'| option. 117 | 118 | *'showmarks_textother'* 119 | 'showmarks_textother' string (default: ">") 120 | global 121 | This option defines how all other marks will be displayed. It behaves the 122 | same as the |'showmarks_textlower'| option. 123 | 124 | 'showmarks_hlline_lower' boolean (default: 0) *'showmarks_hlline_lower'* 125 | global 126 | This option defines whether the entire line a lowercase mark is on will 127 | be highlighted. 128 | 129 | 'showmarks_hlline_upper' boolean (default: 0) *'showmarks_hlline_upper'* 130 | global 131 | This option defines whether the entire line an uppercase mark is on will 132 | be highlighted. 133 | 134 | 'showmarks_hlline_other' boolean (default: 0) *'showmarks_hlline_other'* 135 | global 136 | This option defines whether the entire line other marks are on will be 137 | highlighted. 138 | 139 | =============================================================================== 140 | 3. Highlighting *showmarks-highlighting* 141 | 142 | Four highlighting groups are used by ShowMarks to define the colours used to 143 | highlight each of the marks. 144 | 145 | - ShowMarksHLl : This group is used to highlight all the lowercase marks. 146 | - ShowMarksHLu : This group is used to highlight all the uppercase marks. 147 | - ShowMarksHLo : This group is used to highlight all other marks. 148 | - ShowMarksHLm : This group is used when multiple marks are on the same line. 149 | 150 | You can define your own highlighting by overriding these groups in your |vimrc|. 151 | For example: > 152 | 153 | highlight ShowMarksHLl guifg=red guibg=green 154 | < 155 | Will set all lowercase marks to be red on green when running in GVim. 156 | See |highlight| for more information. 157 | 158 | =============================================================================== 159 | 4. Mappings *showmarks-mappings* 160 | 161 | The following mappings are setup by default: 162 | 163 | mt - Toggles ShowMarks on and off. 164 | mo - Forces ShowMarks on. 165 | mh - Clears the mark at the current line. 166 | ma - Clears all marks in the current buffer. 167 | mm - Places the next available mark on the current line. 168 | 169 | (see |mapleader| for how to setup the mapleader variable.) 170 | 171 | =============================================================================== 172 | 5. Commands *showmarks-commands* 173 | 174 | *ShowMarksToggle* 175 | :ShowMarksToggle 176 | This command will toggle the display of marks on or off. 177 | 178 | 179 | :ShowMarksOn *ShowMarksOn* 180 | This command will force the display of marks on. 181 | 182 | *ShowMarksClearMark* 183 | :ShowMarksClearMark 184 | This command will clear the mark on the current line. 185 | It doesn't actually remove the mark, it simply moves it to line 1 and 186 | removes the sign. 187 | 188 | *ShowMarksClearAll* 189 | :ShowMarksClearAll 190 | This command will clear all marks in the current buffer. 191 | It doesn't actually remove the marks, it simply moves them to line 1 and 192 | removes the signs. 193 | 194 | *ShowMarksPlaceMark* 195 | :ShowMarksPlaceMark 196 | This command will place the next available mark on the current line. This 197 | effectively automates mark placement so you don't have to remember which 198 | marks are placed or not. Hidden marks are considered to be available. 199 | NOTE: Only marks a-z are supported by this function. 200 | 201 | =============================================================================== 202 | 6. ChangeLog *showmarks-changelog* 203 | 204 | 2.2 - 2004-08-17 205 | Fixed highlighting of the A-Z marks when ignorecase is on. (Mike Kelly) 206 | Fixed the delay with ShowMarks triggering when entering a buffer for the 207 | first time. (Mikolaj Machowski) 208 | Added support for highlighting the entire line where a mark is placed. 209 | Now uses HelpExtractor by Charles E. Campbell to install the help file. 210 | 211 | 2.1 - 2004-03-04 212 | Added ShowMarksOn. It forces ShowMarks to be enabled whether it's on or not. 213 | (Gary Holloway) 214 | Marks now have a definable order of precedence for when mulitple alpha marks 215 | have been placed on the same line. A new highlight group, ShowMarksHLm is 216 | used to identify this situation. (Gary Holloway) 217 | - showmarks_include has changed accordingly. 218 | - ShowMarksHL is now ShowMarksHLl. 219 | ShowMarksPlaceMark now places marks in the order specified by 220 | showmarks_include. (Gary Holloway) 221 | showmarks_include can now be specified per buffer. (Gary Holloway) 222 | 223 | 2.0 - 2003-08-11 224 | Added ability to ignore buffers by type. 225 | Fixed toggling ShowMarks off when switching buffers. 226 | ShowMarksHideMark and ShowMarksHideAll have been renamed to 227 | ShowMarksClearMark and ShowMarksClearAll. 228 | Marks a-z, A-Z and others now have different highlighting from each other. 229 | Added support for all other marks. (Gary Holloway) 230 | Enhanced customization of how marks are displayed by allowing a prefix to 231 | be specified.(Gary Holloway & Anthony Kruize) 232 | Fixed CursorHold autocmd triggering even when ShowMarks is disabled. 233 | (Charles E. Campbell) 234 | 235 | 1.5 - 2002-07-16 236 | Added ability to customize how the marks are displayed. 237 | 238 | 1.4 - 2002-05-29 239 | Added support for placing the next available mark. 240 | (Thanks to Shishir Ramam for the idea) 241 | Added support for hiding all marks. 242 | Marks on line 1 are no longer shown. This stops hidden marks from 243 | reappearing when the file is opened again. 244 | Added a help file. 245 | 246 | 1.3 - 2002-05-20 247 | Fixed toggling ShowMarks not responding immediately. 248 | Added user commands for toggling/hiding marks. 249 | Added ability to disable ShowMarks by default. 250 | 251 | 1.2 - 2002-03-06 252 | Added a check that Vim was compiled with +signs support. 253 | Added the ability to define which marks are shown. 254 | Removed debugging code that was accidently left in. 255 | 256 | 1.1 - 2002-02-05 257 | Added support for the A-Z marks. 258 | Fixed sign staying placed if the line it was on is deleted. 259 | Clear autocommands before making new ones. 260 | 261 | 1.0 - 2001-11-20 262 | First release. 263 | 264 | vim:tw=78:ts=8:ft=help 265 | -------------------------------------------------------------------------------- /plugin/showmarks.vim: -------------------------------------------------------------------------------- 1 | " ============================================================================== 2 | " Name: ShowMarks 3 | " Description: Visually displays the location of marks. 4 | " Authors: Anthony Kruize 5 | " Michael Geddes 6 | " Version: 2.2 7 | " Modified: 17 August 2004 8 | " License: Released into the public domain. 9 | " ChangeLog: See :help showmarks-changelog 10 | " 11 | " Usage: Copy this file into the plugins directory so it will be 12 | " automatically sourced. 13 | " 14 | " Default keymappings are: 15 | " mt - Toggles ShowMarks on and off. 16 | " mo - Turns ShowMarks on, and displays marks. 17 | " mh - Clears a mark. 18 | " ma - Clears all marks. 19 | " mm - Places the next available mark. 20 | " 21 | " Hiding a mark doesn't actually remove it, it simply moves it 22 | " to line 1 and hides it visually. 23 | " 24 | " Configuration: *********************************************************** 25 | " * PLEASE read the included help file(showmarks.txt) for a * 26 | " * more thorough explanation of how to use ShowMarks. * 27 | " *********************************************************** 28 | " The following options can be used to customize the behavior 29 | " of ShowMarks. Simply include them in your vimrc file with 30 | " the desired settings. 31 | " 32 | " showmarks_enable (Default: 1) 33 | " Defines whether ShowMarks is enabled by default. 34 | " Example: let g:showmarks_enable=0 35 | " showmarks_include (Default: "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789.'`^<>[]{}()\"") 36 | " Defines all marks, in precedence order (only the highest 37 | " precence will show on lines having more than one mark). 38 | " Can be buffer-specific (set b:showmarks_include) 39 | " showmarks_ignore_type (Default: "hq") 40 | " Defines the buffer types to be ignored. 41 | " Valid types are: 42 | " h - Help p - preview 43 | " q - quickfix r - readonly 44 | " m - non-modifiable 45 | " showmarks_textlower (Default: ">") 46 | " Defines how the mark is to be displayed. 47 | " A maximum of two characters can be displayed. To include 48 | " the mark in the text use a tab(\t) character. A single 49 | " character will display as the mark with the character 50 | " suffixed (same as "\t") 51 | " Examples: 52 | " To display the mark with a > suffixed: 53 | " let g:showmarks_textlower="\t>" 54 | " or 55 | " let g:showmarks_textlower=">" 56 | " To display the mark with a ( prefixed: 57 | " let g:showmarks_textlower="(\t" 58 | " To display two > characters: 59 | " let g:showmarks_textlower=">>" 60 | " showmarks_textupper (Default: ">") 61 | " Same as above but for the marks A-Z. 62 | " Example: let g:showmarks_textupper="**" 63 | " showmarks_textother (Default: ">") 64 | " Same as above but for all other marks. 65 | " Example: let g:showmarks_textother="--" 66 | " showmarks_hlline_lower (Default: 0) 67 | " showmarks_hlline_upper (Default: 0) 68 | " showmarks_hlline_other (Default: 0) 69 | " Defines whether the entire line for a particular mark 70 | " should be highlighted. 71 | " Example: let g:showmarks_hlline_lower=1 72 | " 73 | " Setting Highlighting Colours 74 | " ShowMarks uses the following highlighting groups: 75 | " ShowMarksHLl - For marks a-z 76 | " ShowMarksHLu - For marks A-Z 77 | " ShowMarksHLo - For all other marks 78 | " ShowMarksHLm - For multiple marks on the same line. 79 | " (Highest precendece mark is shown) 80 | " 81 | " By default they are set to a bold blue on light blue. 82 | " Defining a highlight for each of these groups will 83 | " override the default highlighting. 84 | " See the VIM help for more information about highlighting. 85 | " ============================================================================== 86 | 87 | " Check if we should continue loading 88 | if exists( "loaded_showmarks" ) 89 | finish 90 | endif 91 | let loaded_showmarks = 1 92 | 93 | " Bail if Vim isn't compiled with signs support. 94 | if has( "signs" ) == 0 95 | echohl ErrorMsg 96 | echo "ShowMarks requires Vim to have +signs support." 97 | echohl None 98 | finish 99 | endif 100 | 101 | " Options: Set up some nice defaults 102 | if !exists('g:showmarks_enable' ) | let g:showmarks_enable = 1 | endif 103 | if !exists('g:showmarks_textlower' ) | let g:showmarks_textlower = ">" | endif 104 | if !exists('g:showmarks_textupper' ) | let g:showmarks_textupper = ">" | endif 105 | if !exists('g:showmarks_textother' ) | let g:showmarks_textother = ">" | endif 106 | if !exists('g:showmarks_ignore_type' ) | let g:showmarks_ignore_type = "hq" | endif 107 | if !exists('g:showmarks_ignore_name' ) | let g:showmarks_ignore_name = "" | endif 108 | if !exists('g:showmarks_hlline_lower') | let g:showmarks_hlline_lower = "0" | endif 109 | if !exists('g:showmarks_hlline_upper') | let g:showmarks_hlline_upper = "0" | endif 110 | if !exists('g:showmarks_hlline_other') | let g:showmarks_hlline_other = "0" | endif 111 | 112 | " This is the default, and used in ShowMarksSetup to set up info for any 113 | " possible mark (not just those specified in the possibly user-supplied list 114 | " of marks to show -- it can be changed on-the-fly). 115 | let s:all_marks = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789.'`^<>[]{}()\"" 116 | 117 | " Commands 118 | com! -nargs=0 ShowMarksToggle :call ShowMarksToggle() 119 | com! -nargs=0 ShowMarksOn :call ShowMarksOn() 120 | com! -nargs=0 ShowMarksClearMark :call ShowMarksClearMark() 121 | com! -nargs=0 ShowMarksClearAll :call ShowMarksClearAll() 122 | com! -nargs=0 ShowMarksPlaceMark :call ShowMarksPlaceMark() 123 | 124 | " Mappings (NOTE: Leave the '|'s immediately following the '' so the mapping does not contain any trailing spaces!) 125 | if !hasmapto( 'ShowmarksShowMarksToggle' ) | map mt :ShowMarksToggle| endif 126 | if !hasmapto( 'ShowmarksShowMarksOn' ) | map mo :ShowMarksOn| endif 127 | if !hasmapto( 'ShowmarksClearMark' ) | map mh :ShowMarksClearMark| endif 128 | if !hasmapto( 'ShowmarksClearAll' ) | map ma :ShowMarksClearAll| endif 129 | if !hasmapto( 'ShowmarksPlaceMark' ) | map mm :ShowMarksPlaceMark| endif 130 | noremap