All Projects → maralla → Completor.vim

maralla / Completor.vim

Licence: mit
Async completion framework made ease.

Programming Languages

python
139335 projects - #7 most used programming language

Projects that are alternatives of or similar to Completor.vim

Alchemist.vim
Elixir Integration Into Vim
Stars: ✭ 632 (-45.42%)
Mutual labels:  code-completion, vim-plugin, neovim-plugin
Coc.nvim
Nodejs extension host for vim & neovim, load extensions like VSCode and host language servers.
Stars: ✭ 18,268 (+1477.55%)
Mutual labels:  lsp, vim-plugin, neovim-plugin
Gen tags.vim
Async plugin for vim and neovim to ease the use of ctags/gtags
Stars: ✭ 288 (-75.13%)
Mutual labels:  vim-plugin, neovim-plugin
Blamer.nvim
A git blame plugin for neovim inspired by VS Code's GitLens plugin
Stars: ✭ 283 (-75.56%)
Mutual labels:  vim-plugin, neovim-plugin
Vim Template
Simple templates plugin for Vim
Stars: ✭ 328 (-71.68%)
Mutual labels:  vim-plugin, neovim-plugin
gx-extended.vim
Extend gx to use it beyond just URLs!
Stars: ✭ 23 (-98.01%)
Mutual labels:  vim-plugin, neovim-plugin
Coc Fzf
fzf ❤️ coc.nvim
Stars: ✭ 261 (-77.46%)
Mutual labels:  lsp, neovim-plugin
Languageclient Neovim
Language Server Protocol (LSP) support for vim and neovim.
Stars: ✭ 3,352 (+189.46%)
Mutual labels:  vim-plugin, neovim-plugin
virt-column.nvim
Display a character as the colorcolumn
Stars: ✭ 64 (-94.47%)
Mutual labels:  vim-plugin, neovim-plugin
Tmux Complete.vim
Vim plugin for insert mode completion of words in adjacent tmux panes
Stars: ✭ 447 (-61.4%)
Mutual labels:  vim-plugin, neovim-plugin
Lens.vim
A Vim Automatic Window Resizing Plugin
Stars: ✭ 381 (-67.1%)
Mutual labels:  vim-plugin, neovim-plugin
Vim Markdown Composer
An asynchronous markdown preview plugin for Vim and Neovim.
Stars: ✭ 501 (-56.74%)
Mutual labels:  vim-plugin, neovim-plugin
format.nvim
Neovim lua plugin to format the current buffer with external executables
Stars: ✭ 189 (-83.68%)
Mutual labels:  vim-plugin, neovim-plugin
null-ls.nvim
Use Neovim as a language server to inject LSP diagnostics, code actions, and more via Lua.
Stars: ✭ 965 (-16.67%)
Mutual labels:  neovim-plugin, lsp
Vim Monokai Tasty
VIM Colour scheme
Stars: ✭ 279 (-75.91%)
Mutual labels:  vim-plugin, neovim-plugin
cmp-under-comparator
nvim-cmp comparator function for completion items that start with one or more underlines
Stars: ✭ 77 (-93.35%)
Mutual labels:  vim-plugin, neovim-plugin
Dashboard Nvim
vim dashboard
Stars: ✭ 294 (-74.61%)
Mutual labels:  vim-plugin, neovim-plugin
coc-tailwind-intellisense
Coc.nvim extension for Tailwind CSS IntelliSense
Stars: ✭ 117 (-89.9%)
Mutual labels:  neovim-plugin, lsp
aurora
24-bit dark theme for (Neo)vim. Optimized for treesitter, LSP.
Stars: ✭ 141 (-87.82%)
Mutual labels:  neovim-plugin, lsp
Barbar.nvim
A neovim tabline plugin.
Stars: ✭ 359 (-69%)
Mutual labels:  vim-plugin, neovim-plugin

Completor

Test Status

Completor is an asynchronous code completion framework for vim8. New features of vim8 are used to implement the fast completion engine with low overhead. For using semantic completion, external completion tools should be installed.

Demo

Requirements

  • vim8,
  • compiled with python or python3

Install

  • vim8 builtin package manager:
$ mkdir -p ~/.vim/pack/completor/start
$ cd ~/.vim/pack/completor/start
$ git clone https://github.com/maralla/completor.vim.git
$ pack install maralla/completor.vim
Plug 'maralla/completor.vim'

Completers

Filename

When the input matches a file path pattern the file name will be automatically completed.

Buffer

This is the fallback completer. When no semantic completer found the buffer completer will be used and will complete based on the current buffers.

Ultisnips and neosnippet

Ultisnips is supported by default. If ultisnips is installed, the snips candidates will show on the completion popup menu.

Use this plugin completor-neosnippet for neosnippet support.

Neoinclude

Neoinclude is supported by default. If neoinclude is installed, the include candidates will show on the completion popup menu.

dictionary

Dictionary completion is supported by completor-dictionary.

shell

You can add some complete functions with shell command by completor-shell.

tmux

Completion from words in tmux panes is supported by completor-tmux.

Python

Use jedi for completion. jedi should be installed for semantic completion. Install jedi to global environment or in virtualenv:

pip install jedi

The python executable can be specified using:

let g:completor_python_binary = '/path/to/python/with/jedi/installed'

Rust

Use racer for completion. Install racer first. To specify the racer executable path:

let g:completor_racer_binary = '/path/to/racer'

Javascript

Use tern for completion. To install tern you must have node and either npm or yarn installed. Then go to the completor.vim directory and run:

make js

The node executable path can be specified using:

let g:completor_node_binary = '/path/to/node'

If you're using vim-plug, you can just use post install hook to do this for you.

Plug 'ternjs/tern_for_vim', { 'do': 'npm install' }
Plug 'maralla/completor.vim', { 'do': 'make js' }

c/c++

Use clang for completion. Clang should be installed first. To specify clang path:

let g:completor_clang_binary = '/path/to/clang'

To pass extra clang arguments, you can create a file named .clang_complete under the project root directory or any parent directories. Every argument should be in a single line in the file. This is an example file:

-std=c++11
-I/Users/maralla/Workspace/src/dji-sdk/Onboard-SDK/lib/inc
-I/Users/maralla/Workspace/src/dji-sdk/Onboard-SDK/sample/Linux/inc

The key mapping <Plug>CompletorCppJumpToPlaceholder can be defined to jump to placeholders:

map <tab> <Plug>CompletorCppJumpToPlaceholder
imap <tab> <Plug>CompletorCppJumpToPlaceholder

go

Use gocode to provide omni completions. To specify the gocode executable path:

let g:completor_gocode_binary = '/path/to/gocode'

swift

Use completor-swift.

Elixir

Use alchemist.vim.

vim script

Use completor-necovim.

type script

Use completor-typescript.

other languages

For other omni completions completor not natively implemented, auto completion can still be used if an omni function is defined for the file type. But an option should be defined to specify the trigger for triggering auto completion. The option name pattern:

let g:completor_{filetype}_omni_trigger = '<python regex>'

For example to use css omnifunc:

let g:completor_css_omni_trigger = '([\w-]+|@[\w-]*|[\w-]+:\s*[\w-]*)$'

Tips

Config tern for javascript completion

This is simple .tern-project file:

{
  "plugins": {
    "node": {},
    "es_modules": {}
  },
  "libs": [
    "ecma5",
    "ecma6"
  ],
  "ecmaVersion": 6
}

Use Tab to select completion

inoremap <expr> <Tab> pumvisible() ? "\<C-n>" : "\<Tab>"
inoremap <expr> <S-Tab> pumvisible() ? "\<C-p>" : "\<S-Tab>"
inoremap <expr> <cr> pumvisible() ? "\<C-y>" : "\<cr>"

Use Tab to trigger completion (disable auto trigger)

let g:completor_auto_trigger = 0
inoremap <expr> <Tab> pumvisible() ? "<C-N>" : "<C-R>=completor#do('complete')<CR>"

A better way:

" Use TAB to complete when typing words, else inserts TABs as usual.  Uses
" dictionary, source files, and completor to find matching words to complete.

" Note: usual completion is on <C-n> but more trouble to press all the time.
" Never type the same word twice and maybe learn a new spellings!
" Use the Linux dictionary when spelling is in doubt.
function! Tab_Or_Complete() abort
  " If completor is already open the `tab` cycles through suggested completions.
  if pumvisible()
    return "\<C-N>"
  " If completor is not open and we are in the middle of typing a word then
  " `tab` opens completor menu.
  elseif col('.')>1 && strpart( getline('.'), col('.')-2, 3 ) =~ '^[[:keyword:][:ident:]]'
    return "\<C-R>=completor#do('complete')\<CR>"
  else
    " If we aren't typing a word and we press `tab` simply do the normal `tab`
    " action.
    return "\<Tab>"
  endif
endfunction

" Use `tab` key to select completions.  Default is arrow keys.
inoremap <expr> <Tab> pumvisible() ? "\<C-n>" : "\<Tab>"
inoremap <expr> <S-Tab> pumvisible() ? "\<C-p>" : "\<S-Tab>"

" Use tab to trigger auto completion.  Default suggests completions as you type.
let g:completor_auto_trigger = 0
inoremap <expr> <Tab> Tab_Or_Complete()

Complete Options (completeopt)

Completor try its best to not overwrite the config completeopt, so the config g:completor_complete_options is introduced to be the complete option when completor is triggered.

let g:completor_complete_options = 'menuone,noselect,preview'

If you explicitly set completeopt completor will not use this value for complete options.

Completor Actions

  • Jump to definition completor#do('definition')
  • Show documentation completor#do('doc')
  • Format code completor#do('format')
  • Hover info (lsp hover) completor#do('hover')
noremap <silent> <leader>d :call completor#do('definition')<CR>
noremap <silent> <leader>c :call completor#do('doc')<CR>
noremap <silent> <leader>f :call completor#do('format')<CR>
noremap <silent> <leader>s :call completor#do('hover')<CR>

Golang practices (without using lsp)

Use guru for jumping to definition:

let g:completor_go_guru_binary = 'guru'

Use goimports to format code:

let g:completor_go_gofmt_binary = 'goimports'

Format file after write to buffer:

autocmd BufWritePost *.go :call completor#do('format')

c/c++ practices (without using lsp)

Jump to completion placeholder:

map <c-\> <Plug>CompletorCppJumpToPlaceholder
imap <c-\> <Plug>CompletorCppJumpToPlaceholder

Disable completion placeholder:

let g:completor_clang_disable_placeholders = 1

Enable LSP

let g:completor_filetype_map = {}
" Enable lsp for go by using gopls
let g:completor_filetype_map.go = {'ft': 'lsp', 'cmd': 'gopls'}
" Enable lsp for rust by using rls
let g:completor_filetype_map.rust = {'ft': 'lsp', 'cmd': 'rls'}
" Enable lsp for c by using clangd
let g:completor_filetype_map.c = {'ft': 'lsp', 'cmd': 'clangd-7'}
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].