Update docs/tech_docs/linux/vim.md

This commit is contained in:
2024-03-08 16:27:07 +00:00
parent 305bc53302
commit 60f49c0d87

View File

@@ -116,6 +116,97 @@ set clipboard=unnamedplus " Integrate Vim clipboard with the system clipboard
```
- Adjusts settings for specific file types and adds general improvements to make editing more pleasant.
This guide breaks down the `.vimrc` file into manageable sections, making it easier to understand and customize according to your needs. Remember, the best `.vimrc` is one that evolves with you, fitting your workflow and preferences as they develop over
This guide breaks down the `.vimrc` file into manageable sections, making it easier to understand and customize according to your needs. Remember, the best `.vimrc` is one that evolves with you, fitting your workflow and preferences as they develop over time.
time.
---
```bash
" Basic Vim configuration file
" Author: [Your Name]
" Last Updated: [Date]
" Prevent older Vim versions from running this config
if version < 700
echo "Upgrade to Vim 7.0 or later."
finish
endif
" Ensure the file is loaded only once
if exists("g:loaded_vimrc")
finish
endif
let g:loaded_vimrc = 1
" ==============================================================================
" General Settings
" ==============================================================================
set nocompatible " Disable Vi compatibility mode
filetype plugin indent on " Enable filetype detection and plugin
set encoding=utf-8 " Set default encoding to UTF-8
set fileencoding=utf-8 " Set file encoding to UTF-8
set clipboard=unnamedplus " Use system clipboard
syntax enable " Enable syntax highlighting
set tabstop=4 " Set tab width to 4 spaces
set shiftwidth=4 " Set width for auto-indents
set expandtab " Use spaces instead of tabs
set smartindent " Enable smart indent
set number " Show line numbers
set relativenumber " Show relative line numbers
set cursorline " Highlight current line
set mouse=a " Enable mouse support
set noswapfile " Disable swap file creation
set nobackup " Disable backup file creation
set undofile " Enable persistent undo
set incsearch " Enable incremental search
set hlsearch " Highlight search results
set ignorecase " Case insensitive searching...
set smartcase " ...unless there's a capital letter in the query
" ==============================================================================
" Visual Settings
" ==============================================================================
set showmatch " Highlight matching parentheses
colorscheme desert " Set colorscheme
set laststatus=2 " Always display the status line
set showcmd " Display incomplete commands
set wildmenu " Visual autocomplete for command menu
set ruler " Show cursor position
" ==============================================================================
" Key Bindings
" ==============================================================================
let mapleader = " " " Set <Space> as the leader key
nnoremap <leader>w :w!<CR> " Quick save command
nnoremap <leader>q :q!<CR> " Quick quit command
" ==============================================================================
" Plugin Management
" ==============================================================================
" Placeholder for plugin management system initialization
" e.g., vim-plug, Vundle, or native Vim 8+ package management
" ==============================================================================
" Plugins Configuration
" ==============================================================================
" Example configurations for installed plugins
" ==============================================================================
" Custom Functions and Autocommands
" ==============================================================================
" Example: Clean trailing whitespace on save
autocmd BufWritePre * %s/\s\+$//e
" ==============================================================================
" Final Touches
" ==============================================================================
" Additional custom settings and tweaks
" Ensure settings apply to all file types
filetype plugin on
" Enable spell checking for text files
autocmd FileType text setlocal spell
" End of .vimrc
```