Skip to content

Commit

Permalink
Scaffolding.
Browse files Browse the repository at this point in the history
  • Loading branch information
rexagod committed Aug 31, 2021
0 parents commit 22bb050
Show file tree
Hide file tree
Showing 5 changed files with 410 additions and 0 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
test
25 changes: 25 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
BSD 2-Clause License

Copyright (c) 2021, Pranshu Srivastava
All rights reserved.

Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:

1. Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.

2. Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
69 changes: 69 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
# `samwise.nvim`

## Introduction

<!-- markdownlint-disable-next-line MD034 -->
https://user-images.githubusercontent.com/33557095/131362110-c5f1075e-3569-42c8-9c54-5905364caa34.mp4

`samwise` is a line-wise note-taking plugin for neovim that aims to provide a
better note-taking enviroment by employing vim's concepts. It allows you to
take notes in a different buffer (each samwise buffer is unique to its parent
buffer) which is created automatically based on the current buffer's path and
the current buffer's name.

If the current line in the buffer does not have a corresponding `<EOL>`
character as the only content in the samwise buffer, the user is dropped to
the corresponding line, and the samwise buffer scrolls sychronously with its
parent buffer and vice versa. Users can make changes, or add new text entries
for any line of the parent buffer in this manner and even commit those besides
the parent buffer, as a "comment file" so as to not populate the parent buffer
with extraneous comments and keep the codebase cleaner in general. This is just
one of the many use cases where samwise can help.

It also allows highlighting hunks which correspond to the samwise buffer
entries, navigating between them, and seeing those entries either in a floating
window, or by echoing them.

**To make it explicity clear, from this point on, a "samwise buffer" will mean the
autogenerated buffer that stores all the line-wise notes corresponding to its
companion buffer (or how I call it, it's Frodo).**

## Configuration

### Globals

- `g:samwise_buffer_opts`: Options for opening the samwise buffers. Defaults to:
`"bo " . winheight(0)/10 . "sp"`.
- `g:samwise_dir`: Directory that stores all samwise buffers.
- `g:samwise_echo`: Set to a truthy value to echo samwise buffers' corresponding
contents.
- `g:samwise_float`: Set to a truthy value to show samwise buffers'
corresponding contents in a floating window.
- `g:samwise_floating_opts`: Options for opening the samwise floating windows.
Defaults to:

```vim
" Refer `nvim_open_win` for more details.
let g:samwise_floating_opts = {
\ ...
\ 'relative': 'cursor',
\ 'focusable': v:false,
\ 'style': 'minimal',
\ 'border': 'shadow',
\ 'noautocmd': v:true
\ }
```

- `g:samwise_format`: Extension that the samwise buffers should default to.

### Commands

- `:SamwiseMoveBack`: Move to the previous samwise hunk; suggested binding, `[S`.
- `:SamwiseMoveFwd`: Move to the next samwise hunk; suggested binding, `]S`.
- `:SamwiseToggleBuffer`: Open or close the samwise buffer to add or review notes.
- `:SamwiseToggleHighlight`: Highlight all lines in the current buffer that have
corresponding non-empty lines in the samwise buffer.

## License

[BSD-2-Clause](https://opensource.org/licenses/BSD-2-Clause)
73 changes: 73 additions & 0 deletions doc/samwise.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
*samwise.txt* Line-wise notes for neovim.

Author : Pranshu Srivastava <rexagod@gmail.com>
License : BSD-2-Clause License
English <https://opensource.org/licenses/BSD-2-Clause>

*samwise*

==============================================================================
INDEX *samwise-index*

INTRODUCTION |samwise-introduction|
COMMANDS |samwise-commands|
CONFIGURATION |samwise-configuration|

==============================================================================
INTRODUCTION *samwise-introduction*

|samwise| is a line-wise note-taking plugin for neovim that aims to provide a
better note-taking enviroment by employing vim's concepts. It allows you to
take notes in a different buffer (each samwise buffer is unique to its parent
buffer) which is created automatically based on the current buffer's path and
the current buffer's name.

If the current line in the buffer does not have a corresponding <EOL>
character as the only content in the samwise buffer, the user is dropped to
the corresponding line, and the samwise buffer scrolls sychronously with its
parent buffer and vice versa. Users can make changes, or add new text entries
for any line of the parent buffer in this manner and even commit those besides
the parent buffer, as a "comment file" so as to not populate the parent buffer
with extraneous comments and keep the codebase cleaner in general. This is just
one of the many use cases where |samwise| can help.

It also allows highlighting hunks which correspond to the samwise buffer
entries, navigating between them, and seeing those entries either in a floating
window, or by echoing them.
==============================================================================
CONFIGURATION *samwise-configuration*

*g:samwise_dir* Directory that stores all the samwise
buffers.
*g:samwise_format* Extension that the samwise buffers
should default to.
*g:samwise_buffer_opts* Options for opening the samwise
buffers. Defaults to:
`"bo " . winheight(0)/10 . "sp"`

*g:samwise_floating_opts* Options for opening the samwise
floating windows. Defaults to: >
let g:samwise_floating_opts = {
\ ...
\ 'relative': 'cursor',
\ 'focusable': v:false,
\ 'style': 'minimal',
\ 'border': 'shadow',
\ 'noautocmd': v:true
\ }
*g:samwise_echo* Set to a truthy value to echo samwise
buffers corresponding contents.
*g:samwise_float* Set to a truthy value to echo samwise
buffers corresponding contents.
==============================================================================
COMMANDS *samwise-commands*

*:SamwiseMoveBack* Move to the previous samwise hunk.
*:SamwiseMoveFwd* Move to the next samwise hunk.
*:SamwiseToggleBuffer* Open or close the samwise buffer to
add or review notes.
*:SamwiseToggleHighlight* Highlight all lines in the current
buffer that have corresponding non-
empty lines in the samwise buffer.
==============================================================================
vim:tw=78:ts=8:ft=help:norl:
Loading

0 comments on commit 22bb050

Please sign in to comment.