Skip to content

Instantly share code, notes, and snippets.

@Santiago-j-s
Created October 18, 2018 22:18
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Santiago-j-s/67b9385a95f6c8eb1e87995e01714f4d to your computer and use it in GitHub Desktop.
Save Santiago-j-s/67b9385a95f6c8eb1e87995e01714f4d to your computer and use it in GitHub Desktop.
config de neovim
call plug#begin('~/.vim/plugged')
" git
Plug 'tpope/vim-fugitive'
Plug 'mhinz/vim-signify'
" status line
Plug 'itchyny/lightline.vim'
" start screen
Plug 'mhinz/vim-startify'
" easy comments (gcc, gc, gcgc)
Plug 'tpope/vim-commentary'
" surroundings, brackets, etc. (ds, cs, ys).
Plug 'tpope/vim-surround'
Plug 'Townk/vim-autoclose'
" highlight php files
Plug 'StanAngeloff/php.vim'
" in search, print actual index and total number of matches
Plug 'vim-scripts/IndexedSearch'
" tags
Plug 'ludovicchabant/vim-gutentags'
Plug 'majutsushi/tagbar'
" fuzzy finder for files
Plug 'ctrlpvim/ctrlp.vim'
" snippets
Plug 'sirver/ultisnips'
" refactoring and completions for php files
Plug 'ncm2/ncm2'
Plug 'ncm2/ncm2-ultisnips'
Plug 'roxma/nvim-yarp'
Plug 'phpactor/phpactor' , {'do': 'composer install', 'for': 'php'}
Plug 'phpactor/ncm2-phpactor'
" search
Plug 'mileszs/ack.vim'
call plug#end()
" fix weird symbols
" https://github.com/neovim/neovim/wiki/FAQ#nvim-shows-weird-symbols-2-q-when-changing-modes
:set guicursor=
:autocmd OptionSet guicursor noautocmd set guicursor=
" tabs and spaces
set expandtab
set tabstop=4
set softtabstop=4
set shiftwidth=4
" show line numbers
set number
" mouse support
set mouse=a
" jump to end of line while in insert mode
inoremap <C-e> <C-o>A
" tab mappings
map tt :tabnew
" clear last highlight
map <F3> :noh<CR>
" toggle tagbar
map <F4> :TagbarToggle<CR>
" shows start screen
map <F2> :Startify<CR>
" remove ugly vertical lines on window division
set fillchars+=vert:\
" fix color for dark backgrounds
set background=dark
" use 256 colors when possible
if (&term =~? 'mlterm\|xterm\|xterm-256\|screen-256') || has('nvim')
let &t_Co = 256
endif
" fix problems with uncommon shells (fish, xonsh) and plugins running commands
" (neomake, ...)
set shell=/bin/bash
" signify colors
highlight SignColumn ctermbg=NONE cterm=NONE guibg=NONE gui=NONE
highlight DiffAdd cterm=bold ctermbg=none ctermfg=119
highlight DiffDelete cterm=bold ctermbg=none ctermfg=167
highlight DiffChange cterm=bold ctermbg=none ctermfg=227
" ncm2
autocmd BufEnter * call ncm2#enable_for_buffer()
set completeopt=noinsert,menuone,noselect
" supress the annoying 'match x of y', 'The only match' and 'Pattern not
" found' messages
set shortmess+=c
" CTRL-C doesn't trigger the InsertLeave autocmd . map to <ESC> instead.
inoremap <c-c> <ESC>
" When the <Enter> key is pressed while the popup menu is visible, it only
" hides the menu. Use this mapping to close the menu and also start a new
" line.
inoremap <expr> <CR> (pumvisible() ? "\<c-y>\<cr>" : "\<CR>")
" Use <TAB> to select the popup menu:
inoremap <expr> <Tab> pumvisible() ? "\<C-n>" : "\<Tab>"
inoremap <expr> <S-Tab> pumvisible() ? "\<C-p>" : "\<S-Tab>"
" phpactor mappings
" 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>
" enter key triggers snippet expansion
inoremap <silent> <expr> <CR> ncm2_ultisnips#expand_or("\<CR>", 'n')
" c-j c-k for moving in snippet
let g:UltiSnipsJumpForwardTrigger = "<c-j>"
let g:UltiSnipsJumpBackwardTrigger = "<c-k>"
let g:UltiSnipsRemoveSelectModeMappings = 0
" search with silver searcher if available
if executable('ag')
let g:ackprg = 'ag --vimgrep'
endif
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment