add readme with info about configs. #1

Merged
voronind merged 3 commits from readme into master 2023-10-21 21:38:38 +03:00
8 changed files with 294 additions and 17 deletions

View file

@ -1,12 +1,17 @@
# TODO: add info how to use configs for gnome, tmux & nvim.
# Custom system config. # Custom system config.
This is my own custom config that I use on my GNU/Linux machines. Not ment to be used by anyone else.
# Table of contents. # Table of contents.
1. [General info.](#general-info) 1. [General info.](#general-info)
2. [Load Gnome settings.](#load-gnome-settings) 2. [Load Gnome settings.](#load-gnome-settings)
3. [Navigation.](#navigation) 3. [Navigation.](#navigation)
4. [Nvim config.](#nvim-config)
5. [Bash commands.](#bash-commands)
# General info. # General info.
This is my own custom config that I use on my GNU/Linux machines. Not ment to be used by anyone else. It includes:
It includes:
1. Git config (excluding user info). 1. Git config (excluding user info).
2. Bash scripts and environment. 2. Bash scripts and environment.
3. Tmux config. 3. Tmux config.
@ -22,13 +27,285 @@ This is my own custom config that I use on my GNU/Linux machines. Not ment to be
13. Custom fonts. 13. Custom fonts.
# Load Gnome settings. # Load Gnome settings.
To load Gnome settings run `dconf_load`. To load Gnome settings run `dconf_load`.
# Navigation. # Navigation.
Navigation principles are shared between Gnome, Tmux and Nvim. The only difference is "Leader" key. Gnome uses `Super` key, Tmux uses `Meta (alt)` key and Nvim uses `Space`. The rest somewhat repeats itself.
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 ## Gnome
key|action
Key|Action
---|--- ---|---
`Super+q`|Move to the left workspace. `Super+Esc`|Lauch Terminal emulator.
`Super+e`|Move to the right workspace. `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`|New window.
`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.
`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.
`Space+f`|None.
More info in [Nvim config.](#nvim-config)
# Nvim config.
TODO: preserve default shortcuts, only add new ones when adding new functionality.
## 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|`<Leader>.`|Repeat command on selected line(s).
Normal|`zz`|Save all files.
Normal|`ZZ`, `<Space>z`|Save all and quit.
Normal|`ZQ`|Quit without saving.
Normal|`v`, `<Space>v`|Visual selection (cursor).
Normal|`V`|Visual selection (lines).
Normal|`<C-v>`|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*: `<C-r>`).
Visual|`u`|Convert selection to lowercase.
Visual|`U`|Convert selection to uppercase.
Visual|`~`|Toggle case.
Normal, Visual|`;`|Enter command mode (*default*: `:`).
Normal|`<Space>0`|Open shortcuts help.
### Align.
Mode|Key|Action
---|---|---
Visual|`<Space>A`|Align selection from the right.
Visual|`<Space>a`|Align selection from the left.
### Autocomplete.
Mode|Key|Action
---|---|---
Input|`<C-Space>`|Autocomplete.
Normal|`<C-Space>`|LSP autocomplete.
### Comments.
Mode|Key|Action
---|---|---
Normal, Visual|`<Space>/`|Toggle selected line(s) comment.
### File tree.
Mode|Key|Action
---|---|---
Normal|`<Space>1`|Toggle file tree.
Normal|`<Tab>`|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|`<Space>o`|Toggle fold.
Normal|`<Space>O`|Fold everything.
### Git.
Mode|Key|Action
---|---|---
Normal|`<Space>g`|Toggle git inspection mode.
### Macros.
Mode|Key|Action
---|---|---
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 *.
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|`<Space>w`|Switch to the split above.
Normal|`<Space>a`|Switch to the split left.
Normal|`<Space>s`|Switch to the split below.
Normal|`<Space>d`|Switch to the split right.
Normal|`<Space>q`|Swtich to the buffer left.
Normal|`<Space>e`|Swtich to the buffer right.
Normal|`<Space>Q`|Move the buffer left.
Normal|`<Space>E`|Move the buffer right.
Normal|`<Space>x`|Close the buffer.
Normal|`<Space>X`|Close all invisible buffers.
Normal|`<Space>m`|Move split.
Normal|`<Space>\|`|Split vertically.
Normal|`<Space>-`|Split horizontally.
Normal|`<Space>c`|Close split.
Input|`<C-h>`|Move left.
Input|`<C-l>`|Move right.
Input|`<C-j>`|Move down.
Input|`<C-k>`|Move up.
### Telescope.
Mode|Key|Action
---|---|---
Normal|`<Space>ff`|Find files.
Normal|`<Space>fg`|Find grep (find text within files).
Normal|`<Space>fb`|Find buffer.
Normal|`<Space>fh`|Find help.
Normal|`<Space>ft`|Find treesitter (vars, functions etc).
Normal|`<Space>fa`|Find all (default treesitter window).
### Terminal.
Mode|Key|Action
---|---|---
Normal|`<Space>4`|Open terminal.
Terminal|`<Esc>`|Detach from terminal.
### To-do.
Write `TODO:` or `NOTE:` to make it searchable.
Mode|Key|Action
---|---|---
Normal|`<Space>3`|Open to-do list.
### Trouble.
Mode|Key|Action
---|---|---
Normal|`<Space>2`|Open LSP trouble list.
### Which key.
Mode|Key|Action
---|---|---
Normal|`<Space>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|`<Space>=`|Equalize split sizes.
# Bash commands.
## Android.
Command|Description
---|---
`emulator`|Start android emulator. Not portable, it has to be named "default".
## Archive.
Those are self-written scripts to create archives. They are basically compressed tar archives with SHA1 hashes in their names. They are exported so also available in `parallel` like this: `ls | parallel -j 8 -- archive {}`
Command|Description
---|---
`archive [DIRS]`|Create archive with the best compression (slow). If no args given, archives all files in current directory as separate archives.
`archive_fast [DIRS]`|Like normal `archive` but with minimal compression.
`archive_check [DIRS]`|Check specified archives or all archives in current directory.
`unarchive [DIRS]`|Check specified or all archives and extract if they are correct.
## Battery.
Command|Description
---|---
`battery_level`|Print battery charge level (if available).

View file

@ -1,4 +1,4 @@
require('key/rekey') require('key/rekey')
rekey_visual('<Leader>A', '<cmd>lua require("align").align_to_string(false, false, true)<cr>') rekey_visual('<Leader>A', '<cmd>lua require("align").align_to_string(false, false, true)<cr>') -- align from left.
rekey_visual('<Leader>a', '<cmd>lua require("align").align_to_string(false, true, true)<cr>') rekey_visual('<Leader>a', '<cmd>lua require("align").align_to_string(false, true, true)<cr>') -- align from right.

View file

@ -1,4 +1,4 @@
require('key/rekey') require('key/rekey')
rekey_input('<C-Space>', '<C-n>') rekey_input('<C-Space>', '<C-n>') -- autocomplete.
rekey_normal('<C-Space>', '<cmd>lua vim.lsp.buf.code_action()<cr>') rekey_normal('<C-Space>', '<cmd>lua vim.lsp.buf.code_action()<cr>') -- LSP autocomplete.

View file

@ -1,2 +1,2 @@
vim.keymap.set("n", "<Leader>/", require("SingleComment").SingleComment, { expr = true }) vim.keymap.set("n", "<Leader>/", require("SingleComment").SingleComment, { expr = true }) -- toggle comment for selected line.
vim.keymap.set("v", "<Leader>/", require("SingleComment").Comment, {}) vim.keymap.set("v", "<Leader>/", require("SingleComment").Comment, {}) -- toggle comment for selected lines.

View file

@ -1,3 +1,3 @@
require('key/rekey') require('key/rekey')
rekey_normal('<Leader>1', '<cmd>NvimTreeToggle<cr>') rekey_normal('<Leader>1', '<cmd>NvimTreeToggle<cr>') -- toggle file tree.

View file

@ -1,4 +1,4 @@
require('key/rekey') require('key/rekey')
remap_normal('<Leader>o', 'za') remap_normal('<Leader>o', 'za') -- toggle fold.
remap_normal('<Leader>O', 'zx zM') remap_normal('<Leader>O', 'zx zM') -- fold everything.

View file

@ -1,3 +1,3 @@
require('key/rekey') require('key/rekey')
rekey_normal('<Leader>g', '<cmd>Gitsigns toggle_current_line_blame<cr><cmd>Gitsigns toggle_word_diff<cr><cmd>Gitsigns toggle_linehl<cr>') rekey_normal('<Leader>g', '<cmd>Gitsigns toggle_current_line_blame<cr><cmd>Gitsigns toggle_word_diff<cr><cmd>Gitsigns toggle_linehl<cr>') -- toggle git inspection mode.

View file

@ -17,7 +17,7 @@ rekey_normal('<Leader>Q', '<cmd>BufferLineMovePrev<cr>')
-- rekey_normal('<Leader>x', '<cmd>bd!<cr>') -- rekey_normal('<Leader>x', '<cmd>bd!<cr>')
rekey_normal('<Leader>x', '<cmd>bp<bar>sp<bar>bn<bar>bd<cr>') rekey_normal('<Leader>x', '<cmd>bp<bar>sp<bar>bn<bar>bd<cr>')
-- move window. -- move window. TODO: remove?
rekey_normal('<Leader>m', '<cmd>WinShift<cr>') rekey_normal('<Leader>m', '<cmd>WinShift<cr>')
-- splits. -- splits.