Enhance your Workflow with Tmux and LazyVim
🦍

Enhance your Workflow with Tmux and LazyVim

Table of contents



LazyVim and tmux
This is how my entire setup looks like.
  • I do have a next js project opened on the left side with 4 sessions
      1. runDev for staring and installing dependencies
      1. CodeHere for writing code
      1. lazygit for managing vcs
      1. zsh another window.
  • In the top right there’s a java leetcode question ( I suck at DSA)
  • in the below another pane opened.
notion image
Neovim, aka Nvim, is a highly extensible text editor well-suited for terminal-based text editing tasks. It inherits many features from its predecessor, Vim, while adding enhancements and improving usability.

Now what is LazyVim?

  • LazyVim is Neovim setup powered by lazy.nvim

Benefits

  • Insanely fast 🚀 and efficient in executing commands and editing textđź“ť.
  • Highly customizable🛠️. Thanks to plugins.
  • Navigate🧭 and edit your code without exiting terminal.

Few Prerequisites

  • Basic knowledge of CLI.
  • nerd font installed.
  • ‣
    • Make your boring terminal look cool.
  • Basic Vim commands
    • VIM or Vi Improved, is a free and open-source text editor for the terminal.
      Here are few commands to learn VIM.
      Vim Commands
      1.) gg - go to the top of the page 2.) G - go to the bottom of the page 3.) 0 - go to the starting of the line even if spaces are there it goes to the atmost start of the line ** ^ - go to the start of the line where words begin 4.) $ - go to the end of the line 4.) w- go to the first character of the next word 5.) e - go to the end character of the next word 6.) b - go to the first character of the previous word 7.) W, E, B - does the same work as the above commands but skips the other characters and traverses through words only 8.) / - forward search 9.) ? - backward search 10.) h(<-), l(->) 11.) j(down), k(up) 12.) dd - delete entire line 13.) dw - delete word ** Number* dw => delete N number of words 14.) d$ - delete till the end of the line from the cursor
      *** d^ - deletes till the start of the line from the cursor 15.) p - paste 16.) yy - copy the entire line 17.) yw - copy the word 18.) y$ - copy till the end of the line from the cursor ******19.) :%s/wordtobepalced/replacingword/g - entire document changes (if we use gc in the end it asks for y or n for every instance) 20.) :form,to s/ wordtobepalced/replacingword/g - certain number of lines 21.) ctrl+ V - select over a certain area 22.) V - select over line 23.) x - delete character 24.) s- delete character and goes to insert mode 25.) r - replace text 26.) c- change -> goes to the insert mode deleting that word 27.) c$ => deletes from cursor and goes to insert mode 28.] cw => deletes that word and goes to insert mode 29.) n - goes to the next instance of the word 30.) N - goes to the previous instance of the word 31.) f - followed by character => moves till the next character is found 32.) F - same as above but reverse search 33.) H - goes to the top of the visible screen 34.) L - goes to the bottom of the visible screen 35.) M - goes to the mid of the visible screen 36.) ctrl + enter => create a new line 37.) ddp - moves the line down 38.) ddkP - move line up 37.) ddp - moves the line down
      38.) yi” - copy inside double quotes
      Huh!🤔 too many right! Don’t worry you gotta learn few first then everything will get handy. The best part is you don't ever need a mouse 🦍.
    • Though there’s a heavy learning curve it’s just worth it. I know coming out of VS code is hard :’)
    • There are essentially 3 modes normal , visual and `

Configuration

  • the configuration is pretty simple and stright forward as explained here ‣
  • Plugins are highly customizable and can look at my dotfiles for further info.

Usage

  • Go to your required directory and type nvim that’s it, you are good to write your code now.
  • Here are few commands you can pay a visit although documentation has everything.
neovim commands
  1. sf (n) _ telescope in root dir
  1. ;r - search word
  1. \\ - open all buffers
  1. rn - file rename
  1. ctrl + R -redo
  1. jk(i)_ moves to normal mode
  1. leader + e ⇒ file explorer
  1. TODO: (xyz) in file
  1. leader + s + t ⇒ searches for all todos
  1. ctrl + n ⇒ moves down in suggestions
  1. ctrl + p ⇒ moves up in suggestions
  1. gd _ go to definintion ( we can click on import to go where it was defined)
  1. :bd - close tab
  1. ss - hori pane
  1. sv - vertical split
  1. shift + (h,l,jk) movemnts to the tabs
  1. ctrl + (h,l,j,k) movements to panes
  1. leader + r + c ⇒ ICE rename
  1. leader + R ⇒ rename all
  1. o ⇒ new line down
  1. O ⇒ new line up
  1. p ⇒ paste down
  1. P ⇒ paste up
  1. shift + k ( in visual mode ) ⇒ moves line up and same for ( shift + j ) down
  1. leader + xx ( shows diagnostics)
  1. leader + c ⇒ code actions
    1. importing organizing
    2. remove unused imports
  1. leader + b ⇒ buffers
  1. gcc ⇒ commenting
  1. ctrl + r ⇒ redo
  • The best part is these are also customizable.
  • This comes with lazygit which is a awesome place to make commits pull, push, check status, and do everything you need using git.
notion image

Tmux

  • Now another thing comes up which is tmux (terminal multiplexer).
    • Advantages
    • Persistent sessions: Detach and reattach sessions, ensuring your work is never lost
    • Efficient window and pane management: Split your terminal into multiple windows and panes
    • Improve productivity: Run multiple things within a single window.
  • tmux and neovim can interact with easily together that the super power of it.
  • This is also highly customisable and looks awesome like mine. ( I love my terminal)
  • This is how my entire working environment looks like.

Conclusion

It feels like confusing in the start while configuring LSP’s and managing sessions. Trust me I’ve gone through this and once you get over it you will enjoy the ride.
Step out of comfort zone and give it a try! I am sure you will fall in love with the power of tmux and lazyVim.
I will post a blog separately on both lazyVim and tmux right from the scratch.
Â