Skip to content

Instantly share code, notes, and snippets.

@frankie7413
Last active September 9, 2021 06:59
Show Gist options
  • Save frankie7413/04d05f4eca04ae4449b9da3cc21696cb to your computer and use it in GitHub Desktop.
Save frankie7413/04d05f4eca04ae4449b9da3cc21696cb to your computer and use it in GitHub Desktop.
WSL VIM Settings
call plug#begin('~/.vim/plugged')
Plug 'airblade/vim-gitgutter'
Plug 'editorconfig/editorconfig-vim'
Plug 'itchyny/lightline.vim'
Plug 'junegunn/fzf'
Plug 'junegunn/fzf.vim'
" Plug 'mattn/emmet-vim'
" Plug 'scrooloose/nerdtree'
Plug 'terryma/vim-multiple-cursors'
" Plug 'tpope/vim-eunuch'
Plug 'tpope/vim-surround'
" Plug 'w0rp/ale'
Plug 'tpope/vim-sensible'
Plug 'tomasr/molokai'
Plug 'luochen1990/rainbow'
Plug 'tpope/vim-fugitive'
" Plug 'vim-airline/vim-airline'
" Plug 'vim-airline/vim-airline-themes'
Plug 'Yggdroot/indentline'
call plug#end()
set visualbell
set t_vb=
set nu
set hlsearch
set noswapfile
" Encoding
set encoding=utf-8
" Whitespace
set wrap
set textwidth=79
set formatoptions=tcqrn1
set tabstop=2
set shiftwidth=2
set softtabstop=2
set expandtab
set noshiftround
set colorcolumn=101
set pastetoggle=<C-p>
" map <C-n> :NERDTreeToggle<CR>
" nnoremap <leader>n :NERDTreeFocus<CR>
" nnoremap <C-n> :NERDTree<CR>
" nnoremap <C-t> :NERDTreeToggle<CR>
" nnoremap <C-f> :NERDTreeFind<CR>
nnoremap <C-f> :Files<CR>
function! Tab_Or_Complete()
if col('.')>1 && strpart( getline('.'), col('.')-2, 3 ) =~ '^\w'
return "\<C-N>"
else
return "\<Tab>"
endif
endfunction
:inoremap <Tab> <C-R>=Tab_Or_Complete()<CR>
:set dictionary="/usr/dict/words"
" filetype detection "
augroup filetypedetect
au! BufRead,BufNewFile _vimrc,*.vim,vimrc set filetype=vim
au! BufRead,BufNewFile *.erb set ts=2 | set sw=2 | set filetype=eruby
au! BufRead,BufNewFile *.mako set ts=2 | set sw=2 | set filetype=mako
au! BufRead,BufNewFile *.rb,*.builder,*.axlsx set ts=2 | set sw=2 | set filetype=ruby
au! BufRead,BufNewFile *.py,*.pip set ts=4 | set sw=4 | set filetype=python
au! BufRead,BufNewFile *.rom,*.sql set ts=4 | set sw=4 | set filetype=sql
au! BufRead,BufNewFile *.js,*.json,*.coffee set ts=2 | set sw=2 | set filetype=javascript
au! BufRead,BufNewFile *.css,*.scss,*.less set ts=2 | set sw=2 | set filetype=css
au! BufRead,BufNewFile *.yaml,*.yml set ts=2 | set sw=2 | set filetype=yaml
au! BufRead,BufNewFile *.sh set ts=4 | set sw=4 | set filetype=sh
au! BufRead,BufNewFile *.ini,*.cfg,*.hgrc set ts=2 | set sw=2 | set filetype=dosini
au! BufRead,BufNewFile *.txt,*.dat,*.csv set filetype=csv | setlocal nowrap | setlocal ts=16
au! BufRead,BufNewFile *.html set ts=2 | set sw=2 | set filetype=mako
au! BufRead,BufNewFile *.xml set ts=2 | set sw=2 | set filetype=xml
au! BufRead,BufNewFile * if expand('%:t') ~ 'hgrc' | set ts=2 | set sw=2 | set filetype=dosini | endif
au! BufRead,BufNewFile * if expand('%:t') !~ '\.' | set filetype=ruby | endif
augroup END
" Cursor motion
set scrolloff=3
set backspace=indent,eol,start
set matchpairs+=<:> " use % to jump between pairs
runtime! macros/matchit.vim
" Color scheme (terminal)
set background=dark
set t_Co=256
" remove trailing whitespace on save "
au BufWritePre * :%s/\s\+$//e
syntax enable
colorscheme molokai
let g:molokai_original = 1
let g:lightline = {
\ 'colorscheme': 'wombat',
\ 'active': {
\ 'left': [ [ 'mode', 'paste' ],
\ [ 'gitbranch', 'readonly', 'filename', 'modified' ] ]
\ },
\ 'component_function': {
\ 'gitbranch': 'FugitiveHead'
\ },
\ }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment