Skip to content

Instantly share code, notes, and snippets.

@rdok
Last active September 4, 2019 15:41
Show Gist options
  • Save rdok/126681727a7bf0558a0b58bc66fae51f to your computer and use it in GitHub Desktop.
Save rdok/126681727a7bf0558a0b58bc66fae51f to your computer and use it in GitHub Desktop.
Install ctrlpvim/ctrlp.vim plugin.
"|----------------------------------------------------------------------------|
"| Plugins - Vundle |
"|----------------------------------------------------------------------------|
" Behave more Vi-compatible, or a more useful way.
set nocompatible
" Don't detect filetypes.
filetype off
" Start Vundle
" Runtime path: include and initialize Vundle.
set rtp+=~/.vim/bundle/Vundle.vim
call vundle#begin()
" Full path fuzzy file, buffer, mru, tag, ... finder for Vim.
Plugin 'ctrlpvim/ctrlp.vim'
" Let Vundle manage Vundle, required.
Plugin 'gmarik/Vundle.vim'
" Colorschemes
Plugin 'joshdick/onedark.vim'
" File Browsing
Plugin 'scrooloose/nerdtree'
call vundle#end() " Plugins must be added before the following line.
" End Vundlskwp/greplace.vime
" Required: Enable filetype: detection, specific scripts, and indent scripts.
filetype plugin indent on
"|----------------------------------------------------------------------------|
"| End Plugins - Vundle |
"|----------------------------------------------------------------------------|
"|----------------------------------------------------------------------------|
"| Vim Settings |
"|----------------------------------------------------------------------------|
" Read each time a shell command is run.
let $BASH_ENV = "~/.bash_aliases"
" Use an undo file.
set undofile
"Disable bell.
set noerrorbells visualbell t_vb=
" Use comma as Leader
let mapleader = ','
" ctrlpvim/ctrlp.vim
let g:ctrlp_map = '<c-p>'
"|----------------------------------------------------------------------------|
"| Vim Settings |
"|----------------------------------------------------------------------------|
"|----------------------------------------------------------------------------|
"| Plugins Settings |
"|----------------------------------------------------------------------------|
"
" NERDTree
"
" Show hidden files. E.g. .gitignore
let NERDTreeShowHidden = 1
" Prevent NERDTree from hijacking directory browsing from Netrw
let NERDTreeHijackNetrw = 0
"|----------------------------------------------------------------------------|
"| End Plugin Settings |
"|----------------------------------------------------------------------------|
"|----------------------------------------------------------------------------|
"| Styling |
"|----------------------------------------------------------------------------|
" Switch on syntax highlighting.
syntax on
" light/dark
set background=light
" Dark: onedark, solarized
" Light: summerfruit256, solarized, pyte, PaperColor, pencil
" colo ondedark " Use color scheme.
" Display line numbers
set nu
" Set font size. Howerver, font-family is determined by the relevant terminal.
set guifont=Monospace\ 12
" Remove split borders
hi vertsplit guifg=bg guibg=bg
" Show (partial) command in the last line of the screen.
set showcmd
" Always display the status line.
set laststatus=2
" Necessary to show Unicode glyphs
set encoding=utf-8
" Highlight the background in red for text that goes over the 80 column limit.
highlight OverLength ctermbg=red ctermfg=white guibg=#592929
match OverLength /\%80v.\+/
set colorcolumn=80
"|----------------------------------------------------------------------------|
"| End Styling |
"|----------------------------------------------------------------------------|
"|----------------------------------------------------------------------------|
"| Formatting |
"|----------------------------------------------------------------------------|
" Insert 4 spaces for a tab.
set tabstop=4
" Insert 4 spaces for an indentation.
set shiftwidth=4
" Insert spaces whenever the tab key is pressed.
set expandtab
"|----------------------------------------------------------------------------|
"| End Formatting |
"|----------------------------------------------------------------------------|
"|----------------------------------------------------------------------------|
"| Search |
"|----------------------------------------------------------------------------|
" Highlight search resulsts.
set hlsearch
" While typing a search command, show where the pattern is so far.
set is
"|----------------------------------------------------------------------------|
"| End Search |
"|----------------------------------------------------------------------------|
"|----------------------------------------------------------------------------|
"| Mappings |
"|----------------------------------------------------------------------------|
"
" Edit files
nmap <Leader>sv :so $MYVIMRC<cr> " Source Vimrc file
nmap <Leader>q :q<cr>
nmap <Leader>w :w<cr>
nmap <Leader>wq :wq<cr>
nmap <Leader>bd :bd<cr> " Close current buffer
nmap <Leader><SPACE> :nohl<cr> " Stop the highlighting for the search
" NERDTree: Toggle Sidebar
nmap <S-l> :NERDTreeToggle<cr> <S-r>
" Escape to normal mode
imap jj <esc>
" Switch between splits
nmap <C-J> <C-W><C-J>
nmap <C-K> <C-W><C-K>
nmap <C-H> <C-W><C-H>
nmap <C-L> <C-W><C-L>
" Store swap files and backup files to a proper location
if !isdirectory($HOME . '/.vim/temp')
call mkdir($HOME . '/.vim/temp')
endif
if has("win32")
set backupdir=$HOME\\.vim\\temp\\
set directory=$HOME\\.vim\\temp\\
set undodir=$HOME\\.vim\\temp\\
else
set backupdir=$HOME/.vim/temp/
set directory=$HOME/.vim/temp/
set undodir=$HOME/.vim/temp/
endif
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment