Skip to content

Instantly share code, notes, and snippets.

@debo
Created February 1, 2018 21:25
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save debo/cc8c1f6ec26b7cbfa7ee025c1c7c0b6a to your computer and use it in GitHub Desktop.
Save debo/cc8c1f6ec26b7cbfa7ee025c1c7c0b6a to your computer and use it in GitHub Desktop.
""""""""""""""""""""""""""""""""""""""""
" Init
set nocompatible
execute pathogen#infect()
execute pathogen#helptags()
""""""""""""""""""""""""""""""""""""""""
" Mappings
" quickly edit the .vimrc file
nmap <silent> <leader>ev :e $MYVIMRC<CR>
" quickly reload the .vimrc file
nmap <silent> <leader>sv :so $MYVIMRC<CR>
" remap : to ; for quick execution of common commands
nnoremap ; :
" use Q for formatting the current paragraph
" use Q for formatting the current selection
nmap Q gqap
" jumps to the next row in the editor disregarding line wrap
nnoremap j gj
nnoremap k gk
" Easy window navigation
map <C-h> <C-w>h
map <C-j> <C-w>j
map <C-k> <C-w>k
map <C-l> <C-w>l
" clear search highlight
nmap <silent> ,/ :nohlsearch<CR>
" save with sudo
cmap w!! w !sudo tee % >/dev/null
" disable up arrow
"map <up> <nop>
" disable down arrow
"map <down> <nop>
" disable left arrow
"map <left> <nop>
" disable right arrow
"map <right> <nop>
" toggle NERDTree
map <C-n> :NERDTreeToggle<CR>
""""""""""""""""""""""""""""""""""""""""
" Behaviours
set hidden " hide buffers rather than close them
set number " always show line numbers
set nowrap " don't wrap lines
set tabstop=4 " a tab is four spaces
set backspace=indent,eol,start " allow backspacing over everything in insert mode
set autoindent " always set autoindenting on
set copyindent " copy the previous indentation on autoindenting
set shiftwidth=4 " number of spaces to use for autoindenting
set shiftround " use multiple of shiftwidth when indenting with '<' and '>'
set showmatch " set show matching parenthesis
set ignorecase " ignore case when searching
set smartcase " ignore case if search pattern is all lowercase, case-sensitive otherwise
set smarttab " insert tabs on the start of a line according to shiftwidth, not tabstop
set hlsearch " highlight search terms
set incsearch " show search matches as you type
set history=1000 " remember more commands and search history
set undolevels=1000 " remember more undo history
set wildignore=*.swp,*.bak,*.pyc,*.class " ignore extensions for name completions when tabbing
set title " change the terminal's title
set visualbell " don't beep
set noerrorbells " don't beep
set nobackup " don't backup files
set noswapfile " don't create swap files
set expandtab " always convert tabs to spaces
set list
set listchars=tab:▸\ ,trail:·,extends:>,precedes:<,nbsp:·,space:·,eol:$
set pastetoggle=<F2>
""""""""""""""""""""""""""""""""""""""""
" Plugins
filetype plugin indent on
let NERDTreeShowHidden=1
""""""""""""""""""""""""""""""""""""""""
" Highlighting
" switch syntax highlighting on when the terminal has colors
if &t_Co > 2 || has("gui_running")
syntax on
endif
if &t_Co >= 256 || has("gui_running")
set background=dark
let g:solarized_termcolors=256
colorscheme solarized
set cursorline
highlight NonText ctermfg=240 ctermbg=none
highlight SpecialKey ctermfg=240 ctermbg=none
endif
""""""""""""""""""""""""""""""""""""""""
" Autocmd
if has('autocmd')
autocmd VimEnter * set list
autocmd StdinReadPre * let s:std_in=1
autocmd VimEnter * if argc() == 0 && !exists("s:std_in") | NERDTree | endif
autocmd VimEnter * if argc() == 1 && isdirectory(argv()[0]) && !exists("s:std_in") | exe 'NERDTree' argv()[0] | wincmd p | ene | endif
endif
""""""""""""""""""""""""""""""""""""""""
" Airline
let g:airline_powerline_fonts=1
if !exists('g:airline_symbols')
let g:airline_symbols={}
endif
let g:airline_symbols.space="\ua0"
let g:airline_theme="solarized"
" Enable the list of buffers
let g:airline#extensions#tabline#enabled = 1
" Show just the filename
let g:airline#extensions#tabline#fnamemod = ':t'
let g:airline#extensions#tabline#left_sep = ' '
let g:airline#extensions#tabline#left_alt_sep = '|'
set laststatus=2
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment