juliosueiras / vim-terraform-completion

A (Neo)Vim Autocompletion and linter for Terraform, a HashiCorp tool
MIT License
337 stars 24 forks source link

Omni completion (^O^N^P) Pattern not found #27

Closed rnanj closed 6 years ago

rnanj commented 7 years ago

I am new to NeoVim, installed the deps using vim-plug, when I try to autocomplet for terraform I get "Omni completion (^O^N^P) Pattern not found". Not sure what am I missing.

juliosueiras commented 7 years ago

Can you submit a screenshot?

rnanj commented 7 years ago

vim

juliosueiras commented 7 years ago

try typing resource " and try autocomplete again

rnanj commented 7 years ago

vim

proever commented 7 years ago

I'm getting the same issue. copy of my init.vim:

set nocompatible              " be iMproved, required
filetype off                  " required

set clipboard=unnamedplus

" set the runtime path to include Vundle and initialize
set rtp+=~/.config/nvim/bundle/Vundle.vim

call vundle#begin()

" alternatively, pass a path where Vundle should install plugins
call vundle#begin('~/.config/nvim/bundle')

" let Vundle manage Vundle, required
Plugin 'VundleVim/Vundle.vim'

Plugin 'tpope/vim-unimpaired'
Plugin 'tpope/vim-obsession'

Plugin 'tpope/vim-fugitive'
Plugin 'tpope/vim-rhubarb'
Plugin 'airblade/vim-gitgutter'

Plugin 'vim-airline/vim-airline'
Plugin 'vim-airline/vim-airline-themes'

Plugin 'tmux-plugins/vim-tmux'
Plugin 'edkolev/tmuxline.vim'
Plugin 'christoomey/vim-tmux-navigator'

Plugin 'tpope/vim-sensible'

Plugin 'tpope/vim-surround'
Plugin 'vim-scripts/AutoClose'

Plugin 'Shougo/deoplete.nvim'

Plugin 'vim-syntastic/syntastic'

Plugin 'ternjs/tern_for_vim'
Plugin 'davidhalter/jedi'

Plugin 'carlitux/deoplete-ternjs'
Plugin 'zchee/deoplete-jedi'

Plugin 'Shougo/neco-syntax'
Plugin 'Shougo/neco-vim'

Plugin 'hashivim/vim-terraform'
Plugin 'juliosueiras/vim-terraform-completion'

Plugin 'ervandew/supertab'
" Colors
Plugin 'dracula/vim'

" All of your Plugins must be added before the following line
call vundle#end()            " required

" Use deoplete.
let g:deoplete#enable_at_startup=1

filetype plugin indent on    " required
syntax on
set omnifunc=syntaxcomplete#Complete

colorscheme dracula

let g:tmuxline_preset='powerline'

set showmatch
set ignorecase
set hlsearch
set tabstop=4
set softtabstop=4
set expandtab
set shiftwidth=4
set autoindent
set number
set wildmode=longest,list

set splitbelow
set splitright

set laststatus=2

let g:terraform_fmt_on_save=1
let g:terraform_align=1
let g:terraform_remap_spacebar=1

let g:SuperTabDefaultCompletionType = "<c-n>"

nnoremap <C-J> <C-W><C-J>
nnoremap <C-K> <C-W><C-K>
nnoremap <C-L> <C-W><C-L>
nnoremap <C-H> <C-W><C-H>

map :s5 :source % \| AirlineRefresh \| nohlsearch

" vv to generate new vertical split
nnoremap <silent> vv <C-w>v

set statusline+=%#warningmsg#
set statusline+=%{SyntasticStatuslineFlag()}
set statusline+=%*

let g:syntastic_always_populate_loc_list = 1
let g:syntastic_auto_loc_list = 1
let g:syntastic_check_on_open = 1
let g:syntastic_check_on_wq = 0

I got the same issue when I was using neomake instead of syntastic, btw.

juliosueiras commented 7 years ago

@proever thanks, I will look into it today

kyxap1 commented 7 years ago

I can confirm the issue too. @juliosueiras have you reproduced error?

kyxap1 commented 7 years ago

@juliosueiras

  1. Logs achieved with

    rootless:vim-terraform-completion kyxap$ nvim -u init.vim main.tf -V99log.log

    nvimlogs.zip

  2. My init.vim

filetype off
set runtimepath+=~/.vim/bundle/neobundle.vim/
set nocompatible
filetype plugin on
filetype indent on
set omnifunc=syntaxcomplete#Complete
syntax enable

"temp solution for 'clipboard=autoselect' replacement
vnoremap <LeftRelease> "*ygv

call neobundle#begin(expand('~/.vim/bundle/'))
NeoBundleFetch 'Shougo/neobundle.vim'

NeoBundle 'Shougo/deoplete.nvim'
NeoBundle 'zchee/deoplete-zsh'
NeoBundle 'Shougo/vimproc.vim', {
\ 'build' : {
\     'windows' : 'tools\\update-dll-mingw',
\     'cygwin' : 'make -f make_cygwin.mak',
\     'mac' : 'make',
\     'linux' : 'make',
\     'unix' : 'gmake',
\    },
\ }

NeoBundle 'neomake/neomake'
NeoBundle 'majutsushi/tagbar'

NeoBundle 'vim-syntastic/syntastic'

NeoBundle 'vim-airline/vim-airline'
NeoBundle 'vim-airline/vim-airline-themes'

NeoBundle 'hashivim/vim-terraform'
NeoBundle 'juliosueiras/vim-terraform-completion'

NeoBundle 'tpope/vim-sensible'
NeoBundle 'tpope/vim-surround'
NeoBundle 'ervandew/supertab'

NeoBundle 'Shougo/neco-syntax'
NeoBundle 'Shougo/neco-vim'

NeoBundle 'justinmk/molokai'

NeoBundleCheck
call neobundle#end()

let g:deoplete#enable_at_startup=1

set termguicolors
colorscheme molokai
hi Normal guibg=none

set expandtab
set shell=bash
nnoremap <F2> :set invpaste paste?<CR>
set pastetoggle=<F2>
set wrap
set nowritebackup
set nobackup
set incsearch
:nnoremap <silent> <Space> :nohlsearch<Bar>:echo<CR>
set hlsearch
set ignorecase
set smartcase
set termencoding=utf8
set showcmd
set smartindent
set cindent
set showmatch
set iskeyword=@,48-57,_,192-255
set backspace=indent,eol,start
set title
set nofoldenable
set formatoptions-=ro
set formatoptions=cq
set report=0
set showmode
set nostartofline
set splitbelow
set whichwrap=<,>,h,l,[,]
set wildchar=<TAB>
set wildmenu
set wildmode=list,full
set wrapmargin=1
set scrolljump=5
set scrolloff=5
set novisualbell
set mouse=v
set tabstop=2
set softtabstop=2
set shiftwidth=2
set laststatus=2
" 50M = 50*1024
set maxmem=51200
set maxmemtot=51200

" BINDINGS
nmap :W :w
nmap :Q :q
map <F10>   :q<CR>
imap   <F10>   <Esc>:q<CR>
cmap   <F10>   <Esc><Esc>:q<CR>
map <F7> mzgg=G`z<CR>

"replace on cursor
:nnoremap <Leader>s :%s/\<<C-r><C-w>\>/

"jsonnet
let g:jsonnet_fmt_fail_silently = 0
let g:jsonnet_fmt_options = '-i -n 2'

let g:airline#extensions#tabline#enabled = 1

"vim-airline fuck annoyng blinking
let g:airline#themes#molokai#palette.normal_modified=g:airline#themes#molokai#palette.normal
let g:airline#themes#molokai#palette.insert_modified=g:airline#themes#molokai#palette.insert
let g:airline_section_d='%{SyntaxItem()}'
let g:airline#extensions#default#layout = [
      \ [ 'a', 'b', 'c', 'd' ],
      \ [ 'x', 'y', 'z', 'error', 'warning' ]
\ ]

"syntax debugger for status line
function! SyntaxItem()
  return synIDattr(synID(line("."),col("."),1),"name")
endfunction

"fold state save macro
set viewoptions=cursor,folds,slash,unix
if exists("g:loaded_restore_view")
    finish
endif
let g:loaded_restore_view = 1
if !exists("g:skipview_files")
    let g:skipview_files = []
endif

function! MakeViewCheck()
    if &l:diff | return 0 | endif
    if &buftype != '' | return 0 | endif
    if expand('%') =~ '\[.*\]' | return 0 | endif
    if empty(glob(expand('%:p'))) | return 0 | endif
    if &modifiable == 0 | return 0 | endif
    if len($TEMP) && expand('%:p:h') == $TEMP | return 0 | endif
    if len($TMP) && expand('%:p:h') == $TMP | return 0 | endif
    let file_name = expand('%:p')
    for ifiles in g:skipview_files
        if file_name =~ ifiles
            return 0
        endif
    endfor
    return 1
endfunction

augroup AutoView
    autocmd!
    autocmd BufWritePre,BufWinLeave ?* if MakeViewCheck() | silent! mkview | endif
    autocmd BufWinEnter ?* if MakeViewCheck() | silent! loadview | endif
augroup END

"disable all info macro
"SHIFT-s
let s:hidden_all = 0
function! ToggleHiddenAll()
    if s:hidden_all  == 0
        let s:hidden_all = 1
        set noshowmode
        set noruler
        set laststatus=0
        set noshowcmd
    else
        let s:hidden_all = 0
        set showmode
        set ruler
        set laststatus=2
        set showcmd
    endif
  endfunction

" Syntastic Config
set statusline+=%#warningmsg#
set statusline+=%{SyntasticStatuslineFlag()}
set statusline+=%*

let g:syntastic_always_populate_loc_list = 1
let g:syntastic_auto_loc_list            = 1
let g:syntastic_check_on_open            = 1
let g:syntastic_check_on_wq              = 0

" (Optional)Remove Info(Preview) window
set completeopt-=preview

" (Optional)Hide Info(Preview) window after completions
autocmd CursorMovedI * if pumvisible() == 0|pclose|endif
autocmd InsertLeave  * if pumvisible() == 0|pclose|endif

" (Optional) Enable terraform plan to be include in filter
let g:syntastic_terraform_tffilter_plan = 1

" terraform
let g:terraform_fmt_on_save    = 1
let g:terraform_align          = 1
let g:terraform_remap_spacebar = 0

let g:SuperTabDefaultCompletionType = "<c-n>"

if has("autocmd")
  au BufReadPost * if line("'\"") > 0 && line("'\"") <= line("$") | exe "normal! g`\"" | endif
endif
juliosueiras commented 7 years ago

@kyxap1 thanks, will look into it

juliosueiras commented 7 years ago

@kyxap1 @rnanj does the issue still persist?

davewongillies commented 6 years ago

I have this problem too. I've tried the solution from #30 (install the neovim gem) but it still doesn't work for me.

ravern commented 6 years ago

Same problem here.

juliosueiras commented 6 years ago

Can you include which vim you use and version, and which OS

nicholasjackson commented 6 years ago

@davewongillies do you use deoplete? If so I had to add these two lines to my config

let g:deoplete#omni_patterns = {}
let g:deoplete#omni_patterns.terraform = '[^ *\t"{=$]\w*'
juliosueiras commented 6 years ago

I will close this issue for now, since the build is passing

tchia04 commented 6 years ago

I still have this issue. Getting this when i type resource " -- Omni completion (^O^N^P) Pattern not found

This is my .config/nvim/init.vim let g:deoplete#omni_patterns = {} let g:deoplete#omni_patterns.terraform = '[^ \t"{=$]\w'

pocco81 commented 3 years ago

I also had the same problem SQL, it seems that it was conflicting with coc-sql's keybindings and/or omnicompletion, so what I did was to completely disable omnicompletion just for SQL, since it was isolated to this binding: (from : ~/.vim/plugged/vim-polyglot/ftplugin/sql.vim)

exec 'inoremap <buffer> '.g:ftplugin_sql_omni_key.'k <C-\><C-O>:call sqlcomplete#Map("sqlKeyword'.regex_extra.'")<CR><C-X><C-O>'

I added the following to .init.vim (I use NeoVim btw) and it worked:

let g:omni_sql_no_default_maps = 1

So all I recommend is to disable it for the targeted language: (note: refer to this post for more info: https://stackoverflow.com/questions/24931088/disable-omnicomplete-or-ftplugin-or-something-in-vim)