Skip to content

Instantly share code, notes, and snippets.

@laminko
Last active November 30, 2016 04:44
Show Gist options
  • Save laminko/bd891c15e11260104e11ff09d79bc0c5 to your computer and use it in GitHub Desktop.
Save laminko/bd891c15e11260104e11ff09d79bc0c5 to your computer and use it in GitHub Desktop.
" Pathogen
" execute pathogen#infect()
" Simple VIM config
set pastetoggle=<F2>
set clipboard=unnamedplus
set guifont=Dejavu\ Sans\ Mono\ for\ Power\ line\ 10
set background=dark
" colorscheme classic-bright
" Enable syntax highlighting
" You need to reload this file for the change to apply
filetype on
filetype plugin indent on
syntax on
" Enable mouse
set mouse=a " Automatically enable mouse usage
set mousehide " Hide the mouse cursor while typing
scriptencoding utf-8
set encoding=utf-8
" Showing line numbers and length
set number " show line numbers
set tw=79 " width of document (used by gd)
set nowrap " don't automatically wrap on load
set fo-=t " don't automatically wrap text when typing
set colorcolumn=80
set ruler
set cursorline
set linebreak
" Useful settings
set history=1000
set undolevels=1000
set splitright " Puts new vsplit windows to the right of the current
set splitbelow " Puts new split windows to the bottom of the current
" Make search case insensitive
set showmatch " Show matching brackets/parenthesis
set incsearch " Find as you type search
set hlsearch " Highlight search terms"
set ignorecase
set smartcase
set list
set listchars=tab:›\ ,trail:•,eol:¬,extends:#,nbsp:« " Highlight problematic whitespace
" Disable stupid backup and swap files - they trigger too many events
" for file system watchers
set nobackup
set nowritebackup
set noswapfile
" Backspace fix;
set backspace=indent,eol,start
let mapleader=","
noremap <leader>r :nohl<CR>:let @/=''<CR>
vnoremap <leader>r :nohl<CR>:let @/=''<CR
inoremap <leader>r :nohl<CR>:let @/=''<CR
noremap <leader>s :update<CR>
vnoremap <leader>s :update<CR>
inoremap <leader>s :update<CR>
map <Leader>c <esc>:bd<CR>
map <Leader>n <esc>:tabprevious<CR>
map <Leader>m <esc>:tabnext<CR>
" PRIMARY (*) and CLIPBOARD (+)
noremap <Leader>y "*y
noremap <Leader>p "*p
noremap <Leader>Y "+y
noremap <Leader>P "+p
" Real programmers don't use TABs but spaces
set autoindent
set tabstop=2
set softtabstop=2
set shiftwidth=2
set shiftround
set expandtab
" NOTE: currently, disabled followings.
" Set compiler
" CLang
" autocmd BufEnter *.c compiler gcc
" TODO: To configure with MAKE
" IF FileType is C, SET makeprg=gcc {filename} -o {filename.noext}
" NOTE: < means remove extension.
" REF: https://stackoverflow.com/questions/2627886/how-do-i-run-a-c-program-from-vim/2650621#2650621
" autocmd FileType c set makeprg=gcc\ %\ -o\ %<\ -Wall
" CPlusPlus
" autocmd FileType cpp set makeprg=g++\ %\ -o\ %<
" For Makefile
" but makefile uses TAB.
autocmd FileType Makefile set tabstop=4 softtabstop=0 shiftwidth=4 noexpandtab
" python for 4 spaces
autocmd BufRead,BufNewFile *.py set tabstop=4 softtabstop=4 shiftwidth=4 smarttab expandtab
" other for 2 spaces
autocmd BufRead,BufNewFile *.js,*.java,*.css,*.sass,*.less,*.h,*.c,*.cpp set tabstop=2 softtabstop=2 shiftwidth=2 smarttab expandtab
" remove trailing spaces
autocmd BufWritePre *.js,*.java,*.css,*.sass,*.less,*.py,*.h,*.c,*.cpp :call <SID>StripTrailingWhitespaces()
" REMOVE TRAILING SPACES
function! <SID>StripTrailingWhitespaces()
let l = line(".")
let c = col(".")
%s/\s\+$//e
call cursor(l, c)
endfun
" IGNORE OBJECTS
set wildignore+=*/tmp/*,*.so,*.swp,*.zip,*/node_modules/*,*/bower_components/*,*/dist/*,*/uploads/*,*/tests/*
" PLUGINS and ADDONS
" The followings should be uncommented if there is no pathogen.
" ctrl+p.vim
" set runtimepath^=~/.vim/bundle/ctrlp.vim
" vim-airline
" set runtimepath^=~/.vim/bundle/vim-airline
" unite.vim
" set runtimepath^=~/.vim/bundle/unite.vim
" vim-fugitive
" set runtimepath^=~/.vim/bundle/vim-fugitive
" vim-gitgutter
" set runtimepath^=~/.vim/bundle/vim-gitgutter
" YouCompleteMe
" set runtimepath^=~/.vim/bundle/YouCompleteMe
" auto-pairs
" set runtimepath^=~/.vim/bundle/auto-pairs
" CONFIGS for PLUGINS/ADDONS
" ctrl+p config
" let g:ctrlp_custom_ignore = {
" \ 'dir': '\v[\/]\.(git|hg|svn)$',
" \ 'file': '\v\.(exe|so|dll)$',
" \ 'link': 'some_bad_symbolic_links',
" \ }
" vim-indent-guides
" let g:indent_guides_auto_colors = 1
" let g:indent_guides_enable_on_vim_startup = 1
" let g:indent_guides_guide_size = 1
" vim-airline config
set laststatus=2
" let g:airline_powerline_fonts = 1
" let g:airline#extensions#tabline#enabled = 1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment