I’ve always been aware of was the .vimrc file. Like many configuration files and with many cli tools there were far too many customization options. One of the youtube videos I watched recommended that I ask a colleague for their configuration. I’ve even seen other configurations online. Problematically a file created by someone else is usually large, unexplained, and when you steal the config you’ll be lucky to remember a fraction of the new settings you’ve now adopted.
I figured why not ask the AI Gods 🧠 what I should put? Go step-by-step and have it explained. Also, why not have it document the steps. That’s what I did and I ended up with a simple configuration that it’s easy to follow and use. I also now don’t have to turn set number on/off all the time, which is a helpful change for me.
Here is the configuration file, but as I mentioned it’s unlikely to be useful to you. The leader key is a \ as it’s currently mapped.
" Vim Configuration Settings
" Expand Tabs: Enable the expansion of tabs into spaces.
set expandtab
" Tabstop and Soft Tabstop: Set the tab width to 2 spaces and configure soft tabstop for consistent indentation.
set tabstop=2 softtabstop=2
" Syntax Highlighting: Enable syntax highlighting for improved code readability.
syntax enable
" Auto Indentation: Enable automatic indentation for maintaining consistent code formatting.
set autoindent
" Search Highlighting: Highlight search results for easy identification.
set hlsearch
" Ignore Case in Search: Make search operations case-insensitive for enhanced search functionality.
set ignorecase
" Key Mappings
" Save File: Map <leader>w to :w<CR> for saving the current file.
nnoremap <leader>w :w<CR>
" Quit without Saving: Map <leader>q to :q!<CR> for quitting Vim without saving changes.
nnoremap <leader>q :q!<CR>
" Toggle Line Numbers: Map <leader>n to :set invnumber<CR> for toggling line numbers visibility.
nnoremap <leader>n :set invnumber<CR>
" Toggle Relative Line Numbers: Map <leader>r to :set relativenumber!<CR> for toggling relative line numbers.
nnoremap <leader>r :set relativenumber!<CR>
" Search and Replace: Map <leader>s to :%s/ for initiating a search and replace operation.
nnoremap <leader>s :%s/
" Comment/Uncomment Lines: Map <leader>c to :s/^/#<CR>:noh<CR> for commenting or uncommenting the current line.
nnoremap <leader>c :s/^/#<CR>:noh<CR>
" Move Between Split Windows: Map <C-h>, <C-j>, <C-k>, <C-l> for window navigation commands.
nnoremap <C-h> <C-w>h
nnoremap <C-j> <C-w>j
nnoremap <C-k> <C-w>k
nnoremap <C-l> <C-w>l
#vim