Last active
September 28, 2023 14:53
-
-
Save kenbarbour/8d3384b8c2b7fcc449c0ca8e2be40edf to your computer and use it in GitHub Desktop.
An iteration of my vimrc file. I keep this and other dotfiles maintained in source control
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
syntax enable | |
filetype plugin on "netrw packaged w/ vim core | |
set backspace=indent,eol,start | |
set number "Line numbers | |
" set relativenumber "Show line # relative to current line | |
set mouse=a "Use mouse to scroll | |
set exrc "execute vimrc within pwd | |
set clipboard=unnamed "share clipboard with X sessions | |
set autoindent "Automatically indent new lines | |
set belloff=all "no system bell | |
"--------Color | |
" set background=dark | |
set t_Co=256 | |
"--------Tab Handling | |
set tabstop=2 "2-character tabs | |
set expandtab "use spaces instead of tabs | |
set shiftwidth=2 "re-tabularizing is also 2-characters wide | |
set smarttab | |
set smartindent | |
"--------Format Options | |
set formatoptions+=r "Insert current comment leader after <Enter> in INSERT | |
set formatoptions+=c "Auto-wrap comments, insert comment leader | |
"--------Line Wrapping | |
set wrap "Soft wrap at the edge of the terminal | |
set linebreak "Avoid breaking in the middle of a word (except list) | |
set textwidth=80 "Hard break at 80 characters | |
set whichwrap+=<,>,h,l "arrows can move to the next line | |
set colorcolumn=80 | |
highlight ColorColumn ctermbg=240 | |
"--------Fuzzy File Search | |
" :find <pattern> | |
" find files <pattern> w/ tab complete and wildcard support | |
set path+=** "recursive search into dirs | |
set wildmenu "search display all matches | |
set wildignore+=**/node_modules/** | |
" :b autocompletes with any open buffer | |
" @plugin: ctrlp also provides a more featured fuzzy search (Ctrl+P) | |
"--------File Management - NERDTree | |
map <C-n> :NERDTreeToggle<CR> "Ctrl+n toggles directory tree | |
" @plugin: nerdtree | |
"--------Tag management | |
" make tags with :mktags | |
" ^ = Ctrl | |
" * ^] to jump to tag under cursor | |
" * g^] for ambiguous tags | |
" * ^t to jump back up the tag stack | |
command! MakeTags !ctags -R . | |
"--------Autocomplete | |
" (see |ins-completion| in docs) | |
" * ^n anything specified by the 'complete' option | |
" * ^x^n look JUST in this file | |
" * ^x*f filenames (same rules as fuzzy file search) | |
" * ^x*] tags only | |
" Navigate suggestions with ^n and ^p | |
"--------Better line wraps | |
set showbreak=↪ | |
"--------Smooth scroll | |
" @plugin: vim-smooth-scroll | |
" maps scroll keys to scroll smoothly | |
noremap <silent> <c-u> :call smooth_scroll#up(&scroll, 10, 2)<CR> | |
noremap <silent> <c-d> :call smooth_scroll#down(&scroll, 10, 2)<CR> | |
noremap <silent> <c-b> :call smooth_scroll#up(&scroll*2, 10, 4)<CR> | |
noremap <silent> <c-f> :call smooth_scroll#down(&scroll*2, 10, 4)<CR> | |
"--------Search | |
set hlsearch | |
set incsearch | |
"--------Status | |
" @plugin airline | |
" @plugin fugitive | |
let g:airline#extensions#tabline#enabled=1 " enable list of buffers | |
"--------Mappings | |
nmap <leader>ev :tabedit $MYVIMRC<cr> "Leader-e-v edits vimrc | |
nmap <leader>sh :! PROMPT_APPEND="(vim)" ${SHELL}<cr> | |
" map <C-J> :bnext<CR> | |
" map <C-K> :bprev<CR> | |
"--------Split management | |
"\vs - vertical split | |
"\ss - horizontal split | |
"<C-J> move to lower split | |
"<C-H> move to left split | |
"<C-K> move to upper split | |
"<C-L> move to right split | |
nmap <leader>vs :vsplit<cr> | |
nmap <leader>ss :split<cr> | |
" nmap <C-J> <C-W><C-J><CR> | |
" nmap <C-H> <C-W><C-H><CR> | |
" nmap <C-K> <C-W><C-K><CR> | |
" nmap <C-L> <C-W><C-L><CR> | |
"--------Training Wheels | |
" Disable arrow keys until you get comfortable with hjkl | |
" nmap <Left> :echo "Press H to go left!"<CR> | |
" nmap <Right> :echo "Press L to go right!"<CR> | |
" nmap <Up> :echo "Press K to go up!"<CR> | |
" nmap <Down> :echo "Press J to go down!"<CR> | |
"--------Javascript Linting Engine | |
@plugin ale | |
let g:ale_sign_error='✘' | |
let g:ale_sign_warning='⚠' | |
highlight ALEErrorSign ctermbg=NONE ctermfg=red | |
highlight ALEWarningSign cterm=NONE ctermfg=yellow | |
let g:ale_fixers = { | |
\ 'javascript': ['eslint'], | |
\} | |
let g:ale_fix_on_save=1 | |
"--------Rust Linting | |
" @plugin rust.vim | |
" :RustFmt will format code w/ rustfmt | |
let g:rustfmt_autosave = 1 | |
"--------JavaScript Development | |
let g:vim_jsx_pretty_colorful_config = 1 | |
"--------Codeium - AI generated code completion | |
set statusline+=\{…\}%3{codeium#GetStatusString()} | |
"--------Split Management | |
set splitbelow "New vsplits below current | |
"Automatically source vimrc on save. | |
augroup autosourcing | |
autocmd! | |
autocmd BufWritePost .vimrc source % | |
augroup END |
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
#!/bin/sh | |
set -e | |
## This script will setup the vim environment to work with my vimrc | |
VIMDIR=~/.vim | |
# Git Vim Plugins | |
GIT_PLUGINS="\ | |
git://github.com/preservim/nerdtree\ | |
git://github.com/rust-lang/rust.vim\ | |
https://github.com/christoomey/vim-tmux-navigator\ | |
https://github.com/dense-analysis/ale\ | |
https://github.com/godlygeek/tabular\ | |
https://github.com/hashivim/vim-terraform\ | |
https://github.com/kien/ctrlp.vim\ | |
https://github.com/maxmellon/vim-jsx-pretty\ | |
https://github.com/terryma/vim-smooth-scroll\ | |
https://github.com/tpope/vim-commentary\ | |
https://github.com/tpope/vim-fugitive\ | |
https://github.com/tpope/vim-surround\ | |
https://github.com/vim-airline/vim-airline\ | |
https://github.com/yuezk/vim-js\ | |
https://github.com/KabbAmine/zeavim.vim\ | |
https://github.com/Exafunction/codeium.vim\ | |
" | |
# TODO: Check for git | |
vim_plugin_path="${VIMDIR}/pack/vendor/start" | |
if [ ! -d "${vim_plugin_path}" ]; then | |
mkdir -p "${vim_plugin_path}" | |
fi | |
pushd "${vim_plugin_path}" | |
for plugin in ${GIT_PLUGINS} | |
do | |
plugin_name=`basename $plugin` | |
if [ ! -d "./${plugin_name}" ]; then | |
echo "cloning ${plugin_name}" | |
git clone $plugin | |
else | |
echo "${plugin_name} already installed" | |
fi | |
done | |
popd |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment