This repository contains a custom Vim configuration designed to enhance usability, provide flexible indentation settings for various file types, and improve the overall coding experience.
Search and Encoding:
- Highlights all matches in search results (
hlsearch). - Ignores case in search patterns (
ignorecase). - Disables incremental search, highlighting matches only after pressing Enter (
noincsearch). - Sets file encoding to UTF-8 (
encoding=utf8). - Always displays the status line at the bottom of the screen (
laststatus=2).
- Highlights all matches in search results (
Mouse Support:
- Enables mouse functionality in visual mode (
set mouse=v), if supported.
- Enables mouse functionality in visual mode (
Cursor Highlighting:
- Highlights the entire line where the cursor is positioned for better focus (
cursorline).
- Highlights the entire line where the cursor is positioned for better focus (
Vi Compatibility:
- Ensures Vim is not in compatibility mode with Vi, enabling modern features (
nocompatible).
- Ensures Vim is not in compatibility mode with Vi, enabling modern features (
Color Scheme:
- Sets the color scheme to
codedarkfor a modern look.
- Sets the color scheme to
Filetype-Specific Indentation:
- HTML: 2 spaces for tabs and indentation.
- Python: 4 spaces for tabs and indentation.
- YAML: 2 spaces for tabs and indentation with custom indent keys.
Autocommands:
- Exits Insert mode automatically if idle for a defined period (
CursorHoldI). - Applies filetype-specific indentation settings when opening files.
- Exits Insert mode automatically if idle for a defined period (
Status Line:
- Displays detailed information, including file name, working directory, cursor position, and more.
syntaxonfiletypepluginindenton" Search and encoding settingssetnoincsearch" Disables incremental search; highlights only on Entersetignorecase" Ignores case in search patterns for easier matchingsetencoding=utf8" Sets file encoding to UTF-8 for better compatibilitysetlaststatus=2" Always displays the status line at the bottom of the screensethlsearch" Highlights all matches for search results to improve visibilitysetshowmatch" Briefly highlights matching parentheses, brackets, or bracessetcursorline" Highlights the entire line where the cursor is positioned for better focussetnocompatible" Ensures Vim is not in Vi mode" Color Schemecolorscheme codedark
" Enables mouse support if availableifhas("mouse")
setmouse=v" Enables mouse support in visual modeendif" Filetype-specific indentationfunctionHtmlConfig()
settabstop=2softtabstop=2expandtabshiftwidth=2endfunctionfunctionPythonConfig()
settabstop=4softtabstop=4expandtabshiftwidth=4endfunctionfunctionYamlConfig()
settabstop=2softtabstop=2expandtabshiftwidth=2setindentkeys-=0# indentkeys-=<:>endfunction" AutocommandsautocmdCursorHoldI*stopinsert" Exit Insert mode if idleautocmdFileTypehtmlcallHtmlConfig()
autocmdFileTypepythoncallPythonConfig()
autocmdFileTypeyaml,ymlcallYamlConfig()
" Status line configurationsetstatusline=\ File:\ %F%m%r%h\ %w\ \ Working\ Directory:\ %r%{getcwd()}%h\ -\ Line:\ %l\ -\ Column:\ %c" Prevent defaults.vim from overwriting these settingsletg:skip_defaults_vim=1