Commit Graph

19 Commits

Author SHA1 Message Date
e61af8773b Merge pull request 'v0.1.0 (alpha)' (#1) from experimental into main
Reviewed-on: TheOnePath/presser.nvim#1
2023-01-13 17:19:10 +00:00
f841a23dde Updated context_manager/init.lua 2023-01-13 17:18:56 +00:00
0d458544e0 Moved presser/ -> lua/presser/
Created new director lua/ and moved presser/ into the subdirectory.
This is to align with other standard developments of Neovim extensions.
2023-01-13 17:18:56 +00:00
657d3f2ae6 Added streamer.lua
Steamers are akin to that of Telescope's Pickers. A "steamer" is the
class structure used by builtins to create new windows/buffers for the
user to interact with. This code was simply migrated across from
presser@new and refactored to adopt a class-like OOP paradigm.

steamers@new is a wrapper function accessed by builtins to invoke the
class constructor Steamers@new. Allows to greater control and
flexibility of window/buffer options.
2023-01-13 17:18:56 +00:00
139e87b8e1 Added presser/builtins
Module is responsible for implementing a lazy-loader for any new tool
which is defined in table@modules. This function makes use of a
lazy-loading strategy (needs citation).
2023-01-13 17:18:56 +00:00
9fdc02deb4 Added builtins/__modules.lua
Script defines all tools available by presser.nvim, which are
lazy-loaded and executed when called by the user.

Function presser@find_replace has undergone major refactorisation:
	- Keymaps have been updated to respect new codebase structure.
	- A new OOP implementation is being experimented for constructing
	  windows, giving future flexibility. Consult presser/steamers.lua.
	- Function now calls the class@streamers and invokes the
	  streamers@new() method. This constructs the windows/buffers which
	  was originally done via call to presser@new().
	- This function is NOT directly accessed, but via proxy
	  table@builtins which lazy-loads function.

Any new tools which are created for presser are to be defined in this
file and lazy-loaded. Module may be renamed in future for theming
consistency.
2023-01-13 17:18:56 +00:00
b22ec2e733 Added new actions module
All functions originally defined in presser/init.lua and part of
table@presser which were related to performing a specific action,
have be migrated to this file.

Function definitions have remained the same
	- presser@start_buffer has been renamed
	  actions@buf_put_cursor_at() to allow for more generic
	  use-cases which the function name did not imply. Call this
	  function to place the cursor into any buffer in the GCM by its
	  label name.
2023-01-13 17:18:56 +00:00
adf5b94d78 Refactored main init.lua file
File has undergone refactor to reduce overall expected responsibility
which was temporary for kickstarting the extension.

The presser/init.lua script will now, and only now, be responsible for
handling and setting up configuration of presser itself (extensibility
to be concluded in future). Now, the script defines presser@setup()
which is to be called by a user in their Neovim config script. This
function currently defines one user command which allows for executing
the builtins@find_replace.

Most functions which were defined in table@presser have been migrated to
a new location presser/actions, defined in table@actions.

The function definition presser@find_replace has been migrated to
presser.builtins (in builtins@find_replace).

Consult other commits related to migrations for more info about specific
refactors.
2023-01-13 17:18:56 +00:00
865bb41609 Upated context_manager
Added a getter function to return the current state of the global
context manager.
2023-01-13 17:18:56 +00:00
18f7e1d9bb Moved to presser subdirectory 2023-01-13 17:18:56 +00:00
c498210a2f Updated presser/utils.lua
Updated M@clean_buf. If the type is not string or is nil, return empty string.
2023-01-13 17:18:56 +00:00
d96c5b2028 Updated presser/init.lua
File has been moved to subdirectory.
Note: TBR = To Be Refactored/Restructured.

- changed `ctx` to `gcm` as import for context manager module.
	- gcm/GCM = global context manager
	- all associations with this variable have been updated
	  respectfully.
- func@new is no longer responsible for creating a new context in the
  GCM. This is now handled per built-in.
	- call to gcm@update now respects newly modified GCM structure.
- Added presser@move_next_buffer:
	- temporary function to experiment moving between buffers which
	  are marked as `allowed = true` in the GCM.
	- TBR.
- Added func@read_buffer:
	- reads the contents of all buffers in the GCM.
	- returns a table storing all collected buffer contents.
	- TBR.
- Added presser@execute:
	- temporary function which calls func@read_buffer and performs a
	  vim substitute as per the built-in presser@find_replace.
	 - TBR.
- Added func@start_buffer:
	- place the cursor in an initial buffer by name.
	- TBR. Should be func@put_cursor_in_buf (or similar).
- Updated keymap to store more keys for experimenting.
- Calculate the centre of the current window height (should check for
  split windows in future, or determine terminal size).
- Changed ordering of window creation. Windows created in order they are
  rendered.
2023-01-13 17:18:56 +00:00
4049e5c2d0 Updated context_manager/init.lua
- Added diagram for global context manager (GCM) structure.
- Removed local func@get_ctx_head (unused).
- Updated func@M.update:
	- function takes 2 parameter arguments (see docstring).
	- constructs new record for the given context in the GCM to keep
	  record of a newly constructed window buffer.
	- function updates the GCM with the new record.
- Updated func@M.flush:
	- handles for new structure of records in the GCM.
	- see docstring for info.
2023-01-13 17:18:56 +00:00
3724426d33 Renamed modules
Files were moved from top-level space into presser sub-directory.
2023-01-13 17:18:56 +00:00
543c72a2f4 Added context manager module
Added a context manager for handling and managing windows/buffers
constructed by built-ins. This was handled by the `new()` function in
presser/init.lua but is now a dedicated module.
2023-01-13 17:18:56 +00:00
a8473e20c1
Added README.md 2023-01-09 10:43:07 +00:00
5f6839ca43
Updated init.lua
Script has been refactor and now easily allows for the creation of new
windows/buffers upon function call. Tracking windows/buffers previously
was invalid and lead to visual glitches of buffers. Windows/buffers now
belong to a context manager found within Vim's global scope, due to ease
of accessibility.

Created function `new()` which is responsible for constructing new
windows/buffers, updating the global context manager of newly added
windows/buffers, and allowing for customisation given by plenary.popup.
2023-01-08 22:31:34 +00:00
9472a7b969
Added utils.lua
File is not used extensively at current development; however, usage in
the future is to be considered.

Provide utility functions to aid built-in functions. Greater usage to be
made in future development.
2023-01-08 22:29:33 +00:00
ceb8576281
Added init.lua
First initial commit of file as a backup to refactor.
2023-01-08 12:35:11 +00:00