Skip to content

Instantly share code, notes, and snippets.

@sounishnath003
Created September 5, 2022 19:29
Show Gist options
  • Save sounishnath003/58c5c7ae635fe4a86622c9c333047846 to your computer and use it in GitHub Desktop.
Save sounishnath003/58c5c7ae635fe4a86622c9c333047846 to your computer and use it in GitHub Desktop.
" Vim configuration file "
" enable mouse support "
set mouse=a
" enable syntax "
syntax on
" enable line numbers "
set number
" highlight current line "
set cursorline
:highlight Cursorline cterm=bold ctermbg=black
" enable highlight search pattern "
set hlsearch
" enable smartcase search sensitivity "
set ignorecase
set smartcase
" Indentation using spaces "
" tabstop: width of tab character
" softtabstop: fine tunes the amount of whitespace to be added
" shiftwidth: determines the amount of whitespace to add in normal mode
" expandtab: when on use space instead of tab
" textwidth: text wrap width
" autoindent: autoindent in new line
set tabstop =4
set softtabstop =4
set shiftwidth =4
set textwidth =79
set expandtab
set autoindent
" show the matching part of pairs [] {} and () "
set showmatch
" remove trailing whitespace from Python and Fortran files "
autocmd BufWritePre *.py :%s/\s\+$//e
autocmd BufWritePre *.f90 :%s/\s\+$//e
autocmd BufWritePre *.f95 :%s/\s\+$//e
autocmd BufWritePre *.for :%s/\s\+$//e
" enable color themes "
if !has('gui_running')
set t_Co=256
endif
" enable true colors support "
set termguicolors
" Vim colorscheme "
colorscheme desert
"-------------------------------------------------------------"
"Bonus. " Find & Replace (if you use the ignorecase, smartcase these are mandatory) "
" :%s/<find>/<replace>/g "replace global (e.g. :%s/mass/grass/g)"
" :%s/<find>/<replace>/gc "replace global with confirmation"
" :%s/<find>/<replace>/gi "replace global case insensitive"
" :%s/<find>/<replace>/gI "replace global case sensitive"
" :%s/<find>/<replace>/gIc "replace global case sensitive with confirmation"
" " Vim (book)marks "
" mn "replace n with a word A-Z or number 0-9"
" :'n "go to mark n"
" :`. "go to the last change"
" :marks "show all declared marks"
" :delm n "delete mark n"
" " Delete range selection "
" :<line_number>,<line_number>d "(e.g. :2,10d deletes lines 2-10)"
" " LaTeX shortcuts "
" nnoremap <F1> :! pdflatex %<CR><CR>
" nnoremap <F2> :! bibtex $(echo % \| sed 's/.tex$//') & disown<CR><CR>
" nnoremap <F3> :! evince $(echo % \| sed 's/tex$/pdf/') & disown<CR><CR>
" nnoremap <F4> :! rm *.log *.aux *.out *.blg & disown<CR><CR>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment