From 7aad735ade0c09267566a0d5d72f2d80b6f2b1a6 Mon Sep 17 00:00:00 2001 From: desktop Date: Thu, 7 Dec 2023 04:04:03 +0300 Subject: [PATCH] doc : add references. --- .doc/bash.md | 150 ++++++++++++++++++++++++++++++++++++ .doc/navigation.md | 68 ++++++++++++++++ .doc/nvim.md | 188 +++++++++++++++++++++++++++++++++++++++++++++ .gitignore | 4 + 4 files changed, 410 insertions(+) create mode 100644 .doc/bash.md create mode 100644 .doc/navigation.md create mode 100644 .doc/nvim.md diff --git a/.doc/bash.md b/.doc/bash.md new file mode 100644 index 0000000..75f5152 --- /dev/null +++ b/.doc/bash.md @@ -0,0 +1,150 @@ +# Bash reference file. + +To get help with usage info run: + +```text +$ help + +or + +$ h +``` + +Command|Description +---|--- +archive [DIRS]|Archive directories. All directories by default. +archive_check [FILES]|Check archives integrity. Checks all archives by default. +archive_convert|Convert old archives to a new format. TODO: remove me after some time when there won't be any old archives. +archive_fast [DIRS]|Archive directories with fast compression. All directories by default. +archive_name [ARCHIVE] [NAME]|Rename archives. If no name specified, it simplifies archive's name. If no archives specified, apply to all archives. +archive_prune [NAME]|Delete old versions of an archives. All archives by default. +battery_level|Print current battery level. +bcp|Default cp, a.k.a builtin cp. When you don't need rsync. +bootstrap_ffmpeg|Install ffmpeg. +bootstrap_grub|Install grub theme. +bootstrap_rust|Install Cargo/Rust. +bootstrap_texlive|Install TeXLive. +cdd |CD (back) to directory. Finds first directory that matches the input (case-insensitive). +checksum|Calculate hashes for all files recursively and store in a file called "checksum.sha1". +checksum_check [FILES]|Check stored values against actual files. All files by default. +checksum_create [FILES]|Save file checksums. For file with a name "file" it will create a new file called ".file.sha1" with hash in it. All files by default. +color_test|Print all available colors with their names colored in corresponding color. +copy|Copy stdin to system clipboard. Example: echo hi | copy +cp |Replaces default cp with rsync. +cp_link |Copy by creating hardlinks. Works for directories, too. +cp_merge |Copy and also merge all changes (delete dst files that do not exist in src). +cp_test |Print output of cp_merge without writing anything. +dc|Docker compose shortcut. +dcd [SERVICES]|Docker compose down. +dcdu [SERVICES]|Docker compose down & up specified services. +dcl [SERVICES]|Docker compose logs. +dconf_load|Load Gnome settings. +dconf_save [FILE]|Dump Gnome settings into the file. Default name is gnome.dconf. Do this before changing settings and after, an then run diff to find out what to add to main gnome.dconf. +dcp [SERVICES]|Docker compose pull. +dcpu [SERVICES]|Docker compose pull & up specified services. +dcr [SERVICES]|Docker compose restart. +dcs [SERVICES]|Docker compose stop. +dcu [SERVICES]|Docker compose up. +dcul [SERVICES]|Docker compose up & attach to logs for specified services. +df|Show only physical drives info. +doc_bash|Generate a markdown file with all the help info. Outputs to ~/.doc/bash.md +docker_health|Check if any container exited. +docker_up |Find out container's IP address. +docker_prune|Prune everything. +docker_update|Update all docker images. +docker_volumes |Show container's volumes. +dow|Current day of week number. +du [DIRS]|Show combined size in SI. Current dir by default. +emulator [NAME]|Start an Android emulator. Default name is "default". +ffmpeg_music_meta |Generate music metadata from directory structure. Top dir is the Artist name like this: The_Beatles. Next are albums like this: 2010_My_love. Inside are songs like this: 01_sample.flac. +ffmpeg_mux_audio |Mux audio into containers. File names in sound and current dirrectories must match. Tmp usage for anime downloads. +ffmpeg_mux_cover |Mux cover into music file. +find_ext|Find all file extensions. +find_functions|Find all module functions. +fix_ethernet_speed |Fix when ethernet mistakenly detects 100 Mb instead of 1000 Mb. SPEED is one of 10/100/1000 etc. +fix_files_sftp|Fix nautilus after typing wrong sftp password. +ga [FILES]|Preview diff while adding. Adds current dir by default. +gb|Git branch. +gbd |Git branch delete. +gbda|Git branch delete all except current. +gc|Git commit. +gch|Git checkout. +gchb |Git checkout branch. +gd|Git diff. +gdc |See diff for a specific commit. +gf|Git fetch all. +gg |Get my git repo. +ggc|Run git garbage collection. +gi|Git ignore files. +gl|Git log. +gp |Git patch (apply). +gpc |Git patch create. +gpl|Git pull. +gps|Git push. +gpsf|Git force push. +gr [COMMIT COUNT]|Rebase by X commits or from root. When COUNT is 0 - rebase from root. Default is 2. +gs|Git status. +gst|Git stash. +gt|Git tag. +gu [EMAIL]|Specify git user as Dmitry Voronin with provided email. +h |Short for help. +help |Get help about dotfiles bash function. +l [DIRS]|List files in dirs. Current dir by default. +la [DIRS]|List all files in dirs, incl. hidden files. Current dir by default. +ll [DIRS]|List last modified files first. Current dir by default. +lla [DIRS]|List all files in dirs, incl. hidden files, sorted by mtime. Current dir by default. +lll [DEPTH] [DIRS]|List files in tree structure. Current dir by default. Depth can be omitted by passing - (dash). +llll [DIRS]|List files recursively. Current dir by default. +name [FILES]|Rename files to strip all special characters. All files by default. +name_ext [FILES]|Rename files with new extension. All files by default. +name_hash [FILES]|Rename all files to their hashes while keeping extensions. All files by default. +name_hash_check [FILES]|Check hashes for previously renamed files. All files by default. +name_manga [FILES]|Rename files for Kavita manga format. All files by default. +name_postfix [FILES]|Change file name postfix. All matching files by default. +name_prefix [FILES]|Change file name prefix. All matching files by default. +name_replace [FILES]|Replace part of the name. All matching files by default. +name_series [FILES]|Rename files for Jellyfin series, i.e. Episode S01E01.mkv All files by default. +ncdu [DIRS]|Search only on current filesystem. Current dir by default. +notify |Send Telegram notification. +notify_silent |Send silent Telegram notification. +o |Open file/dir in GUI. +own [USER] [FILES]|Change file ownership to specified user id and restrict access to him. Root user by default. This directory recursively by default. +pack [FILES]|Pack files into desired format. All files and directories by default. +parse_alnum |Parse data keeping only alphanumeric characters. +parse_camel |Parse to CamelCase. +parse_simplify |Parse data and output simplified format. +paste|Paste system clipboard to stdout. Example: paste > file.txt +perm|Recursively change permissions to restrict access for group and others. +perm_share|Recursively change permissions to allow read sharing with group and others. +ps |Find process and filter. +recursive |Run something recursively over all directories. +recursive1 |Run something recursively over directories of 1 depth (excluding current dir). +rust_book|Open Rust book. +s [USER]|Su shortcut for lazy me. Root by default. +ta [NAME]|Create/attach to named session. By default uses name "main". +tba [NAME]|Attach/create toolbx container with specified name. By default uses "main" name. +tbk [NAME]|Remove toolbx container with specified name. By default uses "main" name. +tbl|List all available containers. +tb_rpmfusion [NAME]|Install rpm-fusion repository into container with specified name. By default uses "main" name. +td|Detach from running session. +tk [NAME]|Kill specified session. By default it kills "main" session. +tka|Kill all sessions. +tl|List running sessions. +tmp|CD into host's primary tmp dir. +tn [NAME]|Assign name to window. Uses current dir name by default. +today|Print today date in yyyyMMdd format. +todo|Open ~/.todo.md file. +transcode [FILES]|Convert between different formats. By default tries to convert all files. +trn [NAME]|Rename current session. Uses current dir name by default. +try |Retry command every 2 sec until it completes successfully. +tsize|Get terminal size. +unarchive [FILES]|Extract previously created archive with checksum validation. +unpack [FILES]|Attempt to unpack. All supported formats by default. +v|Neovim shortcut. +vdl [LINK]|Download video from URL. When no [LINK] specified, it tries to update previously downloaded link. +vdl_file |Download all videos from file with links. +vdl_vk |Temporary fix for vk downloads. +w |Watch command output with 2 second interval. +wallpaper |Set specified file as a wallpaper. +ww |Watch command output with minimal interval. +x |Add executable flag to file. diff --git a/.doc/navigation.md b/.doc/navigation.md new file mode 100644 index 0000000..930de71 --- /dev/null +++ b/.doc/navigation.md @@ -0,0 +1,68 @@ +# Navigation. + +Navigation principles are shared between Gnome, Tmux and Nvim. The only difference is the *"Leader"* key. Gnome uses *Super* key, Tmux uses *Meta (alt)* key and Nvim uses *Space*. The rest somewhat repeats itself. + +## Gnome + +Key|Action +---|--- +`Super+Esc`|Lauch Terminal emulator. +`Super+q`|Switch to the left workspace. +`Super+e`|Switch to the right workspace. +`Super+Q`|Move window to the left workspace. +`Super+E`|Move window to the right workspace. +`Super+\|`|None. +`Super+-`|None. +`Super+w`|Toggle window maximize. +`Super+s`|Minimize window. +`Super+a`|Snap window to the left. +`Super+d`|Snap window to the right. +`Super+z`|Lock session. +`Super+x`|Close window. +`Super+c`|Minimize all windows. +`Super+v`|Take a screenshot. +`Super+f`|Toggle window fullscreen. + +## Tmux. + +Key|Action +---|--- +`Meta+Esc`, `Meta+t`|New window. `Meta+t` is for the Termux Android app as it can't send the `Meta+Esc` combo. +`Meta+q`|Switch to the left window. +`Meta+e`|Switch to the right window. +`Meta+Q`|Move window to the left. +`Meta+E`|Move window to the right. +`Meta+\|`|Split vertically. +`Meta+-`|Split horizontally. +`Meta+w`|Switch to the above split. +`Meta+s`|Switch to the below split. +`Meta+a`|Switch to the left split. +`Meta+d`|Switch to the right split. +`Meta+z`|Detach from session. +`Meta+x`|Close window. +`Meta+c`|Close split. +`Meta+v`|Visual selection. `y` to copy. +`Meta+f`|None. + +## Nvim. + +Key|Action +---|--- +`Space+Esc`|None. +`Space+q`|Switch to the left buffer. +`Space+e`|Switch to the right buffer. +`Space+Q`|Move buffer to the left. +`Space+E`|Move buffer to the right. +`Space+\|`|Split vertically. +`Space+-`|Split horizontally. +`Space+w`|Switch to the above split. +`Space+s`|Switch to the below split. +`Space+a`|Switch to the left split. +`Space+d`|Switch to the right split. +`Space+z`|Save all and exit. +`Space+x`|Close buffer. +`Space+c`|Close split. +`Space+v`|Visual selection (or just default `v`). +`Space+f`|None. + +More info in [Nvim doc.](nvim.md) diff --git a/.doc/nvim.md b/.doc/nvim.md new file mode 100644 index 0000000..b2663c1 --- /dev/null +++ b/.doc/nvim.md @@ -0,0 +1,188 @@ +# Nvim config. + +TODO: preserve default shortcuts, only add new ones when adding new functionality. +TODO: Generate all this similar to the bash `doc_bash`. + +## General info. + +* Run `:Update` to update everything. +* File tree shows everything by default, telescope ingores git-ignored files. + +## Keymaps. + +### Common. TODO: separate visual and others from common. + +Mode|Key|Action +---|---|--- +Normal, Visual|`5dd`|Repeat following command N (5) times. +Normal|`.`|Repeat input on selected line. +Normal, Visual|`.`|Repeat command on selected line(s). +Normal|`zz`|Save all files. +Normal|`ZZ`, `z`|Save all and quit. +Normal|`ZQ`|Quit without saving. +Normal|`v`, `v`|Visual selection (cursor). +Normal|`V`|Visual selection (lines). +Normal|``|Visual selection (block). +Normal|`gh`|Go to the start of the line. +Normal|`gl`|Go to the end of the line. +Normal|`gj`|Go to the end of the file. +Normal|`gk`|Go to the top of the file. +Normal|`u`|Undo action. +Normal|`U`|Redo action (*remaps*: undo whole line), (*default*: ``). +Visual|`u`|Convert selection to lowercase. +Visual|`U`|Convert selection to uppercase. +Visual|`~`|Toggle case. +Normal, Visual|`;`|Enter command mode (*default*: `:`). +Normal|`0`|Open shortcuts help. + +### Align. + +Mode|Key|Action +---|---|--- +Visual|`A`|Align selection from the right. +Visual|`a`|Align selection from the left. + +### Autocomplete. + +Mode|Key|Action +---|---|--- +Input|``|Autocomplete. +Normal|``|LSP autocomplete. + +### Comments. + +Mode|Key|Action +---|---|--- +Normal, Visual|`/`|Toggle selected line(s) comment. + +### File tree. + +Mode|Key|Action +---|---|--- +Normal|`1`|Toggle file tree. +Normal|``|Toggle directory or open file for preview. +Normal|`a`|Create file/directory. +Normal|`x`|Cut file/directory. +Normal|`p`|Paste file/directory. +Normal|`f`|Filter. +Normal|`F`|Reset filter. +Normal|`d`|Delete file/directory. +Normal|`r`|Rename file. +Normal|`R`|Refresh. +Normal|`s`|Open in system app. +Normal|`S`|Search. +Normal|`I`|Toggle gitignore filter. +Normal|`y`|Copy name. +Normal|`Y`|Copy relative path. + +### Fold. + +Mode|Key|Action +---|---|--- +Normal|`o`|Toggle fold. +Normal|`O`|Fold everything. + +### Git. + +Mode|Key|Action +---|---|--- +Normal|`g`|Toggle git inspection mode. + +### Macros. + +Mode|Key|Action +---|---|--- +Visual|`mwx`|Unwrap selection (select the stuff inside wraps). +Visual|`mw"`|Wrap selection in ". +Visual|`mw3"`|Wrap selection in 3x ". +Visual|`mw'`|Wrap selection in '. +Visual|`mw(`|Wrap selection in (). +Visual|`mw{`|Wrap selection in {}. +Visual|`mw[`|Wrap selection in []. +Visual|`` mw` ``|Wrap selection in \`. +Visual|`` mw3` ``|Wrap selection in 3x \`. +Visual|`mw*`|Wrap selection in *. +Visual|`mw2*`|Wrap selection in 2x *. +Visual|`mw3*`|Wrap selection in 3x *. +Visual|`mw `|Wrap selection in spaces. +Normal, Visual|`mmx`|Markdown: set - [ ] as completed. +Normal, Visual|`mm `|Markdown: set - [x] as not completed. +Normal|`mmp`|Markdown: insert paragrapg (2x non-breakable spaces). +Visual|`mmb`|Markdown: make selection bold. +Visual|`mmi`|Markdown: make selection italic. +Visual|`mms`|Markdown: make selection strikethrough. +Visual|`mmr`|Markdown: make selection a reference. +Visual|`mmc`|Markdown: make selection a code block. +Normal|`mi`|Copy and increment selected line. +Normal|`ma`|Select all. + +### Navigation. + +Mode|Key|Action +---|---|--- +Normal|`w`|Switch to the split above. +Normal|`a`|Switch to the split left. +Normal|`s`|Switch to the split below. +Normal|`d`|Switch to the split right. +Normal|`q`|Swtich to the buffer left. +Normal|`e`|Swtich to the buffer right. +Normal|`Q`|Move the buffer left. +Normal|`E`|Move the buffer right. +Normal|`x`|Close the buffer. +Normal|`X`|Close all invisible buffers. +Normal|`m`|Move split. +Normal|`\|`|Split vertically. +Normal|`-`|Split horizontally. +Normal|`c`|Close split. +Input|``|Move left. +Input|``|Move right. +Input|``|Move down. +Input|``|Move up. + +### Telescope. + +Mode|Key|Action +---|---|--- +Normal|`ff`|Find files. +Normal|`fg`|Find grep (find text within files). +Normal|`fb`|Find buffer. +Normal|`fh`|Find help. +Normal|`ft`|Find treesitter (vars, functions etc). +Normal|`fa`|Find all (default treesitter window). + +### Terminal. + +Mode|Key|Action +---|---|--- +Normal|`4`|Open terminal. +Terminal|``|Detach from terminal. + +### To-do. + +Write `TODO:` or `NOTE:` to make it searchable. + +Mode|Key|Action +---|---|--- +Normal|`3`|Open to-do list. + +### Trouble. + +Mode|Key|Action +---|---|--- +Normal|`2`|Open LSP trouble list. + +### Which key. + +Mode|Key|Action +---|---|--- +Normal|`0`|Show context hotkey help. + +### Window management. + +Mode|Key|Action +---|---|--- +Normal|`-`|Decrease split size vertically. +Normal|`_`|Increase split size vertically. +Normal|`\`|Decrease split size horizontally. +Normal|`\|`|Increase split size horizontally. +Normal|`=`|Equalize split sizes. diff --git a/.gitignore b/.gitignore index d274bff..5d9c298 100644 --- a/.gitignore +++ b/.gitignore @@ -13,6 +13,10 @@ # bash. !/.bashrc +# Doc. +!/.doc/ +!/.doc/** + # dir structure !/app/ /app/*