Skip to content

Instantly share code, notes, and snippets.

@dmamills
Created September 10, 2020 19:42
Show Gist options
  • Save dmamills/2ee9bfafa909d0becf53dbc13c554ec7 to your computer and use it in GitHub Desktop.
Save dmamills/2ee9bfafa909d0becf53dbc13c554ec7 to your computer and use it in GitHub Desktop.
" vim settings
call plug#begin('~/.vim/plugged')
Plug 'crusoexia/vim-monokai'
Plug 'itchyny/lightline.vim'
Plug 'tpope/vim-commentary'
Plug 'mileszs/ack.vim'
Plug 'StanAngeloff/php.vim'
Plug 'Shougo/vimproc.vim', {'do' : 'make'}
Plug 'MaxMEllon/vim-jsx-pretty'
Plug 'posva/vim-vue'
Plug 'ctrlpvim/ctrlp.vim'
Plug 'janko/vim-test'
Plug 'scrooloose/nerdtree', { 'on': 'NERDTreeToggle' }
Plug 'shawncplus/phpcomplete.vim'
Plug 'leafgarland/typescript-vim'
call plug#end()
set termguicolors
syntax on
colorscheme monokai
filetype plugin on
filetype indent on
"Always show current position
set ruler
"
" Height of the command bar
set cmdheight=1
" A buffer becomes hidden when it is abandoned
set hid
" Configure backspace so it acts as it should act
set backspace=eol,start,indent
set whichwrap+=<,>,h,l
" Ignore case when searching
set ignorecase
" When searching try to be smart about cases
set smartcase
" Highlight search results
set hlsearch
" Makes search act like search in modern browsers
set incsearch
" Don't redraw while executing macros (good performance config)
set lazyredraw
" For regular expressions turn magic on
set magic
" Show matching brackets when text indicator is over them
set showmatch
" How many tenths of a second to blink when matching brackets
set mat=2
" No annoying sound on errors
set noerrorbells
set novisualbell
set t_vb=
set tm=500
set nobackup
set nowb
set noswapfile
set expandtab
set nu
set smarttab
set smartindent
" 1 tab == 4 spaces
set shiftwidth=2
set tabstop=2
set laststatus=2
" Linebreak on 500 characters
set lbr
set tw=500
set ai "Auto indent
set si "Smart indent
set wrap "Wrap lines
let mapleader = ","
nmap <leader>w :w!<cr>
map <space> /
map <C-space> ?
" Close the current buffer
map <leader>bd :bd<cr>:tabclose<cr>gT
" Close all the buffers
map <leader>ba :bufdo bd<cr>
map <leader>l :bnext<cr>
map <leader>h :bprevious<cr>
" Delete trailing white space on save, useful for some filetypes ;)
fun! CleanExtraSpaces()
let save_cursor = getpos(".")
let old_query = getreg('/')
silent! %s/\s\+$//e
call setpos('.', save_cursor)
call setreg('/', old_query)
endfun
if has("autocmd")
autocmd BufWritePre *.txt,*.js,*.py,*.wiki,*.sh,*.coffee :call CleanExtraSpaces()
endif
""""""""""""""""""""""""""""""
" => CTRL-P
""""""""""""""""""""""""""""""
let g:ctrlp_working_path_mode = 0
let g:ctrlp_map = '<C-f>'
map <leader>j :CtrlP<cr>
map <C-b> :CtrlPBuffer<cr>
let g:ctrlp_max_height = 20
let g:ctrlp_custom_ignore = 'node_modules\|^\.DS_Store\|^\.git\|^\.coffee'
let g:ctrlp_user_command = ['.git', 'cd %s && git ls-files -co --exclude-standard']
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" => Nerd Tree
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
let g:NERDTreeWinPos = "left"
let NERDTreeShowHidden=0
let NERDTreeIgnore = []
let g:NERDTreeWinSize=35
map <leader>nn :NERDTreeToggle<cr>
map <leader>nb :NERDTreeFromBookmark<Space>
map <leader>nf :NERDTreeFind<cr>
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" => vim-test
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
function! VagrantTransform(cmd) abort
let extension = expand('%:e')
if extension == 'php'
return 'vagrant ssh --command '.shellescape('cd code; '.a:cmd)
else
return a:cmd
endif
endfunction
let g:test#custom_transformations = {'vagrant': function('VagrantTransform')}
let g:test#transformation = 'vagrant'
map <leader>t :TestNearest<cr>
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" => ack-vim
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
if executable('ag')
let g:ackprg = 'ag --vimgrep'
endif
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" => php-complete
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
let g:phpcomplete_mappings = {
\ 'jump_to_def': ',g',
\ }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment