From d754e506fdfb10688d721935c01d2615d11b2a12 Mon Sep 17 00:00:00 2001 From: Tom Ryder Date: Wed, 19 Jun 2019 22:35:51 +1200 Subject: First version --- README.md | 19 +++++++++++++++++++ VERSION | 1 + autoload/paste_insert.vim | 12 ++++++++++++ doc/paste_insert.txt | 36 ++++++++++++++++++++++++++++++++++++ plugin/paste_insert.vim | 8 ++++++++ 5 files changed, 76 insertions(+) create mode 100644 README.md create mode 100644 VERSION create mode 100644 autoload/paste_insert.vim create mode 100644 doc/paste_insert.txt create mode 100644 plugin/paste_insert.vim diff --git a/README.md b/README.md new file mode 100644 index 0000000..cd8cef2 --- /dev/null +++ b/README.md @@ -0,0 +1,19 @@ +paste\_insert.vim +================= + +This small plugin provides a simple "one shot paste" method, with a command or +mapping to prefix opening an insert, with the `'paste'` option automatically +set after the insert ends, to avoid the annoyances caused by forgetting to do +so. + +It includes a timeout if insert mode isn't entered within `'updatetime'` +seconds, or if the user navigates away from the buffer or window. It can also +be cancelled with CTRL-C in normal mode. + +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/VERSION b/VERSION new file mode 100644 index 0000000..6e8bf73 --- /dev/null +++ b/VERSION @@ -0,0 +1 @@ +0.1.0 diff --git a/autoload/paste_insert.vim b/autoload/paste_insert.vim new file mode 100644 index 0000000..675fa5a --- /dev/null +++ b/autoload/paste_insert.vim @@ -0,0 +1,12 @@ +function! paste_insert#() abort + augroup paste_insert + autocmd! + autocmd CursorHold,CursorMoved,User * + \ set nopaste paste? + \|autocmd! paste_insert + autocmd InsertEnter * + \ autocmd paste_insert InsertLeave * + \ doautocmd paste_insert User + augroup END + set paste paste? +endfunction diff --git a/doc/paste_insert.txt b/doc/paste_insert.txt new file mode 100644 index 0000000..9b63079 --- /dev/null +++ b/doc/paste_insert.txt @@ -0,0 +1,36 @@ +*paste_insert.txt* For Vim version 7.0 Last change: 2019 Jun 19 + +DESCRIPTION *paste_insert* + +This small plugin provides a simple "one shot paste" method, with a command or +mapping to prefix opening an insert, with the 'paste' option automatically set +after the insert ends, to avoid the annoyances caused by forgetting to do so. + +It includes a timeout if insert mode isn't entered within 'updatetime' +seconds, or if the user navigates away from the buffer or window. It can also +be cancelled with CTRL-C in normal mode. + +REQUIREMENTS *paste_insert-requirements* + +This plugin only loads if 'compatible' is not set. + +COMMANDS *paste_insert-commands* + + *:PasteInsert* +Enter the `:PasteInsert` command just before entering insert mode to set up +the relevant hooks. It takes neither range prefix nor arguments. + +MAPPINGS *paste_insert-mappings* + + *(PasteInsert)* +The `(PasteInsert)` map in normal mode just does `:PasteInsert`. + +AUTHOR *paste_insert-author* + +Written and maintained by Tom Ryder . + +LICENSE *paste_insert-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/paste_insert.vim b/plugin/paste_insert.vim new file mode 100644 index 0000000..2c17f80 --- /dev/null +++ b/plugin/paste_insert.vim @@ -0,0 +1,8 @@ +if exists('loaded_paste_insert') || &compatible + finish +endif +let loaded_paste_insert = 1 +command! -bar PasteInsert + \ call paste_insert#() +nnoremap PasteInsert + \ :PasteInsert -- cgit v1.2.3