All Projects → tenfyzhong → Completeparameter.vim

tenfyzhong / Completeparameter.vim

Licence: mit
Complete parameter after select the completion. Integration with YouCompleteMe(ycm), deoplete, neocomplete.

Projects that are alternatives of or similar to Completeparameter.vim

vim
📝 minimalistic vimrc based on KISS principle @vim
Stars: ✭ 46 (-82.17%)
Mutual labels:  vim-plugin
vim-wordy
Uncover usage problems in your writing
Stars: ✭ 677 (+162.4%)
Mutual labels:  vim-plugin
fzf-folds.vim
Vim plugin that lets you fuzzy search for folds in a file
Stars: ✭ 15 (-94.19%)
Mutual labels:  vim-plugin
vim-qf-preview
Preview the quickfix item under the cursor in a popup window
Stars: ✭ 32 (-87.6%)
Mutual labels:  vim-plugin
himalaya
Command-line interface for email management
Stars: ✭ 1,715 (+564.73%)
Mutual labels:  vim-plugin
vim-opex
Vim operators to execute text objects
Stars: ✭ 19 (-92.64%)
Mutual labels:  vim-plugin
vim-eightheader
Vim plugin: Easily create custom headlines, foldtext, toc, etc
Stars: ✭ 17 (-93.41%)
Mutual labels:  vim-plugin
roast.vim
An HTTP client for Vim, that can also be used as a REST client.
Stars: ✭ 78 (-69.77%)
Mutual labels:  vim-plugin
unfog.vim
⏱ Vim plugin for Unfog CLI task & time manager.
Stars: ✭ 61 (-76.36%)
Mutual labels:  vim-plugin
vim-hugo-helper
A small Vim plugin with a set of helpers for Hugo https://gohugo.io
Stars: ✭ 82 (-68.22%)
Mutual labels:  vim-plugin
virt-column.nvim
Display a character as the colorcolumn
Stars: ✭ 64 (-75.19%)
Mutual labels:  vim-plugin
vim-twitter
Tweet from inside vim!
Stars: ✭ 26 (-89.92%)
Mutual labels:  vim-plugin
cmp-under-comparator
nvim-cmp comparator function for completion items that start with one or more underlines
Stars: ✭ 77 (-70.16%)
Mutual labels:  vim-plugin
vim-goyacc
Vim filetype support for goyacc
Stars: ✭ 22 (-91.47%)
Mutual labels:  vim-plugin
format.nvim
Neovim lua plugin to format the current buffer with external executables
Stars: ✭ 189 (-26.74%)
Mutual labels:  vim-plugin
vim-gol
Vim plugin that turns your text into Game of Life world
Stars: ✭ 15 (-94.19%)
Mutual labels:  vim-plugin
vim-docker-tools
Toolkit for managing docker containers in vim.
Stars: ✭ 95 (-63.18%)
Mutual labels:  vim-plugin
gx-extended.vim
Extend gx to use it beyond just URLs!
Stars: ✭ 23 (-91.09%)
Mutual labels:  vim-plugin
vim-highlighter
Highlight words and expressions
Stars: ✭ 57 (-77.91%)
Mutual labels:  vim-plugin
fileselect
File Selector Vim Plugin
Stars: ✭ 14 (-94.57%)
Mutual labels:  vim-plugin

CompleteParameter.vim

Join the chat at https://gitter.im/tenfyzhong/CompleteParameter.vim Build Status GitHub tag Vim Version doc

CompleteParameter is a plugin for complete function's parameters after complete a function.

If you like this plugin, please star it.

Screenshots

Without CompleteParameter, only insert the function name. ycm_only

With CompleteParameter, insert the function name and parameters. You can jump to the next parameter use <c-j> and jump to the previous parameter use <c-k>. ycm_with_cp

Features

  • Complete parameters after select a complete item from the completion popup menu.
  • After complete the parameters, jump to the first parameter and the select it.
  • Jump to next parameter.
  • Jump to previous parameter.
  • Select next overload function.
  • Select previous overload function.
  • Select the first item in the completion popup menu.
  • Echo signature when select an item. (need to set noshowmode or set cmdheight=2)

Install

I suggest you to use a plugin manager, such vim-plug or other.

Plug 'tenfyzhong/CompleteParameter.vim'
  • Manual
git clone https://github.com/tenfyzhong/CompleteParameter.vim.git ~/.vim/bundle/CompleteParameter.vim
echo 'set rtp+=~/.vim/bundle/CompleteParameter.vim' >> ~/.vimrc
vim -c 'helptag ~/.vim/bundle/CompleteParameter.vim/doc' -c qa!

Usage

Install a complete engine have supported. Goto the completion item of the completion popup menu you want to select, and then type ((minimal setting), the parameters will be inserted and select the the first parameter. <c-j>/<c-k>(minimal setting) will jump to the next/previous parameter and select it.

Minimal setting

inoremap <silent><expr> ( complete_parameter#pre_complete("()")
smap <c-j> <Plug>(complete_parameter#goto_next_parameter)
imap <c-j> <Plug>(complete_parameter#goto_next_parameter)
smap <c-k> <Plug>(complete_parameter#goto_previous_parameter)
imap <c-k> <Plug>(complete_parameter#goto_previous_parameter)

The parameter of complete_parameter#pre_complete will be insert if parameter completion failed.

Mapping

<Plug>(complete_parameter#goto_next_parameter)

Goto next parameter and select it.
eg:

nmap <c-j> <Plug>(complete_parameter#goto_next_parameter)
imap <c-j> <Plug>(complete_parameter#goto_next_parameter)
smap <c-j> <Plug>(complete_parameter#goto_next_parameter)

<Plug>(complete_parameter#goto_previous_parameter)

Goto previous parameter and select it.
eg:

nmap <c-k> <Plug>(complete_parameter#goto_previous_parameter)
imap <c-k> <Plug>(complete_parameter#goto_previous_parameter)
smap <c-k> <Plug>(complete_parameter#goto_previous_parameter)

<Plug>(complete_parameter#overload_down)

Select next overload function.
eg:

nmap <m-d> <Plug>(complete_parameter#overload_down)
imap <m-d> <Plug>(complete_parameter#overload_down)
smap <m-d> <Plug>(complete_parameter#overload_down)

<Plug>(complete_parameter#overload_up)

Select previous overload function.
eg:

nmap <m-u> <Plug>(complete_parameter#overload_up)
imap <m-u> <Plug>(complete_parameter#overload_up)
smap <m-u> <Plug>(complete_parameter#overload_up)

Options

The g:complete_parameter_log_level option

This option set the log level.
5: disable log. 4: only print error log.
2: print error and debug log.
1: print error, debug, trace log.
Default: 5

let g:complete_parameter_log_level = 5

The g:complete_parameter_use_ultisnips_mappings option

If this option is 1 and you use ultisnips together, it will use ultisnips mapping to goto next or previous parameter.
default: 0

let g:complete_parameter_use_ultisnips_mapping = 0

The g:complete_parameter_echo_signature option

It will echo signature if this option is 1. (need to set noshowmode or set cmdheight=2) default: 1

let g:complete_parameter_echo_signature = 1

The g:complete_parameter_py_keep_value option

It will keep default value if this option is 1 for python.
For example, if the definition is def foo(a=1, b=2), it will complete (a=1, b=2) if its value is 1. Otherwise, it will complete (a, b). If there are = in the completion, the jump to action only select the value, but not parameter name. It will select 1 and then 2 in the previous example. default: 1

let g:complete_parameter_py_keep_value = 1

The g:complete_parameter_py_remove_default option

It will remove default parametrs if this option is 1 for python.
For example, if the definition is def foo(a, b=1), it will complete (a) if its value is 1. Otherwise, it will complete (a, b).
default: 1

let g:complete_parameter_py_remove_default = 1

Supported

The cell mark means the completion engine has supported the language by itself. Of course, you must install the completion engine for the language follow its document.
The plugin in the cell was supported with the completion engine.

YouCompleteMe deoplete neocomplete clang_complete
c deoplete-clang clang_complete
cpp deoplete-clang clang_complete
go vim-go vim-go
python deoplete-jedi jedi-vim
rust deoplete-rust vim-racer
javascript deoplete-ternjs tern_for_vim
typescript nvim-typescript tsuquyomi
erlang vim-erlang-omnicomplete vim-erlang-omnicomplete vim-erlang-omnicomplete

Setting for completion plugins

vim-racer

let g:racer_experimental_completer = 1

tern_for_vim

if !exists('g:neocomplete#force_omni_input_patterns')
    let g:neocomplete#force_omni_input_patterns = {}
endif
let g:neocomplete#force_omni_input_patterns.javascript = '[^. \t]\.\w*'

tsuquyomi

let g:tsuquyomi_completion_detail = 1
if !exists('g:neocomplete#force_omni_input_patterns')
    let g:neocomplete#force_omni_input_patterns = {}
endif
let g:neocomplete#force_omni_input_patterns.typescript = '[^. *\t]\.\w*\|\h\w*::'

FAQ

Can't work with plugin auto-pairs use the default mapping (

Because the auto-pairs use inoremap to mapping the keys. It can't call this plugin after the auto-pairs process. You can add the following setting to you .vimrc, and it'll work well.

let g:AutoPairs = {'[':']', '{':'}',"'":"'",'"':'"', '`':'`'}
inoremap <buffer><silent> ) <C-R>=AutoPairsInsert(')')<CR>

Can't jump to next parameter

If you use ultinsips, you must load ultisnips before this plugin. In other words, if you use plug to load plugins, Plug 'SirVer/ultisnips' must before Plug 'tenfyzhong/CompleteParameter.vim' in your vimrc.

How to accept the selected function but not parameters

You can type <c-y> key to accept the selected function and stop completion. When the popup menu is disappeared, the parameters will not be insert.

The mapping <c-j> doesn't jump to the next parameter, but delete the selected words.

If you use neosnippet, Please set g:neosnippet#disable_select_mode_mappings to 0. It will remove all select mappings. If you don't use neosnippet, please send me a issue, and give me the plugins you are using.

Contributions

Contributions and pull requests are welcome.

Thanks

LICENSE

MIT License Copyright (c) 2017 tenfyzhong

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].