Vim
Written on January 4, 2023 by Fiqry choerudinJanuary 4, 2023It's been 3 months since I started using Vim as my secondary IDE. I began learning how to use Vim because I saw my friend using it as his daily IDE and I thought it was so cool. At the first time I used Vim, I wanted to give up because it was so hard 😂. There were so many key bindings I had to remember and it was hard to configure. After a month of using it, I started enjoying Vim as my IDE because it was getting easier to use and simpler to configure. I use tmux, fish shell, and Neovim as my primary setup for my terminal, and I also started creating aliases for faster workflows.
Heres how i configure vim for my workflows , i use craftzdog dotfile and started modified for my personal use, here's my config :
Ingredients
- vim (NeoVim)
- tmux
- fish
Tmux action key
# action key
unbind C-b
set-option -g prefix C-t
set-option -g repeat-time 0
set-option -g focus-events on
#### Key bindings
set-window-option -g mode-keys vi
#bind t send-key C-t
# Reload settings
bind r source-file ~/.tmux.conf \; display "Reloaded!"
# Open current directory
bind o run-shell "open #{pane_current_path}"
bind -r e kill-pane -a
# vim-like pane switching
bind -r k select-pane -U
bind -r j select-pane -D
bind -r h select-pane -L
bind -r l select-pane -R
# Moving window
bind-key -n C-S-Left swap-window -t -1 \; previous-window
bind-key -n C-S-Right swap-window -t +1 \; next-window
# Resizing pane
bind -r C-k resize-pane -U 5
bind -r C-j resize-pane -D 5
bind -r C-h resize-pane -L 5
bind -r C-l resize-pane -R 5
Shell setup (macOS & Linux)
- Fish shell.
- Fisher - Plugin manager.
- Tide - Shell theme. Use version 5:
fisher install ilancosman/tide@v5
. - z for fish - Directory jumping.
- Exa -
ls
replacement. - Trash -
rm
replacement.
Neovim setup
Requires Neovim (>= 0.8)
- wbthomason/packer.nvim - A plugin manager for Neovim
- svrana/neosolarized.nvim - A truecolor, solarized dark colorscheme
- nvim-lualine/lualine.nvim - A blazing fast and easy to configure Neovim statusline written in Lua
- onsails/lspkind-nvim - VSCode-like pictograms
- L3MON4D3/LuaSnip - Snippet Engine for Neovim written in Lua
- hrsh7th/cmp-nvim-lsp - nvim-cmp source for neovim's built-in LSP
- hrsh7th/cmp-buffer - nvim-cmp source for buffer words
- hrsh7th/nvim-cmp - A completion engine plugin for neovim written in Lua
- neovim/nvim-lspconfig - A collection of configurations for Neovim's built-in LSP
- jose-elias-alvarez/null-ls.nvim - Use Neovim as a language server to inject LSP diagnostics, code actions, and more via Lua.
- williamboman/mason.nvim - Portable package manager for Neovim that runs everywhere Neovim runs. Easily install and manage LSP servers, DAP servers, linters, and formatters
- williamboman/mason-lspconfig.nvim - Extension to mason.nvim that makes it easier to use lspconfig with mason.nvim
- glepnir/lspsaga.nvim - A light-weight lsp plugin based on neovim's built-in lsp with a highly performant UI
- nvim-treesitter/nvim-treesitter - Treesitter configurations and abstraction layer for Neovim
- kyazdani42/nvim-web-devicons - Lua
fork
of vim-web-devicons for neovim - nvim-telescope/telescope.nvim - A highly extendable fuzzy finder over lists
- nvim-telescope/telescope-file-browser.nvim - File Browser extension for telescope.nvim
- windwp/nvim-autopairs - Autopairs
- windwp/nvim-ts-autotag - Use treesitter to auto close and auto rename html tag
- norcalli/nvim-colorizer.lua - A high-performance color highlighter
- akinsho/nvim-bufferline.lua - A snazzy bufferline
- lewis6991/gitsigns.nvim - Git integration for buffers
- dinhhuy258/git.nvim - A simple clone of the plugin vim-fugitive
- folke/zen-mode.nvim - Distraction-free mode
- iamcco/markdown-preview.nvim - Markdown live preview
Aliases config :
# aliases
alias ls "ls -p -G"
alias la "ls -A"
alias ll "ls -l"
alias lla "ll -A"
alias . "nvim ."
# git aliases
alias g git
alias ga "git add ."
alias gcm "git commit -m"
alias gpo "git push origin"
alias gco "git checkout"
alias clone "git clone"
# go alias
alias gr "go run"
alias gb "go build"
# yarn aliases
alias yd "yarn run dev"
alias yi "yarn install"
alias yad "yarn add"
# pnpm alias
alias pi "pnpm install"
alias pd "pnpm run dev"
alias ps "pnpm run start"
alias pt "pnpm run test"
# vm alias
alias vm "ssh vm"
# create react app
alias cra "npx create-next-app --example https://github.com/fiqryq/next-boilerplate"
alias ide "tmux split-window -v -p 30"