Git Product home page Git Product logo

st-history-vim's Introduction

st-history / st-vim-browse

History patch for suckless' simple terminal (st), which

  1. Maintains two distinct cursor positions for inserting new content and viewing old content.
  2. Keeps the interface to the line buffer unchanged, and hence is supposed to yield less merge conflicts
  3. Separates the history logic and the scroll-back implementation in different patches, allowing to use the patch with a custom / more sophisticated scroll-back logic (like the vim browse patch).

This patch can be used in combination with the st-vim-browse patch, which is a sophisticated scroll-back patch operating on top of the history functionality and is also developed in this repository. The vim patch provides >50 vim-like motions & operators and a search & info overlay. Documentation on how this patch is used can be found:

  1. in the source code of normalMode.c: function kpressHist() -> executeMotion(),
  2. in the Wiki, or
  3. at the Suckless release page.

Patches

In this repository I develop the following separate patches on corresponding branches

  1. historyVanilla: essential history patch which provides logic and utility functionality for moving through the terminal history.
  2. patch_scrollback: simple bindings which allows the user to use the historyVanilla patch.
  3. patch_sel rewrites the selection routine, allowing for a selection larger than the currently displayed chunk of the buffer.
  4. patch_column: when shrinking the width of the window, invisible content is kept instead of removed, such that it becomes visible when the width is increased again.
  5. patch_repaint visualizes new line-repaint-events via a distinct color in a color column. This comes in handy when debugging / developing a custom scroll-back functionality.
  6. patch_vim: offers vim-like motions for moving through the history, yanking text and searching.

Assembling the latest patches

The script release.sh on branch master / tool assembles the latest versions of all patches and provides them in a newly created patches directory. It generates (1) a raw patch for each branch, and (2) meta-patches for useful combinations of the patches provided above.

./release.sh 1 1

The patches are released on this release page and on the suckless page.

Build the vim patch

The patches can be applied to st's source and build code via

patch < [PATCH_NAME]
make

after removing/adapting an existing config.h to contain the changes shipped in the config.def.h.

The pre-patched current version of the full vim patch with a reasonable configuration and some additional patches can be tried out in this repository, in which this patches are also ported to new releases of st, and released.

On the history buffer implementation

The interface to the buffer term.line is kept unchanged and points to a chunk inside a history round-buffer; changes are hence limited only to very few functions. When inspecting history or scrolling down, the position of the chunk is changed. Therefore, functions which operate in the history buffer are 'annotated' to trigger a history Operation. The vanilla history patch provides utility function for conveniently moving through history.

st-history-vim's People

Contributors

aaptel avatar agonrex avatar avih avatar bennofs avatar blackbit42 avatar brandoninvergo avatar colona avatar djpohly avatar electronicru avatar ericpruitt avatar esjeon avatar frign avatar garbeam avatar hiltjo avatar jceb avatar juliushuelsmann avatar k0gamsx avatar lotheac avatar medgar123 avatar michaelforney avatar mihailzenkov avatar mvdan avatar osandov avatar pickfire avatar pilona avatar radare avatar schachmat avatar suiginsoft avatar v4hn avatar wengxt avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Forkers

druckdev

st-history-vim's Issues

Feature: switch ALT_SCREEN in history mode

Add a motion that toggles ALT_SCREEN when in history mode.

  1. Toggle on button press
  2. Avoid painting / repaint issues when swapping back and forth in historyOperationStart
  3. Switch back to the correct screen mode when exiting history Mode

Feature: Paste search string

Paste search string from clipboard; best by being sensitive to modifiers and 'fallthrough' to configured paste configuration. This could also enable yanking from current selection (without involving the clipboard).

Bug: speed issue on output

There seems to be a speed issue with this history patch when scrolling. If the selection patch is applied. This is probably caused by the historyOpToggle being executed on scroll.

segment fault when applied on top of st-clipboard patch

Not sure if this is the right place to report error about the st "vim browse" patch, I found link of this repo on the web page of that patch.

After I apply the "vim browse" patch on top of the clipboard patch, which adds just one line to st's source code. I get a segment fault error from st.

Step to reproduce:

  1. checkout st at commit 9ba7ecf
  2. apply the vim browse patch, I tried the 2 versions based on commit 9ba7ecf listed on the patch web page, they all have the same problem:
    1. st-vimBrowse-20200607-9ba7ecf.diff
    2. st-vimBrowse-latestRelease-9ba7ecf.diff
  3. apply the clipboard patch
  4. build and run st
  5. select something with the left button of mouse
  6. wait 3-4 seconds

Now st segment faults.

I'm using latest archlinux, btw

Patch bugs neatvi

More info here:
aligrudi/neatvi#16

This is due to possibly how the history is handled in tresize() but definitely regression is there.
For now I will refrain from using this.

*tested with upstream clean neatvi build & clean st build + st-vimBrowse-latestRelease-9ba7ecf.diff

CRASH: 0001-feat-create-column-patch-equivalent-for-unpatched-st

A few months ago you posted a patch on https://github.com/juliusHuelsmann/st-history-vim/releases/tmpColDraft/ called 0001-feat-create-column-patch-equivalent-for-unpatched-st.patch to fix columns disappearing on resizing. The good news is that it works when ST size is changed when the new size is very different from before (it doesn't work fine with small resizes), the bad new is that when you change the size multiple times and tries to back to the normal one, it crashes with seg fault. Now, I know that this patch was meant only for a small help in a thread in Reddit, but I'm asking sincerely for help here, the seg fault happens in the following line in the tresize function:

//    		tclearregion(mincol, 0, col - 1, minrow - 1);
	  tclearregion(pmc, 0, col - 1, minrow - 1);

I tried looking at your official path here, but it's so different that trying to apply the same changes without applying the full history-vim patch is impossible for me. I tried really a lot of things, but it just seems that anything that is not the mincol of the terminal will eventually crashes.

Looking at the tclearregion doesn't seem to help a lot for me, of course I know it clears the terminal, so the size that we want is the pmc variable to be used; anything else is kinda useless for the changes applied from the rest of the patch.

Thanks in advance.

how to user vw instead vE

hi,sir:
when i select xxx_xxx_xxx , need press vE,the vw slect xxx only. how to config use vw select all xxx_xxx_xxx?
Thranks ,Brs.

Feature: Actions like `i` and `d` for mutable text

If currently in a mutable chunk of text, use "i" in order to apply the historyPosition to the insertPosition, and continue inserting there.
Use motions like "c" and "d" within the mutable chunk.

While the implementation of "c" and "d" and extensions like ci{ diw is straight-forward if it is possible to edit the current mutable chunk of text, the issue might be that the theoretically mutable chunk of text cannot be altered, is only available in a different scope or possibly not available at all.
If it's not doable in 10 loc it's probably not worth it.

How to change cursor color when in vim normal mode

How to change cursor color when in vim normal mode, when cursor move to a search string, can`t find the cursor. Is there a way to config cursor fg and bg, Keep the same color regardless of the cursor's col and row.

Screencast.2024-03-29.13.14.22.mp4

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.