Skip to content

Instantly share code, notes, and snippets.

@buckmaxwell
Created October 9, 2024 13:51
Show Gist options
  • Save buckmaxwell/7b82282ecf0162d0cb1f5a7293a97e4d to your computer and use it in GitHub Desktop.
Save buckmaxwell/7b82282ecf0162d0cb1f5a7293a97e4d to your computer and use it in GitHub Desktop.
" Basic settings
set nocompatible " Disable compatibility with old vi
filetype on " Enable filetype detection
filetype plugin on " Enable filetype-specific plugins
filetype indent on " Enable filetype-specific indentation
set tabstop=4 " Number of spaces a tab counts for
set shiftwidth=4 " Number of spaces for indentation
set expandtab " Use spaces instead of tabs
set autoindent " Auto indent new lines
set smartindent " Smart auto-indenting for C-like programs
set number " Show line numbers
set relativenumber " Relative line numbers for easy navigation
set cursorline " Highlight current line
set nowrap " Disable line wrapping
set encoding=utf-8 " Use UTF-8 encoding
" Searching
set incsearch " Incremental search
set hlsearch " Highlight search results
set ignorecase " Case-insensitive searching
set smartcase " Case-sensitive if search includes capitals
" Auto-completion
set wildmenu " Enhanced command-line completion
set wildmode=longest:full " Command-line completion settings
set completeopt=menuone,noselect " Completion settings for better UX
set omnifunc=syntaxcomplete#Complete " Enable syntax-based completion
" Syntax highlighting
syntax on " Enable syntax highlighting
" Folding
set foldmethod=syntax " Fold code blocks based on syntax
set foldlevel=99 " Open folds by default
" Enable mouse support
set mouse=a " Enable mouse in all modes
" Statusline
set laststatus=2 " Always show statusline
set showmode " Display current mode (e.g., -- INSERT --)
set ruler " Show cursor position
" Colorscheme (choose your favorite)
colorscheme wildcharm
" Bracket matching
set showmatch " Highlight matching brackets
set matchtime=2 " Short delay for bracket matching
" VueJS support
autocmd BufNewFile,BufRead *.vue setfiletype vue
autocmd FileType vue setlocal ts=2 sw=2 expandtab
" PHP support
autocmd BufNewFile,BufRead *.php setfiletype php
autocmd FileType php setlocal ts=4 sw=4 expandtab
" PostgreSQL support
autocmd BufNewFile,BufRead *.sql setfiletype sql
" Python support
autocmd BufNewFile,BufRead *.py setfiletype python
autocmd FileType python setlocal ts=4 sw=4 expandtab
autocmd FileType python setlocal colorcolumn=80 " Show a vertical ruler at 80 columns
" Linting (Basic check using built-in tools)
set errorformat=%f:%l:%m " Format for parsing errors
autocmd FileType php set makeprg=php\ -l\ %
autocmd FileType python set makeprg=python3\ -m\ py_compile\ %
autocmd FileType vue set makeprg=eslint\ --fix\ %
autocmd FileType sql set makeprg=psql\ -f\ %
" Key mappings for IDE-like experience
" Save with Ctrl+s
noremap <C-s> :w<CR>
" Quick navigation between splits
nnoremap <C-h> <C-w>h
nnoremap <C-j> <C-w>j
nnoremap <C-k> <C-w>k
nnoremap <C-l> <C-w>l
" Visualize trailing spaces
set list listchars=trail:·
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment