Package: viewtext-curses
viewtext-cviewtext-cis a text file viewer written in Python that runs in the terminal.CompatibilityAt presentviewtext-conly runs on macOS.
It requires python3.10+.Installation and Useviewtext-cshould be installed in a virtual environment.How to Create, Use and Destroy a Virtual Environmentpython -m venv .venv         // Create the virtual environment '.venv'
source .venv/bin/activate    // Enter .venv
(.venv) ...                  // While in the virtual environment, your prompt will be prefixed with '(.venv)'
(.venv) deactivate           // Exit .venv
rm -rf .venv                 // Destroy .venvHow to Install and Uninstallviewtext-c(.venv) python -m pip   install viewtext-curses  // Install
(.venv) python -m pip uninstall viewtext-curses  // UninstallUse(.venv) viewtext-c [OPTIONS] filenameOptions:--tab-widthn-- Width of displayed tabs (Default: 2)--themetheme-- The startup theme (Default: the last used theme)Featuresviewtext-cdivides the screen into thestatus bar(the last line on the screen) and thedisplay area(everything else).The status bar is for error messages and feedback on what you're doing.The display area is tiled withpanes.
A pane is a window into a file.
Each pane has acaptionat the bottom displaying the name of the file and the pane's current position in the file.
Above the caption is thetext area.
At any time exactly one pane (thecurrent pane) has thefocusand the other pane captions are grayed out.
You operate on one pane at a time, usually the current pane.You can do the following in the current pane:A move operation (scroll up, down, left or right, or jump to the beginning or end of the file)Split into two panes, either horizontally or verticallyDelete the paneMaximize the pane, deleting all the othersShrink the pane to fit its file (if the file is small)Open a new fileIncremental search for a string (case sensitive, no wildcards or regular expressions.  There is currently no case-insensitive search)Searches are orthogonal to other operations, particularly moves: you can move around in the pane without disturbing the current search.You can perform multiple searches at once in the same pane by suspending a search and initiating another.
The new search must be completed before resuming the previous one,iethe searches are on a stack.
If you switch focus away from a pane, the current search is suspended and resumes when the focus returns.If two panes are open to the same file, matches will be visible in both panes, but only the pane that initiated the search will be able to extend it.
Searches are tied to panes, not to files.Pane OrderPanes are ordered.
The exact ordering is a result of the order in which the panes were created (iesplit).
Split panes are ordered top to bottom and left to right.
This is to make the behavior of certain operations likenext-pane,previous-paneanddelete-panepredictable, but it's not important and in general you don't need to be concerned with it.KeybindingsAll of these operations act on the current pane.
Some of the bindings may not work on some terminals and terminal emulators, or there may be alternate bindings (likeShiftinstead ofFn).Note:C-denotesControl-, as inC-x(Control-x) etc.
Bindings in square brackets are optional.If you run into trouble or want to back out of an operation, useC-g.Generalq-- Exit the programC-g-- Abort the current operation and return to where you were previouslyC-c-- Complete panic.  Abort the programC-u n-- Specify a numerical argumentnto the following command (either a move or a split)=-- Show the size of the current paneMove operationsBindings to move around the screen, and bindings related to searching, are terminal-dependent and are listed in the table below.
If you don't know what terminal you are running, the first table ('Terminal') is the default.Move operations may be preceded by an argument (C-un), which acts as a multiplier.
For example,C-u -4 →will shift 4 columns to the left.
Ifnis omitted, it defaults to 4.Mac OS Terminal↓↑→←TABENTERLine ↓Line ↑Column →Column ←Next MatchNext MatchShiftLine ↓Line ↑Shift →Shift ←Prev MatchNext MatchFnPage ↓Page ↑End of FileBeg of FileNext MatchPrev MatchMac OS iTerm↓↑→←TABENTERLine ↓Line ↑Column →Column ←Next MatchNext MatchShift1/3 Page ↓1/3 Page ↑Shift →Shift ←Prev MatchNext MatchFnPage ↓Page ↑End of FileBeg of FileNext MatchIllegalMac OS Alacritty↓↑→←TABENTERLine ↓Line ↑Column →Column ←Next MatchNext MatchShift1/3 Page ↓1/3 Page ↑Shift →Shift ←Prev MatchNext MatchFnNo-opNo-opEnd of FileBeg of FileNext MatchNext MatchMac OS Tabby↓↑→←TABENTERLine ↓Line ↑Column →Column ←Next MatchNext MatchShift1/3 Page ↓1/3 Page ↑Shift →Shift ←Prev MatchNext MatchFnPage ↓Page ↑End of FileBeg of FileNext MatchNext MatchMac OS Kitty↓↑→←TABENTERLine ↓Line ↑Column →Column ←Next MatchNext MatchShift1/3 Page ↓1/3 Page ↑Shift →Shift ←Prev MatchNext MatchFnPage ↓Page ↑End of FileBeg of FileNext MatchNext MatchMac OS WezTerm↓↑→←TABENTERLine ↓Line ↑Column →Column ←Next MatchNext MatchShift1/3 Page ↓1/3 Page ↑Shift →Shift ←Prev MatchNext MatchFnPage ↓Page ↑End of FileBeg of FileNext MatchNext MatchSwitch focusC-x o-- Next paneC-x O-- Previous paneSplit and resize[C-un] C-x h-- Split horizontally.  The new top (n> 0) or bottom (n< 0) pane will have |n| lines[C-un] C-x v-- Split vertically[^1].  The new left (n> 0) or right (n< 0) pane will have |n| columnsC-x 0-- Delete.  All pending searches in the pane are discarded.  The focus goes to the previous paneC-x 1-- Maximize, deleting all other panesC-x --- Shrink the pane to the size of the file (if the file is small)C-x +-- Shrink all panes to the size of their filesOpening and closing filesC-x C-f-- Open a file.viewtext-clooks first in the current directory (of the file in the pane), displayed in the status bar; from there you can navigate to the file you want.  The pane is no longer associated with its previous file.  The file lookup mechanism supports completion[^2], so you need only specify a unique prefix for the file path and hitTABThe file in panepis identified in the caption along with its directory name (not the entire path), to discriminate between files with the same name.When the last pane into a file has been deleted, the file is effectively closed.  There is no concept ofbufferas in Emacs.  If you want to return to the file you must reopen it.Search/-- Initiate an incremental case-sensitive search, starting at your current position in the file.  There is always acurrent match, which will be identified by color.  As you add or delete characters,viewtext-cwill refine your searchBindings fornext matchandprevious matchare terminal-dependent and are shown in the table underMove OperationsaboveESC-- Suspend the current search if there is one; otherwise resume the most recent searchC-d-- Terminate the current searchC-g-- Abort the current search (essentially the same as terminate)C-l-- (Control-L) Center the current search matchC-l C-l-- Move the current search match to the top of the screenC-l C-l C-l-- Move the current search match to the bottom of the screenIf there is an active search in the current pane, it will tell you in the status bar.  Suspended searches will be visible in the file, but not in the status bar.Themesviewtext-ccomes with a palette of 248 colors.
You can specify the foreground and background colors of eachelementof the display (defined below).
The configuration of all element colors is called atheme.
You can create themes, name them and switch from one to another.c-- Change the color of an element[^3] (and save?)d-- Delete a themes-- Save the current theme (unnecessary)t-- Show the current themew-- Switch to a different theme and save the configuration filex-- Clone the current theme under a new name (and save?)List of display elements that make up a themeDisplay areacaption_focus-- The caption in the focused panecaption_nofocus-- Captions in non-focused panesedge_focus-- The edge[^1] in the focused paneedge_nofocus-- Edges in non-focused panessearch_current-- The current matching search stringsearch-- All other matching search stringstext-- The default text (all panes)Status barcursor-- The cursordirectory-- (completion): Filename completions that are directoriesmatch-- (search): The matching prefix of the search stringnomatch-- (search): The non-matching suffix of the search stringpattern-- (completion): The matching prefix of filenamesprefix-- (completion): The matching prefix (other completions)status-- The default textMouse supportLeft click-- Switch focus.  (Must be quick, otherwise you getclick and drag)Left double click-- Change the color of the clicked element[^3]Scroll-- You can scroll (up and down only) in any pane without switching focus.  Scrolling down works properly; scrolling up is balky and slowClick and drag-- Movesbutton-presstobutton-releasein 2-D without switching focus (exactly like Google Maps)Note thatscrollandclick and dragare inconsistent: one moves the window over the file while the other moves the file under the window.Initialization fileUpon startup,viewtext-clooks for a configuration file containing theme definitions and the name of the current theme.
The following locations are checked; the first one that exists and is readable will be loaded into theviewtext-cenvironment:~/.config/viewtext/config.toml~/.viewtextrc.toml./config.toml[^1]: When you split a pane vertically the new left pane gains a narrowedge, a border to distinguish it from the right pane.
Panes on the right border of the screen have no such edge.[^2]: If at any point you wish to see a list of possible completions, hitTAB.  (Filename completions that are directory names will appear in color, blue by default).  If there are too many to fit in the status bar, you can scroll through them using the left and right arrow keys.  If you add characters and hitTABagain, the completion mechanism will narrow your search.  When you reach your unique choice, hitENTER.  To abort, useC-g.[^3]: Specify the element first, then foreground or background, then the color.
The completion mechanism will display candidate foreground colors against the current background color and vice versa.