These are my dotfiles that I am using. Mainly bash, neovim, c++, python related.
Feel free to use them.
Do not hesitate to ask me if something is not clear or does not work for you.
You might be interest in devenvsetup repo.
- Clone to somewhere
- symlink the appropriate dotfiles to your home directory.
- Perform the steps below on your first run.
Versions:
- Tmux around 3.2a
- Neovim 0.8+
Both are automatically installed through the devenvsetup too.
Both Tmux and Neovim need to manually install the plugins on first startup.
- Press "(CTRL-A)+I" to install plugins, give it a second, it does not print progress, the lower status bar should become much nicer.
- Restart tmux.
- Run
:PackerInstall
, wait for all plugins to be installed in the popup window. - Also wait for tree-siter compilation, only shown on the status line at the bottom.
The lists below might not be always up-to-date, see the scripts themselves
Terminology:
- "-" = press together
- "+" = consecutive
- "[]" = alternatives, i.e. press one of them
- tmux prefix -
CTRL-a
- split panel horizontally -
prefix + -
(minus) - split current panel vertically
prefix + |
- switch between panels =
ALT-[hjkl]
- switch to next window -
prefix-n
- switch to previous window -
prefix+p
- create a new window -
prefix+c
- rename a window -
prefix + ,
(comma) - kill a panel -
prefix + x
. - move current window left (in the list of windows) -
ATL + p
- move current window right (in the list of windows) -
ATL + n
- select text with mouse and press "y" to store it in clipboard, requires
xclip
or similar.
Newly created window inherits ${CWD}
from the active window where prefix+c
was pressed.
Configuration located in ./.config/nvim/lua
, slightly disorganized at the
moment.
options.lua
- baseline reasonable options
- Global persistent
${HOME}/undodir
- one can revert changes on re-opened files, clean from time to time. 80,120
visual guidelines- no
.swap
files
colorscheme.lua
- gruvbox settingsmappings.lua
- majority of Keybindings but not all of them.plugins.lua
- list of all plugins, loaded withpacker
. Saving this file updates the plugins.config/
- plugin-specific configs, more keymappings.
- Make
;
as as:
- no shift needed for writing commands. jk
to quit insert mode.<leader>
se to spacebar.- Move between panes with
<leader>+[hjkl]
- Move between tabs with
g+t
andg+b
. - Move between buffers with
<leader>+[
and<leader>+]
. - Switch the current line with the one up/down with
CTRL-k
/CTRL-j
.
Autocomplete snippets for various languages, one can create custom ones and
place them into Ultisnips/
directory.
Language files are autoformatted on save (:w
).
Respects .clang-format
for C/C++, Python uses black, yaml and other have
standard format too.
vim-fugitive for git commands, vim-gitgutter for hunk manipulation.
:Git <cmd>
for basically any git command.- Hunks are shown with signs in the left sidebar.
<leader>+h+s
- stage the current hunk.<leader>+h+r
- review the current hunk - see diff.<leader>+h+u
- undo (restore) the current hunk.<leader>+h+n
- jump to the next hunk in the current file (does not wrap around).<leader>+h+p
- jump to the previous hunk in the current file (does not wrap around).
File search:
Pretty fast fuzzy search for files (or words in them) in the current subtree.
My main method of opening new files.
fzf.vim, requires fzf, ripgrep.
In general:
- press keybind
- popup window opens with the list of files
- enter your search query, files are searched on the fly
- use arrows to find your file (or type more until it is the only one left...)
- open with
enter
orCTRL-t
,CTRL-v
for dedicated new tab or vertical split.
<leader>+f+f
Search for all files matching the name.<leader>+f+g
Search for all files tracked by current git repository.<leader>+f+w
Search for all git files containing the given word.<leader>+f+c
Search git log history.<leader>+f+h
Search git log history, only commits relevant to the current file.
File browser:
- Open/close with
<leader>+t
. - open/close folders with
enter
. - Create new files in the "current" folder with
a
, trailing/
create a directory. - eename file/dir with
r
. - Remove file/dir with
d
. - Cut file/dir with
x
. - Copy file/dir with
c
. - Paste file/dir into the "current" folder with
p
. - Open the file with
enter
. - Open the file in vertical pane
CTRL-v
. - Open the file in new tab
CTRL-t
.
Standard vim commands + easymotion.
- Search by pressing
/
and writing the search query. Enter jumps to the first result. CTRL-L
clears the highlights.- Move between search results with
n
andN
. - Move between jump lists with
CTRL-o
orCTRL-i
, also works for jump between files opened from the file browser.
Easymotion workflow:
- Look at the place you want to jump, can be in another pane.
- Press
f
,s
, followed by a single char, two chars, respectively.<leader>+w
marks all words. - All matches are highlighted, press the key(s) for the place you want to jump to. Do not use uppercase, they are that way just for better readability.
Based on installed LSPs.
Call :LspInstallInfo
and install any LSPs you want (select via arrows, press
i
).
- C++ requires
compile_commands.json
present, I use compiledb for make-based projects, CMake can generate it too. - Autocomplete with
<Enter>
. CTRL+n
,CTRL+p
moves between the autocomplete suggestions.<Tab>
also moves forward but in case of snippets it just to the next placeholder.<SHIFT-Tab>
tab but backwards.CTRL+e
closes the autocomplete suggestion window.
There is also linting via clang-tidy, pylint
and others.
- Python should respect
venv
but it's not 100% in my experience. - Do NOT run vim itself within activated
venv
.
Navigation:
gD
- go to declaration.gd
- go to definition.gi
- go to implementation.gk
- show hover information about the symbol under cursor.gr
- find all symbol references.<leader>rn
- rename symbol under the cursor.ge
- show all diagnostics on the current line.g[
- jump to next diagnostic.g]
- jump to prev diagnostic.
K
opens man page for the word under the cursor in the current pane.<leader>+K
opens man page for the word under the cursor in a new tab.<leader>+c
close quickfix window.- Very handy motions with vim-surround.
cs"'
- changes"hello"
to'hello'
when cursor is somewhere between. Works with brackets too.- vim-commentary for
commenting,uncommenting for multiple languages
- e.g.
gcc
comments current line.
- e.g.
Public Domain in general, some snippets were made by others, do respect the mentioned source and its license.