Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/flatcap/vim-scratch
⚙ Vim Plugin - Create a temporary workspace
https://github.com/flatcap/vim-scratch
file plugin script temporary vim
Last synced: about 6 hours ago
JSON representation
⚙ Vim Plugin - Create a temporary workspace
- Host: GitHub
- URL: https://github.com/flatcap/vim-scratch
- Owner: flatcap
- License: other
- Created: 2015-05-16T14:10:30.000Z (over 9 years ago)
- Default Branch: main
- Last Pushed: 2022-06-12T19:25:20.000Z (over 2 years ago)
- Last Synced: 2024-05-02T02:16:53.139Z (7 months ago)
- Topics: file, plugin, script, temporary, vim
- Language: Vim script
- Homepage:
- Size: 18.6 KB
- Stars: 2
- Watchers: 4
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE.md
Awesome Lists containing this project
README
# scratch.vim
Create a temporary workspace.
## Introduction
Sometimes it's useful to create a scratchpad in Vim -- a temporary buffer where you can work on some data, then throw it away.
Vim-Scratch simply creates a new buffer which has no filename, no swapfile, no buffer listing and no lifespan.
The moment you close the window the information is lost.## Workflow
Vim-Scratch allows you to manipulate data without cluttering the undo-history of the document.
A typical workflow might be:
1. I need a list of files in my document
2. Create a temporary workspace
3. List some files: `:r! ls -l directory`
4. Perform some Vim magic to tidy the listing
5. Copy the data: `:%y`
6. Close the temporary workspace: `:q`
7. Paste the data: `p`## Saving
If you change your mind and want to save the data, then `:write` or `:saveas`.
Vim will do the Right Thing™.```viml
:w new-filename.txt:sav another-file.txt
```A Vim `autocmd` automatically changes the settings to make the buffer into a normal file.
## Mappings
By default, Vim-Scratch has three <Plug> mappings for you to use:
```viml
ScratchHorizontal
ScratchVertical
ScratchTab
```To use them add a line to your `.vimrc`
e.g.```viml
nmap ScratchHorizontal
nmap ScratchVertical
nmap ScratchTabnmap sh ScratchHorizontal
nmap sv ScratchVertical
nmap st ScratchTab
```Alternatively, you can call the plugin from a script:
```viml
" Create Horizontal split
call scratch#CreateBuffer(0)" Create Vertical split
call scratch#CreateBuffer(1)" Create Tab
call scratch#CreateBuffer(2)
```## Configuration
This plugin has no configurable parts.
## License
Copyright © Richard Russon (flatcap).
Distributed under the GPLv3## See also
- [flatcap.org](https://flatcap.org)
- [GitHub](https://github.com/flatcap/vim-scratch)