DEV Community

Jack Moore
Jack Moore

Posted on • Originally published at jmoore53.com on

Vim Configuration

Vim, my server editor of choice. (I prefer vscode for development on my workstation.)

Plugins

  • vim-rainbow
  • powerline
  • nerdtree

~/.vimrc

This .vimrc is pretty gross looking, but please just note the major configurations:

  • Line/Relative Line
  • Tabs are 4 spaces
  • Typing { automatically generates a closing \n}
  • NerdTree is enabled
  • The theme is Solarized
  • Parentheses are pretty..
"VIMRC Configuration

"Default configuration
"Relative Line Number
:set number
:set rnu

"Spacing
:set tabstop=4
:set shiftwidth=4
:set expandtab

"Remap..
inoremap {<cr> {<cr>}<esc>ko
inoremap ( ()<left>

"Powerline for VIM
set rtp+=/home/jack/.local/lib/python3.8/site-packages/powerline/bindings/vim
set laststatus=2
set t_Co=256

"Nerd Tree
autocmd StdinReadPre * let s:std_in=1
autocmd VimEnter * if argc() == 0 && !exists("s:std_in") | NERDTree | endif

autocmd StdinReadPre * let s:std_in=1
autocmd VimEnter * if argc() == 1 && isdirectory(argv()[0]) && !exists("s:std_in") | exe 'NERDTree' argv()[0] | wincmd p | ene | exe 'cd '.argv()[0] | endif

autocmd bufenter * if (winnr("$") == 1 && exists("b:NERDTree") && b:NERDTree.isTabTree()) | q | endif

map <C-n> :NERDTreeToggle<CR>

"Solarized Theme
syntax enable
set background=dark
colorscheme solarized
let g:solarized_termcolors=256

"Vim-Rainbow
let g:rainbow_active = 1

let g:rainbow_load_separately = [
    \ ['*' , [['(', ')'], ['\[', '\]'], ['{', '}']] ],
    \ ['*.tex' , [['(', ')'], ['\[', '\]']] ],
    \ ['*.cpp' , [['(', ')'], ['\[', '\]'], ['{', '}']] ],
    \ ['*.{html,htm}' , [['(', ')'], ['\[', '\]'], ['{', '}'], ['<\a[^>]*>', '</[^>]*>']] ],
    \ ]

let g:rainbow_guifgs = ['RoyalBlue3', 'DarkOrange3', 'DarkOrchid3', 'FireBrick']
let g:rainbow_ctermfgs = ['lightblue', 'lightgreen', 'yellow', 'red', 'magenta']

Enter fullscreen mode Exit fullscreen mode

Bash Powerline

Install Powerline

pip install git+git://github.com/Lokaltog/powerline
wget https://github.com/powerline/powerline/raw/develop/font/PowerlineSymbols.otf
wget https://github.com/powerline/powerline/raw/develop/font/10-powerline-symbols.conf
mv PowerlineSymbols.otf /usr/share/fonts/
fc-cache -vf /usr/share/fonts/
mv 10-powerline-symbols.conf /etc/fonts/conf.d/

Enter fullscreen mode Exit fullscreen mode

~/.bashrc

# Powerline
export PATH="$HOME/.local/bin:$PATH"
export POWERLINE_COMMAND=powerline
export POWERLINE_CONFIG_COMMAND=powerline-config
powerline-daemon -q
POWERLINE_BASH_CONTINUATION=1
POWERLINE_BASH_SELECT=1

POWERLINE_BASH_CONTINUATION=1
POWERLINE_BASH_SELECT=1
. /home/jack/.local/lib/python3.8/site-packages/powerline/bindings/bash/powerline.sh

Enter fullscreen mode Exit fullscreen mode

Getting Glyphs to work when SSHing from Mac to Server

I used FIRA Code to get powerline working on the server.

In ITerm2 command + , to open preferences, profiles > text > Non ASCII Font Fira Code retinat font size 12.

Links

Top comments (0)