vimtex插件
2023年10月23日星期一霾北京市北京师范大学,
虽然很多文章一直声称vimtex
是现代的latex
插件,但是我并没有发现它比latex-suite
强多少,至少在一些特定符号的输入方面latex-suite
是无人能及的,但是vimtex
也提供了一些跳转的特性,二者并不冲突,所以两个都装上了。但是对于vimtex
都说它是现代化的插件,想必一定有它的理由,所以现在将相关的使用资料,官方位于github
访问不方便,于是转到此处以供参考。
按官方使用说明档发现一款软件 menyoki
,
它是制作终端gif
图像的强大工具,但是由于时间,不想现在去学习使用了,因此将其README.md
放于此处,以供日后学习之用。
VimTeX Visualized
This page contains animated GIFs that demonstrate many of the core
VimTeX editing features listed in :help vimtex-features
.
The related mappings are documented in detail at
:help vimtex-mappings
. The GIFs and accompanying
descriptions are used with permission from @ejmastnak's guide to Getting
started with the VimTeX plugin.
Hopefully, the animations can give you a clearer mental image of what
VimTeX's mappings do and how you might use them. You may want to scroll
through this page while simultaneously looking through
:help vimtex-features
—the animations should nicely
complement the plain-text documentation.
You can find a description of how the GIFs were made at the bottom of this page.
This page is community-maintained
This page is made possible only with help from the community. @ejmastnak, not @lervag, takes primary responsibility for maintaining it, but contributions from all VimTeX users are welcome.
If you notice mistakes or outdated content (following a VimTeX update, say), feel free to open a PR to fix it yourself. Alternatively, contact @ejmastnak at ejmastnak@gmail.com, who will be happy to help fix it.
Table of contents
- Motion commands
- Text objects
- Deleting surrounding LaTeX content
- Changing surrounding LaTeX content
- Toggling commands
- How these GIFs were made
Motion commands
Navigating sections
Use ]]
to jump to the beginning of the next
\section
, \subsection
or
\subsubsection
, whichever comes first. Use [[
to jump backward through sections, and see the similar shortcuts
][
and []
in the VimTeX documentation at
:help <Plug>(vimtex-][)
and
:help <Plug>(vimtex-[])
.
Navigating environments
Use ]m
and [m
to jump to the next or
previous environment \begin{}
command. See the VimTeX
documentation for the similar shortcuts ]M
and
[M
, described in :help <Plug>(vimtex-]M)
and :help <Plug>(vimtex-[M)
.
Navigating math zones
Use ]n
and [n
to jump to the beginning of
the next or previous math zone. See the VimTeX documentation for the
similar shortcuts ]N
and [N
, described in
:help <Plug>(vimtex-]N)
and
:help <Plug>(vimtex-[N)
.
Navigating frames
Use ]r
and [r
to jump to the beginning of
the next or previous Beamer frame
environment. See the
VimTeX documentation for the similar shortcuts ]R
and
[R
, described in :help <Plug>(vimtex-]R)
and :help <Plug>(vimtex-[R)
.
Navigating matching delimiters
Use %
to move between matching delimiters, inline-math
$
delimiters, and LaTeX environments.
Text objects
VimTeX provides text objects for commands, delimiters, environments, math zones, sections, and items. The following GIFs use Vim's visual mode to show the scope of the text objects.
The math text object
The i$
and a$
text objects select inline
math, display math, and common math environments.
The section, delimiter, and command text objects
The iP
and aP
text objects select LaTeX
sections (their subsection variations); the id
and
ad
objects select delimiters (parentheses, brackets,
braces...); the ic
and ac
objects select LaTeX
commands.
The environment and item text objects
The ie
and ae
text objects select LaTeX
environments and the im
and am
objects select
items in enumerated environments.
Deleting surrounding LaTeX content
Delete surrounding commands
Use dsc
to delete a LaTeX command while preserving the
command's argument(s); the dsc
mapping also recognizes and
correctly deletes parameters inside square brackets.
Delete surrounding environments
Use dse
to delete the \begin{}
and
\end{}
declaration surrounding a LaTeX environment without
changing the environment contents.
Delete surrounding math zones
Use ds$
to delete surrounding math zones (display math,
standard environments, and inline math) without changing the math
contents.
Delete surrounding delimiters
Use dsd
to delete delimiters (e.g. ()
,
[]
, {}
, and any of their
\left \right
, \big \big
variants) without
changing the enclosed content.
Changing surrounding LaTeX content
Change surrounding commands
Use csc
to change a LaTeX command while preserving the
command's argument(s).
Change surrounding environments
Use cse
to change the type of a LaTeX environment
without changing the environment contents.
Change surrounding math zones
Use cs$
to change the type of surrounding math zone
without changing the math contents. You can switch between display math,
standard environments, and inline math.
Change surrounding delimiters
Use csd
to change delimiters (e.g. ()
,
[]
, {}
, and any of their
\left \right
, \big \big
variants) without
changing the enclosed content; the csd
command is "smart"
and correctly recognizes and preserves \left \right
-style
modifiers.
Toggling commands
Toggling starred commands and environments
Use tsc
and tse
to toggle between starred
and un-starred versions of commands and environments, respectively.
Toggling between inline and display math
Use ts$
to toggle between inline math, display math, and
standard math environments.
Toggling delimiter modifiers
Use tsd
to change between plain and
\left
/\right
versions of delimiters. Use the
g:vimtex_delim_toggle_mod_list
variable to add more
modifiers to the delimiter toggle list. (e.g. \big
as in
the GIF below)
Toggling fractions
Use tsf
to toggle between inline and
\frac{}{}
versions of fractions.
How these GIFs were made
(Based on interest and discussion in issue #2685.)
The basic toolkit is Menyoki for recording the GIFs and screenkey to display the keys being typed, all running on a Linux system using the X11 window system.
On top of this are some aesthetic details to make the GIFs look nicer, including:
- Goyo to remove Vim peripherals (status bar, line numbers, etc.) for a cleaner look
- Limelight to draw focus to the currently selected paragraph (and gray out the rest of the document)
- Screen recording region (crop, basically) set via Menyoki to exactly capture the terminal window (and not e.g. the rest of my desktop)
- Enlarged terminal font for the duration of the GIF recording for better readability
- Vim and screenkey color schemes and fonts aligned for visual consistency.
The aesthetic details and cropping are wrapped in shell scripts for repeatability across multiple GIF recordings—the original scripts and auxiliary files can be found in the GitHub repo ejmastnak/ejmastnak.github.io, although they might be difficult to parse without additional context.
Feel free to contact @ejmastnak if you're interested in the details or recording similar GIFs.
Screen{shot,cast} and perform ImageOps on the command line 🌱
🏞️
menyoki is a screencast and screenshot utility that can also perform various image related operations such as making/splitting GIFs and modifying/analyzing/viewing image files. It aims to be a lightweight command line tool for either helping out on day-to-day life operations or complicated detail-centric issues. Originally it was designed to record/screenshot terminal windows but it can be tweaked easily for other purposes with command line arguments, environment variables, or a configuration file.
Table of Contents
Supported Platforms
menyoki requires a window system implementation of the supported platform for record and capture actions. Other features are expected to work normally since they don't require a window system running (or grabbing a window to operate on). For example, despite the macOS is not listed as a supported platform, menyoki still can perform image operations such as edit, analyze and view if it's compiled on macOS.
Supported Formats
Installation
Requirements
- Rust:
1.56.1+
- Dependencies
- Arch Linux:
libx11
,libxrandr
- Debian, Ubuntu:
libx11-dev
/librust-x11-dev
,libxrandr-dev
- Fedora:
libX11-devel
,libXrandr
- Arch Linux:
Cargo
menyoki can be installed from crates.io using cargo if Rust is installed.
1 | cargo install menyoki |
Use --force
option to update.
1 | cargo install menyoki --force |
Arch Linux
menyoki can be installed from the Arch Linux community repository.
1 | pacman -S menyoki |
Or if you prefer, you can use an available AUR package for installation. * Use an AUR helper:
1 | paru menyoki |
- Clone the package and compile it with makepkg:
1 | git clone https://aur.archlinux.org/menyoki-git.git |
Docker
Docker Hub
Download the orhunp/menyoki image from Docker Hub (see available tags):
1 | docker pull orhunp/menyoki:<tag> |
Run a container:
1 | docker run orhunp/menyoki:<tag> |
Building an image
After cloning the repository, you can build an image from Dockerfile:
1 | docker build -t menyoki . |
Then you can either run a container:
1 | docker run menyoki |
or spawn a shell inside the container with running it interactively:
1 | docker run -it menyoki /bin/bash |
Manual
From source
- Clone the repository.
1 | git clone https://github.com/orhun/menyoki.git && cd menyoki/ |
- Build the project and install binary.
1 | cargo install --path . |
Releases
- Download the latest archive from releases page and extract it.
- Move
menyoki
binary to/usr/local/bin/
(Linux)
Features
- Record an animation
- Split an animation into frames
- Make an animation from frames
- Capture an image
- Edit an image
- Analyze an image
- View an image
Usage
Action | |
---|---|
Result |
Command line arguments of menyoki are designed to be as intuitive as possible. As a result of that, an action can be performed with a chain of subcommands along with the flags and options. The general prototype for the usage of command line arguments is the following:
menyoki (ACTION) (FORMAT) (OUTPUT)
The subcommand that will indicate the action
is
mandatory whereas format
and output
subcommands might be optional (or they might not exist at all). The
format
subcommand can be one of the supported formats and
output
basically corresponds to the save
subcommand.
The default format
is the first listed subcommand if
there is not any subcommand given for specifying a format
.
On the other hand, save subcommand uses the "menyoki"
directory in the home (or images if it exists) as the
default output directory.
General
Flags and options that will generally affect the execution of menyoki can be set before specifying the main action to perform. Then the main subcommand (action) must be specified.
menyoki [FLAGS] [OPTIONS] <SUBCOMMAND>
Arguments
1 | FLAGS: |
Examples
Command | Action |
---|---|
menyoki -V |
Print the version information |
menyoki -vv --color FF00FF <action> |
Set log verbosity level to 2 (trace) and use "FF00FF" as the main color |
menyoki -q -c menyoki.conf <action> |
Run in quiet mode and read the configuration from "menyoki.conf" |
Record
menyoki can record an area of a window or the whole screen and encode it as a supported format. Area selection and resize is performed with the key bindings.
A few scenarios that record action might be helpful would be:
- Record a specific area of a window
- Record for a given duration
- Record the output of a command (especially for TUI applications)
Encoding options can be changed using the arguments of the provided
format. (See the output of menyoki record gif --help
)
menyoki record [FLAGS] [OPTIONS] [COMMAND] [SUBCOMMAND]
Arguments
1 | FLAGS: |
Examples
Command | Action |
---|---|
menyoki record |
Select a window and start recording with default settings |
menyoki record --root --countdown 5 |
Record the root window after 5 seconds of countdown |
menyoki record --focus --with-alpha |
Record the focused window with the alpha channel (for transparency) |
menyoki record --size 200x300 --duration 10 |
Record an area of size 200x300 for 10 seconds |
menyoki record --padding 20:10:0:10 --timeout 120 |
Record an area with given padding and set window selection timeout to 120 seconds |
menyoki record --parent |
Record the parent window of the selected window |
menyoki record --root --select --monitor 1 |
Record the first monitor as root window |
menyoki record --border 5 |
Record the area selected by a border with 5 width |
menyoki record --action-keys LControl-Q,LAlt-W |
Record with the default settings using custom key bindings |
menyoki record --cancel-keys LControl-X,E |
Record with the default settings using custom key bindings |
menyoki record gif --fps 15 --quality 90 |
Record 15 frames per second with 90% quality |
menyoki record gif --gifski |
Record and encode using the gifski encoder |
menyoki record gif save "test.gif" --timestamp |
Record and save as "test.gif" with timestamp in the file name |
menyoki record apng --fps 30 |
Record 30 frames per second and encode as APNG |
menyoki -q record save "-" > test.gif |
Record and redirect output to "test.gif" |
menyoki -q record save "-" \| xclip -selection clipboard -t image/gif |
Record and pipes output to xclip's clipboard selection, specifying target as a gif |
menyoki -q record "kmon -t 2000" |
Execute the command and record its output in quiet mode |
menyoki record --font "-*-dejavu sans-*-*-*-*-17-*-*-*-*-*-*-*" |
Use custom font for showing the area size (see
xfontsel ) |
Pro Tip
Use slop for selecting an area of the root window (fullscreen) with mouse interaction.
1 | menyoki record --root --size $(slop) |
Split
menyoki can split an animation into frames (extract images) if the split subcommand is provided and it can save frames as one of the supported formats with the use of trailing format subcommand.
menyoki split [OPTIONS] <FILE> [SUBCOMMAND]
Arguments
1 | FLAGS: |
Examples
Command | Action |
---|---|
menyoki split rec.gif |
Extract frames from the "rec.gif" file |
menyoki split rec.gif jpg --quality 100 |
Extract frames as JPEG in maximum quality |
menyoki split rec.gif --dir frames/ |
Extract frames and save them to the specified directory |
Make
make subcommand serves the purpose of creating an animation from a set of images. For example, it can be used for making GIFs from given images either via the command line or the specified directory.
menyoki make [FLAGS] [OPTIONS] <FRAMES>... [SUBCOMMAND]
Arguments
1 | FLAGS: |
Examples
Command | Action |
---|---|
menyoki make 1.png 2.png |
Make a GIF that consists of two frames as "1.png" and "2.png" |
menyoki make 1.png 2.png --fps 5 --quality 100 |
Make a GIF with the specified properties from given frames |
menyoki make 1.png 2.png save 3.gif --date |
Make a GIF and save the file ("3.gif") with the date information |
menyoki make 1.png 2.png --format apng |
Make an APNG from the given frames |
menyoki make --dir frames/ |
Make a GIF from the frames in the specified directory |
Capture
menyoki can capture (screenshot) an area of a window or the whole screen and encode it as a supported format. Formats like png, jpg, and pnm have their own flags and options that might be used for changing the default encoding settings. Similar to the record subcommand, area selection and resize is performed with the key bindings. The same flags and options might apply for both record and capture subcommands since the actions are abstractly alike.
menyoki capture [FLAGS] [OPTIONS] [COMMAND] [SUBCOMMAND]
Arguments
1 | FLAGS: |
Examples
Command | Action |
---|---|
menyoki capture |
Select a window and screenshot with default settings |
menyoki capture --root --countdown 5 |
Screenshot the root window after 5 seconds of countdown |
menyoki capture --focus --with-alpha |
Screenshot the focused window with the alpha channel (for transparency) |
menyoki capture --size 200x300 --duration 10 |
Screenshot an area of size 200x300 for 10 seconds |
menyoki capture --padding 20:10:0:10 --timeout 120 |
Screenshot an area with given padding and set window selection timeout to 120 seconds |
menyoki capture --mouse |
Screenshot the selected window with a mouse click |
menyoki capture png --filter avg --compression fast |
Screenshot and encode with the specified PNG options |
menyoki capture jpg --quality 100 |
Screenshot and encode with the specified JPEG options |
menyoki capture webp --lossless |
Screenshot and encode with the specified WEBP options |
menyoki capture pnm --format pixmap --encoding ascii |
Screenshot and encode with the specified PNM options |
menyoki capture ff save "test.ff" --timestamp |
Screenshot and save as "test.ff" in farbfeld format with timestamp in the file name |
menyoki -q capture png save "-" > test.png |
Screenshot and redirect output to "test.png" |
menyoki -q capture png save "-" \| xclip -selection clipboard -t image/png |
Screenshot and pipe output to xclip's clipboard selection, specifying an image/png target |
menyoki -q capture "kmon -t 2000" |
Execute the command and screenshot its output in quiet mode (sets countdown to 3 implicitly) |
Also, see the pro tip about
--size
argument.
Edit
edit subcommand can be used to edit (manipulate/filter/convert) files in one of the supported formats. Apart from the flags and options that edit provides, other encoding options can be specified via format subcommand.
menyoki edit [FLAGS] [OPTIONS] <FILE> [SUBCOMMAND]
Arguments
1 | FLAGS: |
Examples
Command | Action |
---|---|
menyoki edit test.png |
Re-encode the "test.png" file without editing |
menyoki edit test.png --grayscale |
Convert image to grayscale |
menyoki edit test.png --invert |
Invert the colors of the image |
menyoki edit test.png --crop 20:20:20:20 |
Apply the given padding to image for cropping |
menyoki edit test.png --resize 300x300 |
Resize the image to 300x300 (without keeping the aspect ratio) |
menyoki edit test.png --ratio 0.5 |
Resize the image to half the size (using the aspect ratio) |
menyoki edit test.png --ratio 2.0 --filter gaussian |
Resize the image using the specified sampling filter |
menyoki edit test.png --rotate 90 |
Rotate the image 90 degrees (clockwise) |
menyoki edit test.png --flip horizontal |
Flip the image horizontally |
menyoki edit test.png --blur 2.0 |
Blur the image |
menyoki edit test.png --hue 100 |
Adjust the hue of the image |
menyoki edit test.png --contrast -10.5 |
Adjust the contrast of the image |
menyoki edit test.png --brightness 50 |
Adjust the brightness of the image |
menyoki edit test.png --convert tga |
Convert image to TGA format |
menyoki edit test.png --convert jpg --quality 80 |
Convert image to JPEG in 80% quality |
menyoki edit test.gif --ratio 0.25 gif --quality 80 |
Resize and re-encode "test.gif" |
menyoki edit test.gif gif --speed 0.5 |
Slow down the GIF (half the speed) |
menyoki edit test.gif gif --cut-beginning 1.0 --cut-end 0.5 |
Cut the duration of GIF by seconds |
menyoki edit test.apng --convert gif |
Convert APNG to GIF |
menyoki edit test.ff --grayscale --convert pnm --format arbitrary save "output" --with-extension --date "%H%M%S" |
test.ff (farbfeld) -> grayscale -> output_020035.pam (PNM) |
Analyze
analyze subcommand serves the purpose of inspecting an image file which is in a supported format and creating a report based on the image details. The report consists of 2 to 3 sections that are file, image, and EXIF information.
menyoki analyze [FLAGS] [OPTIONS] <FILE> [SUBCOMMAND]
Arguments
1 | FLAGS: |
Examples
Command | Action |
---|---|
menyoki analyze test.jpg |
Inspect "test.jpg" and print the report |
menyoki analyze test.jpg save test_report.txt |
Inspect "test.jpg" and save the report as "test_report.txt" |
menyoki analyze test.jpg --timestamp |
Inspect the file and create a report based on timestamps |
menyoki analyze test.jpg --time-zone local |
Inspect the file and create a report based on local time zone |
menyoki analyze test.jpg --timestamp save --timestamp |
Use timestamps for both analysis report and file name |
Example report
1 | menyoki - image analysis report |
View
view subcommand can be used to simply view an image from the terminal. It uses the core library of viu.
menyoki view [FLAGS] <FILE>
Arguments
1 | FLAGS: |
Examples
Command | Action |
---|---|
menyoki view test.jpg |
View "test.jpg" from the terminal |
menyoki view test.png --transparent |
View "test.png" from the terminal with transparency enabled |
Other
It's possible to change the GIF, APNG, PNG, JPG, and PNM encoding options with specifying flags/options to the corresponding subcommands. Also, save subcommand can be used for changing the default output settings.
GIF/APNG
1 | FLAGS: |
(Some options might be only usable with a particular action)
PNG
1 | FLAGS: |
JPG
1 | FLAGS: |
WEBP
1 | FLAGS: |
PNM
1 | FLAGS: |
Save
1 | FLAGS: |
Key Bindings
Key bindings are only used and present while capture or record actions are performed. Essentially key bindings are for selecting capture/record areas and resizing them without any mouse interaction.
There are 3 types of key bindings in terms of performed action:
- Action keys (main action keys such as
LAlt-S
, can be customized via--action-keys
and--cancel-keys
options) - Cancel keys (the keys that will cancel the operation, e.g.
LControl-D
) - Miscellaneous keys (the keys that can be used for resizing the
selected area such as
LAlt-[up]
)
Key | Action |
---|---|
LAlt-[S/Enter] |
Start/stop recording or screenshot the selected area |
LControl-D, Escape |
Cancel the current operation |
LControl-C |
Cancel the current operation or stop recording |
LAlt-[arrow keys/hjkl] |
Increase the area padding (decrease the size of the area) |
LControl-LAlt-[arrow keys/hjkl] |
Decrease the area padding (increase the size of the area) |
LShift-LAlt-[arrow keys/hjkl] |
Reposition the selected area (move around) |
LAlt-[1-9] |
Set the speed factor of changing the area size (default: 3) |
LAlt-R |
Reset the area padding to default |
Configuration
It's possible to override the default command line arguments with a
configuration file. It can be specified via --config
option
or $MENYOKI_CONFIG
environment variable. Also, it can be
placed to a location where menyoki looks for as
default:
{CONFIG_DIR}/menyoki.conf
{CONFIG_DIR}/menyoki/menyoki.conf
{CONFIG_DIR}/menyoki/config
{CONFIG_DIR}
can be one of the following depending on
the platform: * Linux: $XDG_CONFIG_HOME
or
$HOME/.config
* e.g. /home/orhun/.config
*
macOS: $HOME/Library/Application Support
* e.g.
/Users/Orhun/Library/Application Support
* Windows:
{FOLDERID_RoamingAppData}
* e.g.
C:\Users\Orhun\AppData\Roaming
Default configuration file*
1 | [general] |
Environment Variables
Corresponding environment variables can be set for overriding the command line flags and options. The general prototype of the variables that menyoki checks are the following:
MENYOKI_{SECTION}_{ARGUMENT}=value
Examples
Command | Environment Variables |
---|---|
menyoki --quiet |
MENYOKI_GENERAL_QUIET=true |
menyoki record gif --fps 10 save --timestamp |
MENYOKI_GIF_FPS=10 MENYOKI_SAVE_TIMESTAMP=true |
menyoki capture --size 200x300 jpg --quality 100 |
MENYOKI_CAPTURE_SIZE=200x300 MENYOKI_JPG_QUALITY=100 |
menyoki edit test.png --ratio 2.0 --filter triangle |
MENYOKI_EDIT_RATIO=2.0 MENYOKI_EDIT_FILTER=triangle |
menyoki split test.gif --dir frames/ pnm --format graymap |
MENYOKI_SPLIT_DIR=frames/ MENYOKI_PNM_FORMAT=graymap |
menyoki analyze test.png --timestamp save --date %H%M%S |
MENYOKI_ANALYZE_TIMESTAMP=true MENYOKI_SAVE_DATE=%H%M%S |
menyoki view test.png --transparent |
MENYOKI_VIEW_TRANSPARENT=true |
Roadmap
The following are the ultimate goals of the menyoki project.
Accessibility
menyoki should be packaged for other distributions and package managers (such as Nixpkgs and Homebrew) for easy access and installation.
Platforms
Supported platforms list should be extended by implementing the core features of menyoki on different systems. (See #2, #4 and #5)
Formats
All the image formats that image-rs supports for encoding should be implemented in menyoki. Also, the implementation of other image and video formats should be considered for encoding the frames in record/capture action. (See supported formats)
Optimization
Encoding/decoding of some formats like GIF might be optimized for speed and efficiency. Alternative ways and options should be considered depending on the benchmarks in such cases.
Testing
menyoki should be tested against different platforms and bugs must be reported for further development and support.
Resources
About the project
Why "menyoki"?
It's a reference to the author's favorite character from the game Patapon 2.
Menyokki (aka Tree-Pon due to his resembling a tree) is a type of Rarepon introduced in Patapon 2. Its evolved form is Kisuk, and its ultimate form is Moriussoo. These Rarepons are green and resemble plants in various stages of development: Menyokki is a seedling, Kisuk is a sapling and Moriussoo is a full-grown tree.
The Menyokki sprite that is used as the project's logo was originally drawn by OwocekTV for the fan made game Patafour. He is also the creator and lead developer of Patafour and he is working on bringing the long awaited 4th installment of the Patapon franchise to life with the rest of the team.
Thanks to owodzeg for his hard work on Patafour and the help with the menyoki logo. Kudos!
Social Media
Funding
If you like the menyoki and/or other projects on my GitHub profile, consider supporting me on GitHub Sponsors or Patreon!
License
GNU General Public License (v3.0)
Copyright
Copyright © 2020-2023, Orhun Parmaksız