- zsh + p10k for flavor + nvim
For linux:
- Install first
sudo apt install zsh - Make it your default shell
chsh -s $(which zsh)
() {
command curl -LO https://github.com/neovim/neovim/releases/latest/download/nvim.appimage
command chmod u+x nvim.appimage
command mkdir -p /opt/nvim
command mv nvim.appimage /opt/nvim/nvim
emulate -L zsh -o xtrace -o err_return
ZDOTDIR=/no/such/dir command zsh -ic '[[ $ZDOTDIR == /no/such/dir ]]'
command git clone -- https://github.com/ohmyzsh/ohmyzsh.git ~/.oh-my-zsh
command git clone --depth=1 -- https://github.com/romkatv/powerlevel10k.git ~/.oh-my-zsh/custom/themes/powerlevel10k
command sed -- 's|robbyrussell|powerlevel10k/powerlevel10k|' ~/.oh-my-zsh/templates/zshrc.zsh-template >~/.zshrc
command echo '[[ ! -f ~/.vim/.p10k.zsh ]] || source ~/.vim/.p10k.zsh' >> ~/.zshrc
command echo '[[ ! -f ~/.vim/.aliases ]] || source ~/.vim/.aliases' >> ~/.zshrc
command ln -s ~/.vim/.vimrc ~/.vimrc
ZDOTDIR=~ exec zsh -i
}
Recommended: Install the latest vim version via appImage executable https://github.com/vim/vim-appimage/releases
Features:
- File storage viewer (
nerdtree) - Spell check for English in text documents (md, asciidoc, text...)
- Better Status lines and buffer/tabs information (
vim-airline) - IDE like features
- Workspace features (
vim-ctrlspace) - Python auto completion (
coc-vim+coc-python) - Linting with
flake8(ale) - Fixing python code using
blackwhen saving file (ale) - Class outline viewer (
preservim/tagbar) - Git branch showing and use
:Gto execute git commands (fugitive) - Possibility to set vim configurations at project level using
.editorconfigfiles
- Workspace features (
git clone https://github.com/martsec/vim_config.git ~/.vim
mkdir ~/.vim/swp ~/.vim/undodir ~/.vim/thesaurus ~/.vim/autoload
ln -s $HOME/.vim/.vimrc $HOME/.vimrc
# Install the plugin manager
curl -fLo ~/.vim/autoload/plug.vim --create-dirs https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim
# Install the thesaurus
wget https://raw.githubusercontent.com/zeke/moby/master/words.txt -O ~/.vim/thesaurus/moby_thesaurus.txt
# Install coc dependencies (code completion + IDE like features)
curl -sL install-node.now.sh/lts | sudo bash
sudo apt-get update
sudo apt-get install fonts-powerline
# generates an index (or tag) file of classes, objects...
sudo apt install \
gcc make \
pkg-config autoconf automake \
python3-docutils \
libseccomp-dev \
libjansson-dev \
libyaml-dev \
libxml2-dev
git clone https://github.com/universal-ctags/ctags.git && cd ctags
./autogen.sh
mkdir ~/.vim/libs
./configure #--prefix=/where/you/want # defaults to /usr/local
make
sudo make install # may require extra privileges depending on where to install
# Asciidoctor
sudo apt-get install -y asciidoctor default-jdk
sudo gem install asciidoctor-pdf
sudo gem install asciidoctor-diagram
# Rust
# https://dev.to/veer66/enable-rust-autocomplete-in-neovim-j3o
rustup component add rust-analyzer
# If you want to use nvim, it's the moment to follow
# https://neovim.io/doc/user/nvim.html#nvim-from-vim
vim +PlugInstall +q +q
vim +'CocInstall coc-json coc-tsserver'
vim +'CocInstall @yaegassy/coc-ruff coc-rust-analyzer coc-pyright'
vim +'CocCommand ruff.builtin.installServer'
If you are using OS X, install vim and/or neovim from homebrew.
If using neovim, check out their documentation on how to support .vimrc
If you are using WSL please install all powerline fonts on windows and select it as the terminal font. See https://github.com/vim-airline/vim-airline/wiki/Dummies-Guide-to-the-status-bar-symbols-(Powerline-fonts)-on-Fedora,-Ubuntu-and-Windows#handling-the-delicate-flower-of-windows and https://stackoverflow.com/a/63148518/5375579
If you are using mac, deactivate Keyboard -> Keyboard Shortcut -> Input Sources "select the previous input source" See AstroNvim/AstroNvim#601
Example commands (NOTE: <leader> is currently , and <CR> is enter key)
-
Code of completion
gdgo to definitiongrfind referencesKshow documentation<leader>rnrename<leader>qfquick fix<leader>rerefactor<leader>rrefactor selected<space>ssearch in project
-
Comment
gcctoggle line comment (normal mode)gctoggle comment (visual mode)
-
File explorer (NERDTree):
sopen file in vertical splitìopen file in splittopen in new tab- Select the desired directory, press
m(NERDTree menu) and then aato create new file. End it with/to create a directory instead
-
Folds
- We'll autofold everything.
zMto fold everythingzRto unfold<space>orzato toggle open and close
-
Async executions via
tpope/vim-dispatch- Use
:Dispatch cmdto run a non blocking window a commands - Then use
:Copento open it
- Use
-
Workspace (vim-ctrlspace)
Ctrl+space baropen menu (base)wto show workspaces
-
Buffers (
#indicates buffer number):buffersto list them:b#go to buffer #:bdclose current buffer:bd#close buffer #:vs|b#or:sp|b#open buffer in split window
-
Git (using plugin vim-gitgutter)
:Gitfor direct git commands- Jump between hunks (changes)
[cand]c - Stage hunk
,hsunstage,hu - preview the hunk (git diff style)
,hp
-
Window (split) management
Ctrl+HleftCtrl+JdownCtrl+KupCtrl+LrightCtrl+Wqto close the window you are atCtrl+Woto focus on that split (closes all others)ctrl+W_Max out the height of the current splitctrl+W|Max out the width of the current splitctrl+W=Normalize all split sizes, which is very handy when resizing terminalCtrl+WRSwap top/bottom or left/right splitCtrl+WTBreak out current window into a new tabviewCtrl+Wolose every window in the current tabview but the current onectrl+W_Max out the height of the current splitCtrl+WRSwap top/bottom or left/right splitCtrl+WTBreak out current window into a new tabviewCtrl+Wolose every window in the current tabview but the current one
-
Documentation (asciidoctor):
- Compiles as HTML when saved
<leader>chto manually compile to html<leader>cpto compile to pdf<leader>bto bold selected text (in visual mode)<leader>ito italics selected text (in visual mode)
Extra: https://stackoverflow.com/questions/5400806/what-are-the-most-used-vim-commands-keypresses/5400978#5400978 https://www.vimfromscratch.com/articles/vim-for-python https://github.com/rapphil/vim-python-ide https://github.com/vim-ctrlspace/vim-ctrlspace