Please change your name and email in <cloned_repo_dir>/git_configs/gitconfig
file after you cloned this repo.
Following tools will be installed on system. Installation commands for these tools are mentioned below for macos
- tmux (terminal multiplexer)
- pcre (used as dev dependency while compiling nnn)
- fd (modern find written in rust)
- bat (colourful cat)
- fzf (fuzzy finder)
- ripgrep (modern grep written in rust)
- oh-my-zsh (is being installed as part of script)
- vim => 8.0
- nvim
- perl (used in various scripts)
- greadlink (part of coreutils)
- jq (parsing json)
- yq (parsing yaml)
- meld (gui file diff)
- git
- tree
- mktemp
- exa (for git fuzzy)
- git-delta (for git diff)
- lsd (ls with icons, aliased to ls)
- nnn (terminal file manager with icons, is being compiled and installed as part of download script)
- font-hack-nerd-font (set iterm2 font: "Hack Nerd Font Propo", font-style: regular, font-size: 15)
- nvm (to install node.js. Node is used by VIM CoC plugin)
- pyenv (to install python and to get python version in prompt)
- asdf (to manage different versions of kubectl)
brew tap homebrew/cask-fonts
brew install --cask font-hack-nerd-font
brew install tmux pcre fd bat fzf ripgrep vim coreutils git tree git-delta lsd nvm pyenv asdf nvim pinentry-mac gnupg tfenv exa jq yq meld universal-ctags lazygit
pyenv install 3.10.0
pyenv global 3.10.0
nvm install --lts
nvm use --lts
# node --version
# v16.13.0
nvm alias default 16.13.0
tfenv install
tfenv use 1.1.2
# Install language servers for nvim
npm install -g neovim
brew install hashicorp/tap/terraform-ls stylua shellharden rust-analyzer prettier pyright bash-language-server write-good ansible-language-server yaml-language-server gopls lua-language-server
pip3 install neovim
You need to set this font in your iterm2. You may install other fonts as well.
font: "Hack Nerd Font Propo", font-style: regular, font-size: 15
.tmux.conf
.zprofile
.zshrc
.vimrc
.gitconfig
Note: You can clone the repo anywhere you like and it should work.
git clone https://github.com/spareslant/dotFiles.git
cd dotFiles
./downloadAndCreateSymLinks.sh
Note: if above script fails on CoC, then run following three commands and run script ./downloadAndCreateSymLinks.sh
again. Even if above steps are successful you still need to run following commands in order to run CoC
properly in vim
.
cd downloaded/vim-plugins/coc.nvim
npm install esbuild
npm run build
Run following command
base16_gruvbox-dark-hard
Restart the terminal.
asdf plugin-add kubectl https://github.com/asdf-community/asdf-kubectl.git
asdf install kubectl 1.20.11
asdf global kubectl 1.20.11
- This script will download various
vim
plugins andoh-my-zsh
shell and its plugins in<cloned_repo_dir>/downloaded
directory. - This will set your shell to
zsh
- It will create various symlinks from your
homedir
to<cloned_repo_dir>
e.g.vimrc
,.zshrc
,.zprofile
etc. - Run
ls -la $HOME
command to see what is being symlinked. - Compiles
nnn
(terminal file browser) - creates various shell functions.
- Script is idempotent and can be run repeatedly without any harm
- Run
ls -la $HOME
command to see what is being symlinked to<cloned_repo_dir>
directory and make a note of it. - Change your shell and Remove
<cloned_repo_dir>
directory. - Remove symlinks noted above.
- Brew packages can be uninstalled using brew command.
- Method-1: Remove vim plugin directory from
<cloned_repo_dir>/downloaded/vim-plugins
location and restart VIM. You can re-install this plugin by just running./downloadAndCreateSymLinks.sh
script again. - Method-2: Alternatively remove the vim-plugin entry in
./downloadAndCreateSymLinks.sh
(insidedownloadVimPlugins
) and run./downloadAndCreateSymLinks.sh
again. It will remove the vim-plugin
- Add the git repo of vim plugin in
./downloadAndCreateSymLinks.sh
script where you see all the vim plugins list (insidedownloadVimPlugins
function).
- Colourful
ls
output. - Soothing terminal, vim and tmux theme (base16_gruvbox)
git diff
is more colourfulzsh
default command line mode isvi
.- To edit a long command in terminal more effectively, press
<ESC>vv
. This will openvim
where you can edit command and exit when done.
- To edit a long command in terminal more effectively, press
- Run
base16<tab><tab>
to set more terminal themes. tmux
tricks- In
tmux
, runctrl+b g
to capture the entire session in current pane. A timestamped file will be created in your home directory.ctrl+b g
will create new file everytime. - If using
tmux
, then it will show you active and inactive tmux panes. - If using
tmux
, you can search for words in the terminal and scroll/copy/select in terminal usingvi
keys. - Move
tmux panes
easily amongtmux windows
.- Use
ctrl+b m
to mark the pane you want to move to another tmux window. - Switch to the desired tmux window by pressing
ctrl+b <tmux window number>
. - Now press
ctrl+b [h|j|k|l]
to bring marked pane here.h, j, k, l
keys are taken fromvim
motion keys. h
=> to the left of current pane,j
=> to the bottom,k
=> to the top,l
=> to the right
- Use
- In
- In a
git
repo directory, rungit fuzzy log
to browse and search git history in nicer way. UseShift-<up|down arrow>
to scroll up and down. ctrl+r
will give you nicer command history.nnn
a nice icon based terminal file-browser (aliased to n). just runn
to play with it andq
to quit.nnn
has its own 4 tabs. Each tab maintains its own state.nnn
is highly customizable. You can launch programs and can write your own plugins.- press
.
to toggle hidden files, andt
to sort by time. Get help with?
- use
vim
keys to navigate and search (h
,j
,k
,l
,/
)
- Command prompt with icons
-
Uses
vim
built-in plugin manager -
CoC
plugin gives youvscode
like customization features for development.- e.g Install
python
support invim
by running:CocInstall coc-pyright
and so on.
- e.g Install
-
Open
nnn
file browser insidevim
by<spacebar> n
, makingvim
like IDE.- Use
ctrl+v
to open file in vertical split andctrl+s
to open file in horizontal split.
- Use
-
Open pop up terminal inside
vim
by pressing<spacebar>fn
. Toggle the presence of pop-up terminal by pressing<spacebar>ft
. -
Editing file in
git
invim
will give inform you about what lines are added (showing+
sings), deleted (showing-
signgs) and changed (showing~
signs).- You can revert these changes by pressing
<spacebar>hu
.
- You can revert these changes by pressing
-
vim
shows light vertical indent lines. -
Look for
nnn
,fzf
,gitgutter
andfloatterm
vim plugins documentation for more tricks. -
nvim
tricks- Most of the plugins used in
nvim
arelua
based, hencenvim
is fast. - Inside
nvim
press<ALT>e
to open file explorer. InMacOS
press<right option>e
. See at the end, how to set your iterm-2 right option key as<ALT>
key.- press
g?
for nvim-tree help
- press
- Press
<spacebar>tt
to opennvim telescope
. You can search a number of items in telescope. e.g grep in all files.- Press
<C-t>
to open search results in nvimtrouble
quickfix
list. - Press
<C-q>
to open search results in traditionalquickfix
list. - By default
telescope
opens in directory wherenvim
was launched. This can be confirmed via running:pwd
command.pwd
can be changed in number of ways.- first one is to use
:cd <tab><tab>
- Second one is to use
nnn
- Press
<spacebar>np
to launchnnn
in a float window. - navigate via
arrow keys
orhjkl
keys to reach desired directory. - press on the desired directory or file to select it.
- Now press
<ALT-w>
to change the nvim working directory. - At this time
nnn
may switch to another folder, simply pressq
to quit. - confirm it by running
:pwd
command.
- Press
- first one is to use
- Press
- Press
<spacebar>tr
to resume the search in telescope where you left last time. - Git history of a file can be viewed.
- Press
<C-\>c
to open a terminal in a pop-up window. (Floatterm)<C-\>z
to enlarge the pop-up window.<C-\>s
to small it.<C-\>l
to place it vertically on right.<C-\>h
to place it vertically on left.<C-\>j
to place it horizontally at bottom.<C-\>t
to toggle the visibility of floatterm<C-\>r
rotate among floating terminals<C-\><C-n>
to switch invim normal
mode in terminal.
- To get full path of current open file, in normal mode press
"%p
i.e paste the content of%
register- or
:echo expand("%:p")
or:echo expand("%")
- or
- code related
<C-<space>>
invokes manual suggesstions for code<C-<space><space>>
invokes documentation on word when editing rust file.
- Select text using
V
j
ork
keys, and then pressgc
. This will comment the code <C-q>
opens all errors in quickfix window<space-e>
shows current error in code at a specific highlighted line.<space>f
or<space>nf
to format the current buffer.- You may need to set the filetype if it does not work. e.g
:set filetype=markdown
<space>f
uses language server to format<space>nf
uses null-ls to format
- You may need to set the filetype if it does not work. e.g
<space>xd
to view all errors in current buffer<space>xw
to view all errors in current workspace/project<space>tld
toggle diag errors in current buffer
- Most of the plugins used in
IndentLine
vim plugin does not showjson
files correctly. It does not show double-quotes due to a bug. You can disable this feature while editing json file by running command:IndentLinesDisable
in vim
System Preference
->Keyboard
->key repeat
=Fast (take the marker to extreme right)
System Preference
->Keyboard
->Delay Until Repeat
=Short (take the marker to extreme right)
defaults write NSGlobalDomain KeyRepeat -int 1
- reboot required after running above command.
- Official setting is
2
Ref: https://stackoverflow.com/questions/4489885/how-can-i-increase-the-cursor-speed-in-terminal
iterm2 Preferences
->General
->Selection Tab
-> checkApplications in Terminal may access clipboard
iterm2 Preferences
->Profiles
-> Create new profile with nameDropDown
-> selectDropDown
->Text tab
-> set font toHack Nerd Font Propo
->Regular
->15
iterm2 Preferences
->Profiles
-> selectDropDown
->Window tab
->style => Maximized
,Screen => Screen with Cursor
,Space => current Space
iterm2 Preferences
->Profiles
-> selectDropDown
->Keys Tab
->check => A hotkey opens a dedicated window in this profile
,click => Configure Hotkey Window
->Set Hotkey to <option><Space>
,check => Pin hotkey window (stays open on loss of keybaord focus)
,check => Show this Hotkey window
iterm2 Preferences
->Profiles
-> selectDropDown
->Keys Tab
->Left Option Key => Normal
,click => apps can change this
,Right Option Key => ESC+
Right Option Key => ESC+
allows right option key to be used as<ALT>
key by applications. e.gFZF
andneovim
iTerm2
themes are also downloaded bydownloadAndCreateSymLinks.sh
script. These themes can be installed by following steps.
cd <cloned_repo_dir>/downloaded/extraShellUtilities/Gogh/themes/
./peppermint.sh
cd <cloned_repo_dir>/downloaded/extraShellUtilities/iTerm2-Color-Schemes
tools/import-scheme.sh 'schemes/ayu.itermcolors'
- Note: Above steps install
peppermint
theme iniTerm2
iterm2 Preferences
->Profiles
-> Create new profile with nameDropDown
-> selectDropDown
->Colors
tab ->Color Presets..
->Peppermint
- Some interesting themes
Ayu Dark
JellyBeans
TomorrowNight
Pastel (Dark Background)
=> pre-installed iniTerm2