Skip to content

Instantly share code, notes, and snippets.

@mousavian
Last active December 18, 2019 01:37

Revisions

  1. mousavian revised this gist Dec 18, 2019. 1 changed file with 2 additions and 2 deletions.
    4 changes: 2 additions & 2 deletions .vimrc
    Original file line number Diff line number Diff line change
    @@ -57,8 +57,8 @@ if has("statusline")
    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
    set statusline+=%#StatusLinePercentage#\ \ %P\ \ %* " percentage in file
    set statusline+=%#StatusLineLineNumber#\ %c:%l/%L\ %* " cursor column/total lines
    endif


  2. mousavian revised this gist Dec 18, 2019. 1 changed file with 2 additions and 2 deletions.
    4 changes: 2 additions & 2 deletions .vimrc
    Original file line number Diff line number Diff line change
    @@ -55,8 +55,8 @@ if has("statusline")
    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+=%{&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
  3. mousavian revised this gist Dec 18, 2019. 1 changed file with 11 additions and 8 deletions.
    19 changes: 11 additions & 8 deletions .vimrc
    Original file line number Diff line number Diff line change
    @@ -29,33 +29,36 @@ 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.' ':''
    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+=%#PmenuSel#
    " set statusline+=%#GitBranch#%{StatuslineGit()}%*
    " set statusline+=%{StatuslineGit()}
    set statusline+=%#StatusLineFilePath#\ %F\ %*\ " file name
    " set statusline+=%-2.2n " buffer
    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+=%= " left/right separator
    set statusline+=%c,%l/ " cursor column/total lines
    set statusline+=%L\ %P " total lines/percentage in file
    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


  4. mousavian revised this gist Dec 18, 2019. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion .vimrc
    Original file line number Diff line number Diff line change
    @@ -36,7 +36,7 @@ endfunction

    function! StatuslineGit()
    let l:branchname = GitBranch()
    return strlen(l:branchname) > 0?' '.l:branchname.' ':''
    return strlen(l:branchname) > 0?' '.l:branchname.' ':''
    endfunction


  5. mousavian created this gist Dec 18, 2019.
    62 changes: 62 additions & 0 deletions .vimrc
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,62 @@

    " 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

    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+=[%{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+=%= " left/right separator
    set statusline+=%c,%l/ " cursor column/total lines
    set statusline+=%L\ %P " total lines/percentage in file
    endif