Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

keep splitting doc window at bottom #168

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions autoload/tern.vim
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,15 @@ endif

function! tern#PreviewInfo(info)
pclose
let s:originalSplitBelow = &splitbelow
set splitbelow
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, this options should be used in plugin.

new +setlocal\ previewwindow|setlocal\ buftype=nofile|setlocal\ noswapfile|setlocal\ wrap
exe "normal z" . &previewheight . "\<cr>"
call append(0, type(a:info)==type("") ? split(a:info, "\n") : a:info)
wincmd p
if (s:originalSplitBelow != 1)
set nosplitbelow
endif
endfunction

function! tern#Complete(findstart, complWord)
Expand Down
6 changes: 5 additions & 1 deletion script/tern.py
Original file line number Diff line number Diff line change
Expand Up @@ -319,7 +319,11 @@ def tern_lookupDocumentation(browse=False):
return result
doc = ((doc and doc + "\n\n") or "") + "See " + url
if doc:
vim.command("call tern#PreviewInfo(" + json.dumps(doc) + ")")
docstr = json.dumps(doc, ensure_ascii=False)
if len(docstr) > 120:
vim.command("call tern#PreviewInfo(" + docstr + ")")
else:
print(docstr)
else:
print("no documentation found")

Expand Down