Skip to content

Instantly share code, notes, and snippets.

@Aditya-Jyoti
Last active June 3, 2025 21:55
Show Gist options
  • Save Aditya-Jyoti/79fb2b3406cb682079dc7b750ee7292b to your computer and use it in GitHub Desktop.
Save Aditya-Jyoti/79fb2b3406cb682079dc7b750ee7292b to your computer and use it in GitHub Desktop.
ZSH and NVIM configs

ZSH and NVIM configs

For NVIM

note: you may want to install lates nvim through their relases page

  • curl -LO https://github.com/neovim/neovim/releases/latest/download/nvim-linux-x86_64.tar.gz
  • sudo rm -rf /opt/nvim
  • sudo tar -C /opt -xzf nvim-linux-x86_64.tar.gz

and then add /opt/nvim-linux-x86_64/bin to PATH in .zshrc

  1. sudo apt install build-essential npm
  2. copy init.lua into ~/.config/nvim/init.lua
  3. reopen nvim

note: this is a striped down version of carderne's dotfiles

For ZSH

  1. sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"
  2. git clone https://github.com/zsh-users/zsh-autosuggestions ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-autosuggestions
  3. git clone https://github.com/zsh-users/zsh-syntax-highlighting.git ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-syntax-highlighting
  4. curl -sSfL https://raw.githubusercontent.com/ajeetdsouza/zoxide/main/install.sh | sh
  5. sudo apt install eza
  6. copy .zshrc into ~/.zshrc
  7. source ~/.zshrc
#########
## ZSH ##
#########
export ZSH="$HOME/.oh-my-zsh/"
ZSH_THEME="agnoster"
ZDOTDIR="$HOME/zsh"
HISTFILE="$HOME/.zsh_history"
COMPLETION_WAITING_DOTS="true" # Display red dots whilst waiting for completion.
plugins=(
zsh-autosuggestions
zsh-syntax-highlighting
)
source $ZSH/oh-my-zsh.sh
export PATH=$PATH:~/.local/bin
#############
## Aliases ##
#############
# Zoxide
eval "$(zoxide init zsh)"
alias cd="z"
### ENV
export EDITOR=nvim
export VISUAL=nvim
### LS
alias ls="eza --tree --level 1 --icons --group-directories-first"
alias la="eza --tree --level 1 --icons --group-directories-first --all"
-- -----------------------------------------------------------------------------------------------
-- General configuration
-- -----------------------------------------------------------------------------------------------
-- Basic settings
vim.opt.hlsearch = true
vim.opt.number = true
vim.opt.relativenumber = true
vim.opt.mouse = "a"
vim.opt.showmode = false
vim.opt.spelllang = "en_gb"
-- use nvim-tree instead
vim.g.loaded_netrw = 1
vim.g.loaded_netrwPlugin = 1
-- Use system clipboard
vim.opt.clipboard:append({ "unnamed", "unnamedplus" })
-- Display settings
vim.opt.termguicolors = true
-- scroll a bit extra horizontally and vertically when at the end/bottom
vim.opt.cursorline = true
vim.opt.signcolumn = 'yes'
vim.opt.wrap = false
-- Title
vim.opt.title = true -- set the title of window to the value of the titlestring
vim.opt.titlestring = "%<%F%=%l/%L - nvim" -- what the title of the window will be set to
-- Persist undo
vim.opt.undodir = vim.fn.stdpath("cache") .. "/undo"
vim.opt.undofile = true
-- Tab stuff
vim.opt.tabstop = 2
vim.opt.shiftwidth = 2
vim.opt.expandtab = true
vim.opt.autoindent = true
-- Search configuration
vim.opt.ignorecase = true
vim.opt.smartcase = true
vim.opt.gdefault = true
-- scroll a bit extra horizontally and vertically when at the end/bottom
vim.opt.sidescrolloff = 8
vim.opt.scrolloff = 8
-- open new split panes to right and below (as you probably expect)
vim.opt.splitright = true
vim.opt.splitbelow = true
-- Highlight trailing characters
vim.opt.listchars = {
-- eol = "↲",
tab = "▸ ",
trail = "·",
}
vim.opt.list = true
-- -----------------------------------------------------------------------------------------------
-- Keymap settings
-- -----------------------------------------------------------------------------------------------
-- Basic keys
vim.g.mapleader = " "
-- Easier redo
vim.keymap.set("n", "q", "<C-r>")
-- Search and Replace
vim.keymap.set("n", "<leader>h", ":%s/")
vim.keymap.set("n", "<leader>l", ":nohlsearch<CR><C-L>")
-- nvim-tree
vim.keymap.set("n", "<C-t>", ":NvimTreeFocus<CR>")
vim.keymap.set("n", "<C-f>", ":NvimTreeFindFile<CR>")
vim.keymap.set("n", "<C-c>", ":NvimTreeClose<CR>")
-- -----------------------------------------------------------------------------------------------
-- Plugin list
-- -----------------------------------------------------------------------------------------------
local plugins = {
{ "nvim-lua/plenary.nvim" },
-- Gruvbox theme with Treesitter support
{ "nvim-treesitter/nvim-treesitter", build = ":TSUpdate" },
{ "ellisonleao/gruvbox.nvim" },
-- Used by LuaLine and nvim-tree
{
"nvim-tree/nvim-web-devicons",
lazy = true,
},
-- Pretty indentation lines
{ "lukas-reineke/indent-blankline.nvim", main = "ibl" },
-- Status line at the bottom
{ "nvim-lualine/lualine.nvim" },
-- File browser
{ "nvim-tree/nvim-tree.lua" },
-- LSP
{
{ 'mason-org/mason.nvim', opts = {} },
{
'mason-org/mason-lspconfig.nvim',
dependencies = { 'neovim/nvim-lspconfig' },
opts = {}
},
},
}
-- -----------------------------------------------------------------------------------------------
-- Plugin installation
-- -----------------------------------------------------------------------------------------------
local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim"
if not vim.loop.fs_stat(lazypath) then
vim.fn.system({
"git",
"clone",
"--filter=blob:none",
"https://github.com/folke/lazy.nvim.git",
"--branch=stable",
lazypath,
})
end
vim.opt.rtp:prepend(lazypath)
require("lazy").setup(plugins)
-- -----------------------------------------------------------------------------------------------
-- Plugin config
-- -----------------------------------------------------------------------------------------------
vim.cmd.colorscheme("gruvbox")
require("nvim-tree").setup({
filters = {
dotfiles = true,
},
})
require("ibl").setup({
debounce = 100,
indent = { char = "▏" },
whitespace = { highlight = { "Whitespace", "NonText" } },
})
require("lualine").setup({
sections = {
lualine_a = {},
lualine_b = { "diff", "diagnostics" },
lualine_c = { { "filename", path = 1 } },
lualine_x = {},
lualine_y = { "progress" },
lualine_z = { "location" },
},
})
-- -----------------------------------------------------------------------------------------------
-- Treesitter
-- -----------------------------------------------------------------------------------------------
require("nvim-treesitter.configs").setup({
-- A list of parser names, or "all"
-- https://github.com/nvim-treesitter/nvim-treesitter/tree/master#supported-languages
ensure_installed = {
"bash",
"diff",
"dockerfile",
"git_rebase",
"terraform",
"yaml",
},
sync_install = false,
auto_install = true,
highlight = {
enable = true,
},
})
vim.opt.foldmethod = "expr"
vim.opt.foldexpr = "nvim_treesitter#foldexpr()"
vim.opt.foldlevel = 99
-- -----------------------------------------------------------------------------------------------
-- LSP stuff
-- -----------------------------------------------------------------------------------------------
require("mason").setup({})
require("mason-lspconfig").setup({
-- https://github.com/williamboman/mason-lspconfig.nvim#available-lsp-servers
ensure_installed = {
"bashls",
"dockerls",
"docker_compose_language_service",
"terraformls",
"yamlls",
},
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment