Skip to content

Instantly share code, notes, and snippets.

@suiluj
Last active November 28, 2022 08:44
Show Gist options
  • Save suiluj/f752ae3105a74d516caba9902b48b928 to your computer and use it in GitHub Desktop.
Save suiluj/f752ae3105a74d516caba9902b48b928 to your computer and use it in GitHub Desktop.
[.vimrc My vim configuration file] with link to interesting YouTube video #vim
" GREAT CONFIGURATION VIDEO: https://youtu.be/XA2WjJbmmoM
" BASIC SETUP:
" enter the current millenium
set nocompatible
" enable syntax and plugins (for netrw)
syntax enable
filetype plugin on
set number relativenumber
" FINDING FILES:
"
" Search down into subfolders
" Provides tab-completion for all file-related tasks
set path+=**
" Display all matching files when we tab complete
set wildmenu
" NOW WE CAN:
" - Hit tab to :find by partial match
" - Use * to make it fuzzy
" THINGS TO CONSIDER:
" - :b lets you autocomplete any open buffer
" TAG JUMPING:
"
" Create the `tags`file (may need to install ctags first)
command! MakeTags !ctags -R .
" NOW WE CAN:
" - Use ^] to jump to tag under cursor
" - Use g^] for ambiguous tags
" - Use ^t to jump back up the tag stack
" THINGS TO CONSIDER:
" - This doesn't help if you want a visual list of tags
" AUTOCOMPLETE:
" The good stuff is documented in | ins-completion|
" HIGHLIGHTS:
" - ^x^n for JUST this file
" - ^x^f for filenames (works with our path trick!)
" - ^x^] for tags only
" - ^n for anything specified by the 'complete' opion
" NOW WE CAN:
" - Use ^n and ^p to go back and forth in the suggestion list
" FILE BROWSING:
" Tweaks for browsing
let g:netrw_banner=0 " disable annoying banner
let g:netrw_browse_split=4 " open in prior window
let g:netrw_altv=1 " open splits to the right
let g:netrw_liststyle=3 " tree view
let g:netrw_list_hide=netrw_gitignore#Hide()
let g:netrw_list_hide.=',\(^\|\s\s)\zs\.\S\+'
" NOW WE CAN:
" - :edit a folder to open a file browser
" - <CR>/v/t to open in an h-split/v-split/tab
" - check |netrw-browse-maps| for more mappings
"SNIPPETS: Look Video at minute 44:44
" nnoremap ,html :-1read $HOME/.vim/.skeleton.html<CR>3jwf>a example only
" ADDED SETTINGS AFTER VIDEO TRICKS
" change between light or dark to match terminal setting for better contrast
set background=light
" search live updates and highlights
" https://vi.stackexchange.com/questions/8741/how-to-automatically-turn-off-hlsearch-after-im-done-searching
:set incsearch
":set hlsearch
" INDENTING
"
:set tabstop=2 " tabs are at proper location
:set expandtab " don't use actual tab character (ctrl-v)
:set shiftwidth=2 " indenting is 2 spaces
:set autoindent " turns it on
:set smartindent " does the right thing (mostly) in programs
:set cindent " stricter rules for C programs
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment