From 6c107a31ace12fb2fac9cb41c4aac20d632e67dc Mon Sep 17 00:00:00 2001 From: Tom Ryder Date: Mon, 3 Jun 2019 22:46:23 +1200 Subject: Add comments and documentation --- README.md | 14 ++++++++++++++ doc/keep_position.txt | 28 ++++++++++++++++++++++++++++ plugin/keep_position.vim | 13 +++++++++++++ 3 files changed, 55 insertions(+) create mode 100644 README.md create mode 100644 doc/keep_position.txt diff --git a/README.md b/README.md new file mode 100644 index 0000000..26b5d86 --- /dev/null +++ b/README.md @@ -0,0 +1,14 @@ +keep\_position.vim +================== + +This tiny plugin provides a command prefix to run commands without moving the +cursor or window view around. It does this by saving the window view before +running the command, and then restoring it afterwards. + +License +------- + +Copyright (c) [Tom Ryder][1]. Distributed under the same terms as Vim itself. +See `:help license`. + +[1]: https://sanctum.geek.nz/ diff --git a/doc/keep_position.txt b/doc/keep_position.txt new file mode 100644 index 0000000..6f1d516 --- /dev/null +++ b/doc/keep_position.txt @@ -0,0 +1,28 @@ +*keep_position.txt* For Vim version 7.0 Last change: 2019 Jun 3 + +DESCRIPTION *keep_position* + +This tiny plugin provides a command prefix to run commands without moving the +cursor or window view around. It does this by saving the window view before +running the command, and then restoring it afterwards. + +REQUIREMENTS *keep_position-requirements* + +This plugin only loads if 'compatible' is not set. It also requires the +|+user_commands| feature. + +COMMANDS *keep_position-commands* + + *:KeepPosition* +Run the given command while preserving the cursor position and window view. +Works rather like |:keepalt| or |:keepjumps|. + +AUTHOR *keep_position-author* + +Written and maintained by Tom Ryder . + +LICENSE *keep_position-license* + +Licensed for distribution under the same terms as Vim itself (see |license|). + + vim:tw=78:ts=8:ft=help:norl: diff --git a/plugin/keep_position.vim b/plugin/keep_position.vim index 06a23ec..1389bcf 100644 --- a/plugin/keep_position.vim +++ b/plugin/keep_position.vim @@ -1,2 +1,15 @@ +" +" keep_position.vim: User command wrapper to preserve cursor position and +" buffer view. +" +" Author: Tom Ryder +" License: Same as Vim itself +" +if exists('loaded_keep_position') || &compatible || v:version < 700 + finish +endif +let loaded_keep_position = 1 + +" User command definition refers to autoloaded function command! -nargs=+ -complete=command KeepPosition \ call keep_position#() -- cgit v1.2.3