Created
July 14, 2024 22:44
-
-
Save jakeledoux/91cbf32c1bd63872aa04d980cc31dbe2 to your computer and use it in GitHub Desktop.
sane defaults for vimrc
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| " Jake's Sane Vim Defaults | |
| filetype on | |
| " auto-reload vimrc | |
| autocmd! bufwritepost .vimrc source ~/.vimrc | |
| " show filename in window titlebar | |
| set title | |
| " default to utf-8 | |
| set encoding=utf-8 | |
| " display incomplete commands | |
| set showcmd | |
| " enable mouse support | |
| set mouse=a | |
| " line numbers | |
| set number | |
| if exists('+relativenumber') | |
| set relativenumber | |
| endif | |
| set textwidth=80 | |
| if exists('+colorcolumn') | |
| set colorcolumn=80 | |
| endif | |
| " enable status bar | |
| set laststatus=2 | |
| " make laggy connections work better | |
| set ttyfast | |
| " case-insensitive filename completion | |
| if exists('+wildignorecase') | |
| set wildignorecase | |
| endif | |
| " scroll margins | |
| set scrolloff=10 sidescrolloff=5 | |
| " color fix | |
| if exists('+termguicolors') | |
| set termguicolors | |
| endif | |
| " completion | |
| if exists('+menu') | |
| set completeopt=menu,menuone,noselect | |
| endif | |
| " speed up pauses | |
| set ttimeoutlen=50 updatetime=100 | |
| " sane splitting | |
| set splitbelow splitright | |
| " gutter | |
| if exists('+signcolumn') | |
| set signcolumn=yes | |
| endif | |
| """"""""""""" | |
| " Searching " | |
| """"""""""""" | |
| " highlight last search | |
| set hlsearch | |
| " show search incrementally | |
| set incsearch | |
| " ignore case unless capitalized | |
| set ignorecase smartcase | |
| " imply global for new searches | |
| set gdefault | |
| """"""""""""""" | |
| " Indentation " | |
| """"""""""""""" | |
| set backspace=indent,eol,start | |
| set tabstop=4 softtabstop=0 expandtab shiftwidth=4 smarttab | |
| set autoindent nosmartindent | |
| """"""""" | |
| " Theme " | |
| """"""""" | |
| syntax enable | |
| """""""""""" | |
| " Keybinds " | |
| """""""""""" | |
| " hide search | |
| nmap <C-n> :noh<CR> | |
| " always search forward | |
| nnoremap <expr> n (v:searchforward ? 'n' : 'N') | |
| nnoremap <expr> N (v:searchforward ? 'N' : 'n') | |
| """"""""""""" | |
| " Filetypes " | |
| """"""""""""" | |
| au Filetype c,cpp,h setlocal colorcolumn=90 | |
| au Filetype javascript,javascriptreact,typescript,typescriptreact setlocal tabstop=2 softtabstop=0 expandtab shiftwidth=2 smarttab | |
| au Filetype python setlocal colorcolumn=90 | |
| au Filetype rust setlocal colorcolumn=99 | |
| au Filetype sql setlocal tabstop=2 softtabstop=0 expandtab shiftwidth=2 smarttab | |
| au Filetype text,gitocmmit,markdown,rst setlocal textwidth=80 wrap linebreak nolist spell tabstop=2 softtabstop=0 expandtab shiftwidth=2 smarttab |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment