diff --git a/README.md b/README.md index 55882dc..cb1d38c 100644 --- a/README.md +++ b/README.md @@ -40,6 +40,8 @@ For a glimpse into my journey and the projects I've been involved in, feel free - Encoding and Decoding Functions for Strings - Finding the Longest Consecutive Sequence in an Array - Linked Lists +- Developer Tools + - My Development Environment: kitty, zsh, Neovim, tmux, and lazygit ## Technologies Used - [Hugo Static Site Generator](https://gohugo.io/) diff --git a/config.yml b/config.yml index b488df2..3424ef4 100644 --- a/config.yml +++ b/config.yml @@ -51,7 +51,7 @@ outputs: params: env: production # to enable google analytics, opengraph, twitter-cards and schema. - description: "Hi, I'm Avnish. I am an Open Source Developer currently working at Red Hat. I write about Computer Science, Machine Learning, and Mathematics." + description: "Hi, I'm Avnish. I am an Open Source Developer working at Red Hat, I strive to share my knowledge on computer science, mathematics, and technology through articles." author: "Avnish Pal" # author: ["Me", "You"] # multiple authors @@ -90,14 +90,6 @@ params: - As an Open Source Developer working at Red Hat, I strive to share my knowledge on computer science, mathematics, and technology through articles. If you'd like to stay in the loop with the latest content from this blog, I invite you to subscribe to my RSS feed. - For a glimpse into my journey and the projects I've been involved in, feel free to check my resume. - - # - I'm an Open Source Developer currently working at Red Hat. - - # - I write about Self-Hosting, Homelab, and DevOps Technologies. - - # - Subscribe to my newsletter to stay up-to-date with latest articles published on this blog. - - # - Download my resume to learn about my projects and work experience. socialIcons: - name: cv diff --git a/content/contents.md b/content/contents.md index 6e79f42..597c5b5 100644 --- a/content/contents.md +++ b/content/contents.md @@ -39,3 +39,5 @@ summary: "Index of all content" * Encoding and Decoding Functions for Strings * Finding the Longest Consecutive Sequence in an Array - Linked Lists +- Developer Tools + - My Development Environment: kitty, zsh, Neovim, tmux, and lazygit diff --git a/content/posts/developer-tools/_index.md b/content/posts/developer-tools/_index.md new file mode 100644 index 0000000..43e02c4 --- /dev/null +++ b/content/posts/developer-tools/_index.md @@ -0,0 +1,5 @@ +--- +title: Developer Tools +summary: Contains posts related to `Developer Tools` +description: Contains posts related to Developer Tools +--- diff --git a/content/posts/developer-tools/my-development-environment/devenv-screencast.gif b/content/posts/developer-tools/my-development-environment/devenv-screencast.gif new file mode 100644 index 0000000..b5885cf Binary files /dev/null and b/content/posts/developer-tools/my-development-environment/devenv-screencast.gif differ diff --git a/content/posts/developer-tools/my-development-environment/index.md b/content/posts/developer-tools/my-development-environment/index.md new file mode 100644 index 0000000..92e5f37 --- /dev/null +++ b/content/posts/developer-tools/my-development-environment/index.md @@ -0,0 +1,298 @@ +--- +author: "Avnish" +title: "My Development Environment: kitty, zsh, Neovim, tmux, and lazygit" +date: "2023-12-21" +description: "I am switching to Neovim" +tags: ["tools","vim","neovim","code-editor","IDE","tmux","kitty","zsh","lazygit","dotfiles"] +categories: ["Developer Tools"] +series: ["Developer Tools"] +aliases: ["my-development-environment"] +ShowToc: true +TocOpen: false +cover: + image: "devenv-screencast.gif" + linkFullImages: true + alt: "Screen Recording from my development workflow" + caption: "Screen Recording from my development workflow" + relative: true + responsiveImages: false +comments: false +--- + +Until now I've been using Visual Studio Code as my primary code editor because I try different Linux distributions on my laptop and VSCode is available by default in almost every application manager. When I open a new project, the VSCode suggests relevant extensions based on the tech stack. + +After hearing the praises for Neovim from Primeagen and TJ DeVries I decided to give it a go along with other command line utilities like `tmux` and `lazygit` to test if they optimize my development workflow. + +I use vim motions in all workflows related to text whether it is writing code in VSCode (using VIM Plugin) or my journal in Obsidian. I also use `vim` occasionally to perform quick edits on configuration files while I've SSH into a remote machine. + +I have configured key bindings to navigate inside VSCode and throughout my system. Thus, adapting to a terminal and key binding-focused workflow won’t be difficult. + +# Terminal: Kitty +

kitty logo

+

Source: sw.kovidgoyal.net

+ +I have provisioned a Fedora 38 virtual machine on my homelab as a persistent development environment. On it, I use kitty as my terminal emulator because it is lightweight and it could be configured by a single file `~/.config/kitty/kitty.conf`. + +## Installation +`kitty` is available as a `dnf` package by default in Fedora. +```bash +sudo dnf install kitty +``` + +## Configuration +I have made the following changes to the default kitty configuration (`kitty.conf`) +* Changed font family to JetBrains Mono. +``` +font_family JetBrainsMonoNF-Regular +bold_font JetBrainsMonoNF-Bold +``` +* Font size changed to 16 +``` +font_size 16.0 +``` +* Changed cursor for aesthetics +``` +cursor_shape beam +cursor_beam_thickness 10.0 +cursor_blink_interval -1 +``` +* Changed mouse cursor hiding time to 2 seconds +``` +mouse_hide_wait 2.0 +``` +* Enabled URL detection so that I visit them directly from my terminal +``` +detect_urls yes +``` +* Configuring copy on selection to send it directly to the clipboard. It's useful when I have to quickly share a command's output with someone else. +``` +copy_on_select clipboard +``` + +If you want to test your kitty configuration changes then it might be useful to change the default key binding for reloading configuration to be something more accessible like `Ctrl+f5`. +``` +map ctrl+f5 load_config_file +``` + +# Shell: ZSH +

zsh logo

+

Source: Zsh-art/logo

+ +I use zsh along with oh-my-zsh because of its aesthetics and the git information displayed on its prompt. + +## Installation +1. Installing `zsh` +```bash +sudo dnf install zsh +``` +2. Changing default shell to `zsh` +```bash +chsh -s $(which zsh) +``` +3. Logout and log back in with the same user +4. Installing Oh-My-Zsh +```bash +sh -c "$(curl -fsSL https://raw.github.com/ohmyzsh/ohmyzsh/master/tools/install.sh)" +``` +5. Add path to your `oh-my-zsh` configuration in `~/.zshrc` +``` +export ZSH=$HOME/.oh-my-zsh +``` +## Configuration +I have performed the following edits on my `~/.zshrc` file + +* Changed the `zsh` theme to `bureau` in the `~/.zshrc` file +``` +ZSH_THEME="bureau" +``` +* Installed the `zsh-autosuggestions` plugin +```bash +git clone https://github.com/zsh-users/zsh-autosuggestions ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-autosuggestions +``` +* Installed the `zsh-syntax-highlighting` plugin +```bash +git clone https://github.com/zsh-users/zsh-syntax-highlighting ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-syntax-highlighting +``` +* Enabled plugins in `~/.zshrc` +```zshrc +plugins=( + git + zsh-autosuggestions + zsh-syntax-highlighting + docker +) +``` + +You can load your `zsh` configuration using the `source` command. +```bash +source ~/.zshrc +``` + +# Terminal Multiplexer (`tmux`) +

tmux logo

+

Source: tmux wiki

+ +`tmux` allows me to run multiple terminal sessions that could be detached (sent to background) and reattached upon requirement. I use it to maintain persistent terminal sessions across multiple SSH clients. + +## Installation +```bash +sudo dnf install tmux +``` + +## Configuration +Here are some changes I've made to `~/.config/tmux/tmux.conf`. + +* Changed the prefix key combination from `Ctrl+B` to `Ctrl+Space` because it is more ergonomic for me. +``` +unbind C-b +set -g prefix C-Space +bind C-Space send-prefix +``` +* Enabled mouse support because I want more control over window resizing. +``` +set -g mouse on +``` +* Set base index for windows to 1 +``` +set -g base-index 1 +set -g pane-base-index 1 +set-window-option -g pane-base-index 1 +set-option -g renumber-windows 1 +``` +* Added some custom key bindings for creating and switching between windows +``` +bind -n C-y previous-window +bind -n C-o next-window +bind | split-window -h -c "#{pane_current_path}" +bind _ split-window -v -c "#{pane_current_path}" +``` +* To install plugins for `tmux` I have installed tmux plugin manager or `tpm` +``` +set -g @plugin 'tmux-plugins/tpm' +``` +and added this line at the end of `tmux.conf` +``` +run '~/.tmux/plugins/tpm/tpm' +``` + +Here are some of the plugins I've installed for `tmux` +* tmux-sensible: Helps me set custom key bindings for my workflow +* vim-tmux-navigator: Enables window navigation using vim keys (`h,j,k,l`) +* tmux-resurrect: Using this I can save and restore my tmux sessions across reboots. I might switch to tmuxifier to define my tmux sessions in a file rather than saving and reloading them. +* tmux-yank: To copy text from tmux directly to the system's clipboard. + +To load your tmux configuration changes you can use the `source` command +```bash +source ~/.config/tmux/tmux.conf +``` +and to install plugins you have to use keybinding `Ctrl+Space,i`. + +# Code Editor: Neovim (LazyVim) +

neovim logo

+

Source: neovim.github.io

+ +Neovim is a fork of VIM that could be used as a base to develop a *Personalized Development Environment (PDE)*. It has multiple distributions but the one I'm using is LazyVim, a minimalist configuration for Neovim. It's a distribution alternative to kickstart.nvim configuration. + +## Installation +```bash +sudo dnf install neovim +``` +## Configuration +To install LazyVim follow the guide at lazyvim.org. I've made the following changes to LazyVim's default configuration + +* Toggled visibility of hidden files and folders in neo-tree (`~/.config/nvim/lua/plugins/neotree.lua`) +```lua +return { + "nvim-neo-tree/neo-tree.nvim", + opts = { + filesystem = { + filtered_items = { + visible = true, + hide_dotfiles = false, + hide_gitignored = true, + }, + }, + }, +} +``` + +* Configured `vim-tmux-navigator` key bindings (`~/.config/nvim/lua/plugins/vim-navigator.lua`) + +```lua +return { + "christoomey/vim-tmux-navigator", + keys = { + { "", "TmuxNavigatePrevious", desc = "Go to the previous pane" }, + { "", "TmuxNavigateLeft", desc = "Got to the left pane" }, + { "", "TmuxNavigateDown", desc = "Got to the down pane" }, + { "", "TmuxNavigateUp", desc = "Got to the up pane" }, + { "", "TmuxNavigateRight", desc = "Got to the right pane" }, + }, +} +``` +# Git Client: lazygit +

lazygit logo

+

Source: jesseduffield/lazygit

+ +I like the Source control pane in the VScode and it has been my go-to client for all git operations. Going through my changes in the source control window allows me to review them before I commit to my repository. I opted for `lazygit` as its alternative. + +

Source Control pane in VSCode Sidebar

+

Source Control Pane in VSCode Sidebar

+ +In its primary window, the `lazygit` has an overview of changes performed after the last commit. It could be accessed directly from the Neovim using the key binding `Space,g,g`. + +

Lazygit Window

+

Lazygit Window

+ +I can perform git operations using a single button inside the lazygit window +* Stage all files: `a` +* Stage current file: `Space` +* Commit all staged changes: `c` +* Pull changes to remote: `p` +* Push changes to remote: `P` + +## Installation +To install `lazygit` in Fedora I had to add its Copr repository +```bash +sudo dnf copr enable atim/lazygit -y +sudo dnf install lazygit +``` + +# Theme: Tokyo Night +On kitty, Neovim, and tmux I am using the Tokyo Night theme. The theme configuration for all of them is available at folke/tokyonight.nvim. + +

Terminal

+

Terminal

+ +

Terminal Multiplexer

+

Terminal Multiplexer (tmux)

+ +

Text Editor

+

Text Editor

+ +

Source Control UI

+

UI for Source Control

+ +All of my configuration files are available at bovem/dotfiles. + +
+Thank you for taking the time to read this blog post! If you found this content valuable and would like to stay updated with my latest posts consider subscribing to my RSS Feed. + +# Resources +Visual Studio Code +VIM Plugin for VSCode +Obsidian +kitty terminal emulator +zsh +oh-my-zsh +JetBrains Mono +tmux +tmux plugin manager +tmux-sensible +vim-tmux-navigator +tmux-resurrect +tmuxifier +tmux-yank +Neovim +Lazyvim Installation Guide +folke/tokyonight.nvim diff --git a/content/posts/developer-tools/my-development-environment/kitty-terminal.png b/content/posts/developer-tools/my-development-environment/kitty-terminal.png new file mode 100644 index 0000000..ddc566e Binary files /dev/null and b/content/posts/developer-tools/my-development-environment/kitty-terminal.png differ diff --git a/content/posts/developer-tools/my-development-environment/lazygit-project-window.png b/content/posts/developer-tools/my-development-environment/lazygit-project-window.png new file mode 100644 index 0000000..8494f82 Binary files /dev/null and b/content/posts/developer-tools/my-development-environment/lazygit-project-window.png differ diff --git a/content/posts/developer-tools/my-development-environment/lazygit-window.png b/content/posts/developer-tools/my-development-environment/lazygit-window.png new file mode 100644 index 0000000..b7e1d95 Binary files /dev/null and b/content/posts/developer-tools/my-development-environment/lazygit-window.png differ diff --git a/content/posts/developer-tools/my-development-environment/neovim-window.png b/content/posts/developer-tools/my-development-environment/neovim-window.png new file mode 100644 index 0000000..03d66a9 Binary files /dev/null and b/content/posts/developer-tools/my-development-environment/neovim-window.png differ diff --git a/content/posts/developer-tools/my-development-environment/source-control-vscode.png b/content/posts/developer-tools/my-development-environment/source-control-vscode.png new file mode 100644 index 0000000..2bbb1dd Binary files /dev/null and b/content/posts/developer-tools/my-development-environment/source-control-vscode.png differ diff --git a/content/posts/developer-tools/my-development-environment/tmux-window.png b/content/posts/developer-tools/my-development-environment/tmux-window.png new file mode 100644 index 0000000..5d44fe6 Binary files /dev/null and b/content/posts/developer-tools/my-development-environment/tmux-window.png differ