All Projects → kristijanhusak → Vim Dadbod Completion

kristijanhusak / Vim Dadbod Completion

Licence: mit
Database autocompletion powered by https://github.com/tpope/vim-dadbod

Projects that are alternatives of or similar to Vim Dadbod Completion

Vim Dadbod Ui
Simple UI for https://github.com/tpope/vim-dadbod
Stars: ✭ 315 (+93.25%)
Mutual labels:  database, neovim, vim-plugins, neovim-plugin
Visual Split.vim
Vim plugin to control splits with visual selections or text objects
Stars: ✭ 190 (+16.56%)
Mutual labels:  neovim, vim-plugin, vim-plugins, neovim-plugin
Tmux Complete.vim
Vim plugin for insert mode completion of words in adjacent tmux panes
Stars: ✭ 447 (+174.23%)
Mutual labels:  neovim, vim-plugin, vim-plugins, neovim-plugin
Context.vim
Vim plugin that shows the context of the currently visible buffer contents
Stars: ✭ 688 (+322.09%)
Mutual labels:  neovim, vim-plugin, vim-plugins, neovim-plugin
Alchemist.vim
Elixir Integration Into Vim
Stars: ✭ 632 (+287.73%)
Mutual labels:  neovim, vim-plugin, vim-plugins, neovim-plugin
Targets.vim
Vim plugin that provides additional text objects
Stars: ✭ 2,114 (+1196.93%)
Mutual labels:  neovim, vim-plugin, vim-plugins, neovim-plugin
Neovim Fuzzy
Fuzzy file finding for neovim
Stars: ✭ 103 (-36.81%)
Mutual labels:  neovim, vim-plugin, neovim-plugin
Lens.vim
A Vim Automatic Window Resizing Plugin
Stars: ✭ 381 (+133.74%)
Mutual labels:  neovim, vim-plugin, neovim-plugin
Nvim Treesitter Context
Show code context
Stars: ✭ 113 (-30.67%)
Mutual labels:  neovim, vim-plugin, neovim-plugin
Vim Clap
👏 Modern performant fuzzy picker for Vim and NeoVim
Stars: ✭ 1,802 (+1005.52%)
Mutual labels:  neovim, vim-plugin, neovim-plugin
Blamer.nvim
A git blame plugin for neovim inspired by VS Code's GitLens plugin
Stars: ✭ 283 (+73.62%)
Mutual labels:  neovim, vim-plugin, neovim-plugin
Vim Markdown Composer
An asynchronous markdown preview plugin for Vim and Neovim.
Stars: ✭ 501 (+207.36%)
Mutual labels:  neovim, vim-plugin, neovim-plugin
Vem Tabline
A lightweight Vim/Neovim plugin to display buffers and tabs in the tabline
Stars: ✭ 129 (-20.86%)
Mutual labels:  neovim, vim-plugin, neovim-plugin
Barbar.nvim
A neovim tabline plugin.
Stars: ✭ 359 (+120.25%)
Mutual labels:  neovim, vim-plugin, neovim-plugin
Dashboard Nvim
vim dashboard
Stars: ✭ 294 (+80.37%)
Mutual labels:  neovim, vim-plugin, neovim-plugin
Hot Reload.vim
A (Neo)vim plugin for Flutter to automatically hot reload the project every time a file is saved
Stars: ✭ 33 (-79.75%)
Mutual labels:  neovim, vim-plugin, vim-plugins
Crease.vim
Easy foldtext customization for [neo]vim.
Stars: ✭ 19 (-88.34%)
Mutual labels:  neovim, vim-plugin, neovim-plugin
Todoist.nvim
A todoist extension for neovim
Stars: ✭ 84 (-48.47%)
Mutual labels:  neovim, vim-plugin, neovim-plugin
Vim Monokai Tasty
VIM Colour scheme
Stars: ✭ 279 (+71.17%)
Mutual labels:  neovim, vim-plugin, neovim-plugin
Gen tags.vim
Async plugin for vim and neovim to ease the use of ctags/gtags
Stars: ✭ 288 (+76.69%)
Mutual labels:  neovim, vim-plugin, neovim-plugin

vim-dadbod-completion

Database auto completion powered by vim-dadbod. Supports:

coc-db

Install

Dependencies:

For coc.nvim

:CocInstall coc-db

For deoplete, completion-nvim, nvim-compe and omnifunc, install it with your favorite plugin manager.

function! PackagerInit() abort
  packadd vim-packager
  call packager#init()
  call packager#add('kristijanhusak/vim-packager', { 'type': 'opt' })
  call packager#add('tpope/vim-dadbod')
  call packager#add('kristijanhusak/vim-dadbod-completion')

  call packager#add('Shougo/deoplete.nvim')
  "or
  call packager#add('haorenW1025/completion-nvim')
  "or
  call packager#add('hrsh7th/nvim-compe')
endfunction

" For built in omnifunc
autocmd FileType sql setlocal omnifunc=vim_dadbod_completion#omni

" hrsh7th/nvim-compe
let g:compe.source.vim_dadbod_completion = v:true

" For completion-nvim
augroup completion
  autocmd!
  autocmd BufEnter * lua require'completion'.on_attach()
  autocmd FileType sql let g:completion_trigger_character = ['.', '"', '`', '[']
augroup END

" Source is automatically added, you just need to include it in the chain complete list
let g:completion_chain_complete_list = {
    \   'sql': [
    \    {'complete_items': ['vim-dadbod-completion']},
    \   ],
    \ }
" Make sure `substring` is part of this list. Other items are optional for this completion source
let g:completion_matching_strategy_list = ['exact', 'substring']
" Useful if there's a lot of camel case items
let g:completion_matching_ignore_case = 1

Features

  • Autocomplete table names, with automatic quoting where needed. Works for all schemes that vim-dadbod supports.
  • Autocomplete table columns, context aware. Also knows to read aliases (select * from mytable tbl where tbl.id = 1). Currently works for PostgreSQL, MySQL, Oracle and SQLserver/MSSQL.
  • Out of the box integration with vim-dadbod-ui

How it works

  • If an sql buffer is created by vim-dadbod-ui, it reads all the configuration from there. It should work out of the box.
  • If vim-dadbod-ui is not used, vim-dadbod g:db or b:db is used. If you want, you can also add b:db_table to limit autocompletions to that table only.

Settings

Default mark for completion items is [DB]. To change it, add this to vimrc:

let g:vim_dadbod_completion_mark = 'MYMARK'

Todo

  • [ ] Integration for column autocompletion with more database types
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].