Skip to content

Instantly share code, notes, and snippets.

@mousavian
Last active December 18, 2019 01:37
Show Gist options
  • Save mousavian/5aa816b6e343106eda6c6ffcd55e80f3 to your computer and use it in GitHub Desktop.
Save mousavian/5aa816b6e343106eda6c6ffcd55e80f3 to your computer and use it in GitHub Desktop.
" use filetype-based syntax highlighting, ftplugins, and indentation
syntax on
filetype plugin indent on
colorscheme challenger_deep
set number " show line numbers
set nowrap " nowrap lines
set encoding=utf-8 " set encoding to UTF-8 (default was "latin1")
" set mouse=a " enable mouse support (might not work well on Mac OS X)
set wildmenu " visual autocomplete for command menu
" set lazyredraw " redraw screen only when we need to
set showmatch " highlight matching parentheses / brackets [{()}]
set laststatus=2 " always show statusline (even with only single window)
set ruler " show line and column number of the cursor on right side of statusline
set visualbell " blink cursor on error, instead of beeping
set cursorline " highlight current line
set hlsearch " highlight matches
"""" Tab settings
" set tabstop=4 " width that a <TAB> character displays as
set expandtab " convert <TAB> key-presses to spaces
" set shiftwidth=4 " number of spaces to use for each step of (auto)indent
" set softtabstop=4 " backspace after pressing <TAB> will remove up to this many spaces
set autoindent " copy indent from current line when starting a new line
set smartindent " even better autoindent (e.g. add indent after '{')
set smarttab
" https://vim.fandom.com/wiki/Xterm256_color_names_for_console_Vim
highlight GitBranch ctermfg=129
highlight StatusLineFilePath ctermbg=Black ctermfg=166
highlight StatusLinePercentage ctermbg=243
highlight StatusLineLineNumber ctermbg=144 ctermfg=Black
function! GitBranch()
return system("git rev-parse --abbrev-ref HEAD 2>/dev/null | tr -d '\n'")
endfunction
function! StatuslineGit()
let l:branchname = GitBranch()
return strlen(l:branchname) > 0?' '.l:branchname.' ':''
endfunction
if has("statusline")
" Custom status line
set statusline= " clear the statusline for when vimrc is reloaded
" set statusline+=%#PmenuSel#
" set statusline+=%#GitBranch#%{StatuslineGit()}%*
" set statusline+=%{StatuslineGit()}
set statusline+=%#StatusLineFilePath#\ %F\ %*\ " file name
" set statusline+=%-2.2n " buffer
set statusline+=%= " left/right separator
set statusline+=%{strlen(&ft)?&ft:'none'}\ \|\ " filetype
set statusline+=%{strlen(&fenc)?&fenc:&enc}\ \|\ " encoding
set statusline+=%{&fileformat}\ " file format
set statusline+=%h%m%r%w\ " flags
set statusline+=%#StatusLinePercentage#\ \ %P\ \ %* " percentage in file
set statusline+=%#StatusLineLineNumber#\ %c:%l/%L\ %* " cursor column/total lines
endif
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment