Skip to content
This repository was archived by the owner on Mar 26, 2020. It is now read-only.
/ fizzy.vim Public archive

User auto-completions based on regular expressions -- automate the boring parts of any programming language.

License

Notifications You must be signed in to change notification settings

StanAngeloff/fizzy.vim

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

fizzy.vim

User auto-completions based on regular expressions -- automate the boring parts of any programming language.

📺   Screencast

WIP.

Installation

Install with Pathogen

If you don't have a preferred installation method, you should use pathogen.vim, and then run in a shell:

cd ~/.vim/bundle
git clone git://github.com/StanAngeloff/fizzy.vim.git

Install with Vundle

Open ~/.vimrc in your favourite editor and append:

Bundle 'StanAngeloff/fizzy.vim'

and then run in a shell:

vim -c 'silent! BundleInstall' -c 'qa!'

Contributing

fizzy.vim has limited completions for a limited list of languages. You can contribute by creating plug-ins and completions for more languages. See the autoload/fizzy/completions/php.vim and ftplugin/php/fizzy.vim for code.

Usage

To trigger a completion, use <C-X><C-U> at the end of a line in a supported file.

In PHP

There are a few completions currently supported in PHP.

<?php

# - Create a type-hinted private property -------------

private array $list;

    ⇣

/**
 * @var array
 */
private $list;

# - Expand an isset(..) expression at the first '?' ---

$timezone?->getName()
$property->timezone?->getName()

    

(isset ($timezone) ? $timezone->getName() : null)
(isset ($property->timezone) ? $property->timezone->getName() : null)

# - Return a property and initialize it once ----------

return $this->eventDispatcher = new EventDispatcher();

    ⇣

if ($this->eventDispatcher === null) {
    $this->eventDispatcher = new EventDispatcher();
}

return $this->eventDispatcher;

# - Check if one or more variables are set ------------

if isset $this->repository $this->eventDispatcherif (isset ($this->repository) && isset ($this->eventDispatcher)) {
    
}

Tips

You can set up Vim to auto-complete expressions using the <Tab> key. The below script will not work if you have Supertab or similar installed, however.

" {{{ Tab completion

function! BestComplete()

  " If fizzy.vim has results, use 'completefunc' to complete.
  if exists('g:loaded_fizzy')
    let fizzy_position = fizzy#Complete(1, '')
    if fizzy_position != col('.')
      let fizzy_completions = fizzy#Complete(0, getline('.')[fizzy_position : col('.')])
      if len(fizzy_completions)
        if len(fizzy_completions) > 1
          return "\<C-X>\<C-U>\<C-N>"
        else
          return "\<C-X>\<C-U>\<C-N>\<C-Y>"
        endif
      endif
    endif
  endif

  return "\<Tab>"
endfunction

inoremap <silent> <Tab> <C-R>=BestComplete()<CR>

" }}}

Bug Reports

File a bug on GitHub Issues.

About

User auto-completions based on regular expressions -- automate the boring parts of any programming language.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published