Skip to content
Browse files

Initial

  • Loading branch information...
0 parents commit efc3bed081307339de82a1e630b6ea4782fd338a Tom Link committed Apr 5, 2010
Showing with 239 additions and 0 deletions.
  1. +13 −0 README
  2. +107 −0 autoload/tmarks.vim
  3. +62 −0 doc/tmarks.txt
  4. +57 −0 plugin/tmarks.vim
13 README
@@ -0,0 +1,13 @@
+TMarks:
+Browse & manipulate marks
+
+
+Status:
+Not in use (extracted from vimtlib)
+I'd suggest to use wokmarks instead.
+
+
+Install:
+See http://github.com/tomtom/vimtlib/blob/master/INSTALL.TXT
+
+
107 autoload/tmarks.vim
@@ -0,0 +1,107 @@
+" tmarks.vim
+" @Author: Tom Link (mailto:micathom AT gmail com?subject=[vim])
+" @Website: http://www.vim.org/account/profile.php?user_id=4037
+" @License: GPL (see http://www.gnu.org/licenses/gpl.txt)
+" @Created: 2009-03-29.
+" @Last Change: 2010-01-17.
+" @Revision: 0.0.28
+
+let s:save_cpo = &cpo
+set cpo&vim
+" call tlog#Log('Load: '. expand('<sfile>')) " vimtlib-sfile
+
+
+if !exists('g:tmarks_handlers') "{{{2
+ let g:tmarks_handlers = [
+ \ {'key': 4, 'agent': 'tmarks#AgentDeleteMark', 'key_name': '<c-d>', 'help': 'Delete mark'},
+ \ ]
+ " \ {'pick_last_item': 0},
+endif
+
+
+function! tmarks#AgentDeleteMark(world, selected) "{{{3
+ for l in a:selected
+ call s:DelMark(s:GetMark(l))
+ endfor
+ let a:world.base = s:GetList()
+ let a:world.state = 'display'
+ return a:world
+endf
+
+
+function! s:DelMark(m) "{{{3
+ exec 'delmarks '. escape(a:m, '"\')
+endf
+
+
+function! s:GetList() "{{{3
+ return tlib#cmd#OutputAsList('marks')[1:-1]
+endf
+
+
+function! s:GetLocalList() "{{{3
+ let local_marks = s:GetList()
+ call filter(local_marks, 'v:val =~ '' \l ''')
+ return local_marks
+endf
+
+
+function! s:GetMark(line) "{{{3
+ return matchstr(a:line, '^ \+\zs\S')
+endf
+
+
+function! tmarks#List() "{{{3
+ keepjumps let m = tlib#input#List('s', 'Marks', s:GetList(), g:tmarks_handlers)
+ if !empty(m)
+ exec 'norm! `'. s:GetMark(m)
+ endif
+endf
+
+
+" " Use wokmarks instead:
+"
+" " Delete all (lower-case) marks at the specified line.
+" " :display: tmarks#DeleteInRange(?line1=line('.'), ?line2=line('.'))
+" function! tmarks#DeleteInRange(...) "{{{3
+" TVarArg ['line1', line('.')], ['line2', line('.')]
+" let local_marks = s:GetLocalList()
+" call filter(local_marks, 'matchstr(v:val, ''\l \+\zs\d\+'') >= line1 && matchstr(v:val, ''\l \+\zs\d\+'') <= line2')
+" for mark in local_marks
+" call s:DelMark(s:GetMark(mark))
+" endfor
+" endf
+"
+"
+" " Delete all (lower-case) marks for the current buffer.
+" function! tmarks#DeleteAllMarks() "{{{3
+" let local_marks = s:GetLocalList()
+" for mark in local_marks
+" call s:DelMark(s:GetMark(mark))
+" endfor
+" endf
+"
+"
+" let s:local_marks = split('abcdefghijklmnopqrstuvwxyz', '\zs')
+"
+" function! tmarks#PlaceNextMarkAtLine(...) "{{{3
+" TVarArg ['line', line('.')]
+" let local_marks = s:GetLocalList()
+" let i = 0
+" for mark in local_marks
+" let this = s:GetMark(mark)
+" let that = s:local_marks[i]
+" if this !=# that
+" exec line .'mark '. that
+" return
+" endif
+" let i += 1
+" endfor
+" echohl Error
+" echom 'TMarks: No mark available'
+" echohl None
+" endf
+
+
+let &cpo = s:save_cpo
+unlet s:save_cpo
62 doc/tmarks.txt
@@ -0,0 +1,62 @@
+*tmarks.txt* Browse & manipulate marks
+ Author: Tom Link, micathom at gmail com
+
+This plugin provides commands to browse and to manipulate (place &
+delete) marks.
+
+Features:
+ - Browse marks
+ - Delete all (lower-case) marks in the current buffer
+ - Delete all (lower-case) marks in a range
+ - Set the next available (lower-case) mark at a specified line
+
+
+Key maps in the list view:
+ <c-d> ... Delete mark
+ <cr> ... Jump to mark
+
+
+-----------------------------------------------------------------------
+Install~
+
+Edit the vba file and type: >
+
+ :so %
+
+See :help vimball for details. If you have difficulties or use vim 7.0,
+please make sure, you have the current version of vimball
+(vimscript #1502) installed or update your runtime.
+
+This script requires tlib (vimscript #1863) to be installed.
+
+Also available via git: http://github.com/tomtom/vimtlib/
+
+
+========================================================================
+Contents~
+
+ :TMarks .................. |:TMarks|
+ tmarks#AgentDeleteMark ... |tmarks#AgentDeleteMark()|
+ tmarks#List .............. |tmarks#List()|
+
+
+========================================================================
+plugin/tmarks.vim~
+
+ *:TMarks*
+:TMarks
+ Browse all marks.
+
+
+========================================================================
+autoload/tmarks.vim~
+
+ *tmarks#AgentDeleteMark()*
+tmarks#AgentDeleteMark(world, selected)
+
+ *tmarks#List()*
+tmarks#List()
+
+
+
+vim:tw=78:fo=tcq2:isk=!-~,^*,^|,^":ts=8:ft=help:norl:
57 plugin/tmarks.vim
@@ -0,0 +1,57 @@
+" tmarks.vim -- Browse & manipulate marks
+" @Author: Tom Link (mailto:micathom AT gmail com?subject=[vim])
+" @Website: http://www.vim.org/account/profile.php?user_id=4037
+" @License: GPL (see http://www.gnu.org/licenses/gpl.txt)
+" @Created: 2007-08-23.
+" @Last Change: 2010-01-17.
+" @Revision: 0.0.54
+" GetLatestVimScripts: <+SCRIPTID+> 1 tmarks.vim
+
+if &cp || exists("loaded_tmarks")
+ finish
+endif
+if !exists('g:loaded_tlib') || g:loaded_tlib < 11
+ runtime plugin/02tlib.vim
+ if !exists('g:loaded_tlib') || g:loaded_tlib < 11
+ echoerr 'tlib >= 0.11 is required'
+ finish
+ endif
+endif
+let loaded_tmarks = 2
+let s:save_cpo = &cpo
+set cpo&vim
+
+
+" Browse all marks.
+command! -bar TMarks call tmarks#List()
+
+
+" " Use wokmarks instead:
+" "
+" " Place the next available a-z mark at the specified line.
+" " :display: :{range}TMarksPlace
+" command! -range -nargs=? -bar TMarksPlace call tmarks#PlaceNextMarkAtLine(<line1>)
+"
+" " Delete all a-z marks in range.
+" " :display: :{range}TMarksDelete
+" command! -range -nargs=? -bar TMarksDelete call tmarks#DeleteInRange(<line1>, <line2>)
+"
+" " Delete all a-z marks in the current buffer.
+" command! -bar TMarksDeleteAll call tmarks#DeleteAllMarks()
+
+
+let &cpo = s:save_cpo
+unlet s:save_cpo
+
+
+finish
+
+0.1
+Initial release
+
+0.2
+- Moved the definition of some variables from plugin/tmarks.vim to
+autoload/tmarks.vim
+- Removed some commands & related functions (there are better plugins for
+that): TMarksPlace, TMarksDelete, TMarksDeleteAll
+

0 comments on commit efc3bed

Please sign in to comment.
Something went wrong with that request. Please try again.