My configurations for terminals and code/text editors.
To clone this repo into your home directory:
export [email protected]:yogeshdhamija/dotfiles.git
# OR
export DOTFILES_REPO_URL=https://github.com/yogeshdhamija/dotfiles.git
source <(curl -Ls https://raw.githubusercontent.com/yogeshdhamija/dotfiles/master/dotfile-scripts/setup-dotfiles-environment.sh)
This will set up a git repository in the folder ~/.dotfiles
with a detached working tree. This way, you can treat your home directory if as if it were a git repository -- using the dotfiles
command, instead of git
-- and it won't do crazy stuff like interfere with your other git repositories. Source: this article. In summary: dotfiles status
, dotfiles commit
, dotfiles push
.
dotfiles-update # pulls new updates, including for submodules
dotfiles-check # checks if recommended programs installed
# use like git:
dotfiles status
dotfiles add file
dotfiles commit
dotfiles push
- Do not use the
dotfiles add .
command. This will add all the untracked files in your home directory, which is everything.- Instead, add things individually using
dotfiles add <file>
. - This also applies to other commands like
dotfiles commit -a
. - If you do this accidentally, you'll have to
Ctrl+C
out of it while it's stuck, or unstage all the files if it somehow succeeds.
- Instead, add things individually using
- This repo will configure the
bash
,zsh
, andfish
terminals. - These are the primary files used to configure things:
~/.bashrc
- for bash-only settings~/.zshrc
- for zsh-only settings~/.config/fish/config.fish
- for fish-only settings~/.shellrc
- for common settings across POSIX shells (bash
andzsh
)~/.shell_aliases
- for aliases (bash
,zsh
, andfish
)
- The following files will be auto-loaded if they exist, so you can make changes you don't want to commit:
~/.shellrc.local
~/.bashrc.local
~/.zshrc.local
~/.config/fish/config.fish.local
~/.shellrc.local.loadbefore
~/.bashrc.local.loadbefore
~/.zshrc.local.loadbefore
~/.config/fish/config.fish.local.loadbefore
- The
*.loadbefore
files are sourced before any other config.
- The
Configures editors to be vim-like. Editors are: Vim, Neovim, VSCode (with the VSCode-Neovim plugin), Jetbrains IDEs (with the IdeaVim plugin), Zed.
The ~/.vimrc
acts as the base where all mappings and commands are defined. Neovim and VSCode-Neovim configurations extend that file to override or add functionality.
-
All mappings and commands in
~/.vimrc
- These mappings call functions which can be defined in:
~/.vimrc
If it's either vim-specific, or an overrideable default implementation.~/.config/nvim/init.vim
If it's neovim-specific.~/.vscodevimrc
If it's vscode-neovim specific.
- These mappings call functions which can be defined in:
-
File sourcing order (from first to last) is:
~/.config/nvim/init.vim # only if Neovim
~/.vscodevimrc # only if VSCode-Neovim
.vim/vimrc.local.loadbefore
~/.vimrc.local.loadbefore
~/.vimrc
~/.vimrc.local
.vim/vimrc.local
- The
dotfiles-update
terminal command will install/update all Vim plugins, through thejunegunn/vim-plug
plugin manager.
Configuring vim plugins:
The *.local.loadbefore
vim files can be used to adjust which plugins are used. Common settings are:
" To add more plugins (using vim-plug)
if !exists("added_plugins")
let added_plugins = []
endif
let added_plugins = added_plugins + [
\["these_plugins_will/be_added_to_the_defaults", {}],
\]
" To disable certain default plugins
if !exists("disabled_plugins")
let disabled_plugins = []
endif
let disabled_plugins = disabled_plugins + ["neoclide/coc.nvim"]
" To run with ONLY specified plugins (not recommended)
if !exists("plugins")
let plugins = []
endif
let plugins = plugins + [
\["only_these_plugins/will_be_used", {}],
\]
The settings live in the editor-specific files. They try to duplicate the mappings and commands in ~/.vimrc
as much as possible. Files used are:
-
~/.ideavimrc
for Jetbrains IDEs' IdeaVim plugin.- Once plugin is manually installed, this file is auto-loaded by the default settings.
-
~/.config/zed/
for Zed.- Auto-loaded by Zed.
-
~/.config/Code/User/
for VSCode- Auto-loaded on linux. Can be symlinked to relevant config paths on Windows or OSX.
- Assumes
asvetliakov.vscode-neovim
,alefragnani.Bookmarks
, andryuta46.multi-command
plugins have been manually installed.
-
~/dotfile-backups/vscode/
for VSCode- These have VSCode profiles manually exported periodically, and must be manually imported using the VSCode UI.
- Plugins are included so they don't have to be manually installed.