Skip to content

Instantly share code, notes, and snippets.

@matthewbdaly
Last active November 2, 2022 15:27
Show Gist options
  • Save matthewbdaly/1fa755328336c75f6e0dce54a0970948 to your computer and use it in GitHub Desktop.
Save matthewbdaly/1fa755328336c75f6e0dce54a0970948 to your computer and use it in GitHub Desktop.
My older vim config, for working with PHP 7.1 when necessary
let g:polyglot_disabled = ['markdown']
call plug#begin()
" NERDTree
Plug 'preservim/nerdtree'
" Git integration
Plug 'tpope/vim-fugitive'
Plug 'airblade/vim-gitgutter'
" Linting
Plug 'dense-analysis/ale'
" PHP-specific integration
let g:phpactorPhpBin = "~/.phpbrew/php/php-7.1.33/bin/php"
Plug 'phpactor/phpactor' , {'do': 'composer1 install --no-dev -o', 'for': 'php', 'frozen': '1', 'tag': '0.14.1'}
" Snippets
Plug 'MarcWeber/vim-addon-mw-utils'
Plug 'tomtom/tlib_vim'
Plug 'garbas/vim-snipmate'
Plug 'honza/vim-snippets'
" Completion
Plug 'ncm2/ncm2'
Plug 'ncm2/ncm2-bufword'
Plug 'ncm2/ncm2-path'
" Comments
Plug 'tpope/vim-commentary'
" Search
Plug 'junegunn/fzf', { 'do': { -> fzf#install() } }
Plug 'junegunn/fzf.vim'
" Syntax
Plug 'sheerun/vim-polyglot'
Plug 'matthewbdaly/vim-filetype-settings'
Plug 'matthewbdaly/vim-statamic-antlers'
" Themes
Plug 'nanotech/jellybeans.vim' , {'as': 'jellybeans'}
Plug 'ryanoasis/vim-devicons'
Plug 'tiagofumo/vim-nerdtree-syntax-highlight'
" Editorconfig
Plug 'editorconfig/editorconfig-vim'
" Airline
Plug 'vim-airline/vim-airline'
Plug 'vim-airline/vim-airline-themes'
call plug#end()
"Completion
autocmd FileType * setlocal formatoptions-=c formatoptions-=r formatoptions-=o
set ofu=syntaxcomplete#Complete
autocmd FileType php setlocal omnifunc=phpactor#Complete
let g:phpactorOmniError = v:true
set completeopt=noinsert,menuone,noselect
"General
syntax on
colorscheme jellybeans
let g:airline_theme='jellybeans'
set nu
filetype plugin indent on
set nocp
set ruler
set wildmenu
set wildignore=.svn,CVS,.git,*.o,*.a,*.class,*.mo,*.la,*.so,*.obj,*.swp,*.jpg,*.png,*.xpm,*.gif
set mouse-=a
set t_Co=256
let g:snipMate = { 'snippet_version' : 1 }
set cmdheight=0
"Code folding
set foldmethod=manual
"Tabs and spacing
set autoindent
set cindent
set tabstop=4
set expandtab
set shiftwidth=4
set smarttab
"Search
set hlsearch
set incsearch
set ignorecase
set smartcase
set diffopt +=iwhite
"Use FZF for search
nnoremap <C-p> :Files<Cr>
let g:fzf_tags_command = 'ctags'
"Open quickfix window after running git grep
autocmd QuickFixCmdPost *grep* cwindow
"Syntax highlighting in Markdown
au BufNewFile,BufReadPost *.md set filetype=markdown
let g:markdown_fenced_languages = ['bash=sh', 'css', 'django', 'javascript', 'js=javascript', 'json=javascript', 'perl', 'php', 'python', 'ruby', 'sass', 'xml', 'html', 'vim']
" PHPActor config
" Include use statement
nmap <Leader>u :call phpactor#UseAdd()<CR>
" Invoke the context menu
nmap <Leader>mm :call phpactor#ContextMenu()<CR>
" Invoke the navigation menu
nmap <Leader>nn :call phpactor#Navigate()<CR>
" Goto definition of class or class member under the cursor
nmap <Leader>o :call phpactor#GotoDefinition()<CR>
" Transform the classes in the current file
nmap <Leader>tt :call phpactor#Transform()<CR>
" Generate a new class (replacing the current file)
nmap <Leader>cc :call phpactor#ClassNew()<CR>
" Extract expression (normal mode)
nmap <silent><Leader>ee :call phpactor#ExtractExpression(v:false)<CR>
" Extract expression from selection
vmap <silent><Leader>ee :<C-U>call phpactor#ExtractExpression(v:true)<CR>
" Extract method from selection
vmap <silent><Leader>em :<C-U>call phpactor#ExtractMethod()<CR>
" Advanced customization using autoload functions
inoremap <expr> <c-x><c-k> fzf#vim#complete#word({'left': '15%'})
" %s is the error or warning message
let g:ale_echo_msg_format = '%linter% says %s'
" Map keys to navigate between lines with errors and warnings.
nnoremap <leader>an :ALENextWrap<cr>
nnoremap <leader>ap :ALEPreviousWrap<cr>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment