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

[RFC] Replace UI #624

Merged
merged 144 commits into from
Jun 1, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
144 commits
Select commit Hold shift + click to select a range
0c91ad5
Add _main.py
Shougo Mar 28, 2019
42b3826
Improve child call
Shougo Mar 29, 2019
d703b20
Remove is_async() RPC
Shougo Mar 29, 2019
05f68fb
WIP: add _main.py
Shougo Mar 31, 2019
490675c
Fix for merge
Shougo Apr 23, 2019
eaf2677
Fix lint
Shougo Apr 23, 2019
4e1accb
WIP: remove prompt
Shougo May 1, 2019
36c6038
Remove unused code
Shougo May 1, 2019
04b6f5b
Remove suspend
Shougo May 1, 2019
0fe8f63
Change rpcrequest
Shougo May 1, 2019
a5fb65e
Add map
Shougo May 1, 2019
14cb960
Improve mapping implementation
Shougo May 1, 2019
ef1faef
Update the documentation
Shougo May 1, 2019
e06ea3f
Version up
Shougo May 1, 2019
1747b49
Change statusline behavior
Shougo May 1, 2019
cbe1a22
Improve do_action behavior
Shougo May 1, 2019
8451117
Remove cursor
Shougo May 1, 2019
ea679bd
Update examples
Shougo May 1, 2019
651db9f
Remove mode
Shougo May 1, 2019
c8b804a
Remove unused option
Shougo May 1, 2019
ca09c29
Remove prompt.nvim
Shougo May 1, 2019
62ef230
Fix map.py
Shougo May 1, 2019
d6b3b5f
Remove prompt.py
Shougo May 1, 2019
7e160ef
Fix problems
Shougo May 1, 2019
43fc9cf
Fix cursor problems
Shougo May 1, 2019
d07ba80
Add open_filter_buffer
Shougo May 1, 2019
22ff295
Fix resume behavior
Shougo May 1, 2019
478dd11
Add -start-filter option
Shougo May 1, 2019
47fa1fb
Remove cursor_shape
Shougo May 1, 2019
98e7930
Improve timer
Shougo May 1, 2019
8b134b3
Improve filter behavior
Shougo May 1, 2019
27502b2
Fix <Plug>(denite_filter_quit)
Shougo May 1, 2019
104c6eb
stop timer
Shougo May 1, 2019
f1661a8
Fix cursor_pos
Shougo May 2, 2019
b4e0fde
Improve filter
Shougo May 2, 2019
610130d
Fix quick-move behavior
Shougo May 2, 2019
36adaa7
Asynchronous WIP
Shougo May 2, 2019
196fb51
Improve filter behavior
Shougo May 2, 2019
62f703d
Use timer to update
Shougo May 2, 2019
aa31820
Fix quick_move
Shougo May 2, 2019
af5284c
Fix
Shougo May 2, 2019
279df88
Restore cursor position
Shougo May 2, 2019
bee6dea
WIP
Shougo May 6, 2019
9632455
Add Vim8 support
Shougo May 6, 2019
a086ffe
Add deoplete source
Shougo May 6, 2019
2f81b2c
Fix async RPC error
Shougo May 6, 2019
00c18be
Add -bar in commands
Shougo May 6, 2019
3986c1c
Update the documentation
Shougo May 6, 2019
d8ce7af
Remove redrawstatus
Shougo May 6, 2019
c6d5ba3
Fix menu error
Shougo May 7, 2019
6868323
Use chdir() if possible
Shougo May 7, 2019
4dab5b4
Improve performance
Shougo May 8, 2019
dd6b4e8
Fix do_async_map() error in Vim8
Shougo May 8, 2019
65dbbd1
Improve filter behavior
Shougo May 8, 2019
b10bf10
Remove old Screenshots
Shougo May 10, 2019
c55feda
Remove deprecated options
Shougo May 10, 2019
266942a
More centered floating window
Shougo May 11, 2019
ad3bc35
Fix update timer error
Shougo May 11, 2019
8498307
Add error check
Shougo May 11, 2019
b18a96a
Fix cleanup
Shougo May 11, 2019
ebe1658
Fix immediately behavior
Shougo May 11, 2019
3b85afc
Fix titlestring
Shougo May 11, 2019
c00f8cf
Remove deprecated sources
Shougo May 11, 2019
7bfca97
Fix -cursor-pos problems
Shougo May 11, 2019
ec7a22b
Fix -cursor-pos
Shougo May 11, 2019
b7b4923
Add -filter-split-direction and floating filter window support
Shougo May 11, 2019
fa6d529
Fix vint error
Shougo May 11, 2019
4ee2834
Fix #632 add -max-dynamic-update-candidates
Shougo May 11, 2019
69fc365
Refactor implementation
Shougo May 11, 2019
8b97f28
Fix do_map() error
Shougo May 11, 2019
f19e5a0
Fix auto_action behavior
Shougo May 11, 2019
14a9cfe
Clear input when restart
Shougo May 11, 2019
2d31d13
Fix start sources bug
Shougo May 11, 2019
5ffae20
Fix flake8 error
Shougo May 11, 2019
c26ace8
Fix test warning
Shougo May 12, 2019
538dc14
Fix winwidth error
Shougo May 12, 2019
29c5e29
Fix toggle_select_candidate map
Shougo May 12, 2019
81b0d9c
Quit filter buffer when closing
Shougo May 12, 2019
7bc8c41
Improve filter buffer behavior
Shougo May 12, 2019
150d9d7
Fix do_action() error
Shougo May 12, 2019
057fa21
Change filter window position
Shougo May 12, 2019
6d20232
Improve filter window
Shougo May 12, 2019
3f983b4
Fix lint error
Shougo May 12, 2019
6faf903
Fix filter autocmd
Shougo May 13, 2019
bd3a024
Fix gap
Shougo May 13, 2019
46ba122
max_source_name_len
Shougo May 13, 2019
5568bdf
Set NormalFloat
Shougo May 13, 2019
4d4cc94
Filter API
Shougo May 13, 2019
2d59445
Add denite#do_map() support in denite-filter
Shougo May 13, 2019
371b6a0
Remove gap in filter buffer
Shougo May 13, 2019
6933664
Fix lint error
Shougo May 13, 2019
d2b0f63
Fix do_async_map() error
Shougo May 13, 2019
6fe71d9
Remove WinLeave autocmd
Shougo May 14, 2019
5e58d84
Remove jump debug print
Shougo May 14, 2019
e01d6dd
Use noautocmd for filtering
Shougo May 14, 2019
1cba1f6
Add the comment
Shougo May 14, 2019
5209fbc
Fix denite buffer check
Shougo May 14, 2019
cf5dcbf
Fix restore_sources
Shougo May 15, 2019
ff50f8f
Fix concealcursor
Shougo May 15, 2019
01a038c
Fix flake8 error
Shougo May 15, 2019
0d37b19
Fix choose_action() behavior
Shougo May 15, 2019
ece53f5
Update FAQ
Shougo May 15, 2019
32b4c16
Add is_async in filter update
Shougo May 19, 2019
7707aa1
Fix filter window quit problem
Shougo May 19, 2019
3c7f0e1
Add denite#call_map() documentation
Shougo May 19, 2019
616f80d
Remove old options
Shougo May 19, 2019
ec5baf7
Add highlight_filter_background
Shougo May 20, 2019
84b00b6
Fix the documentation
Shougo May 20, 2019
36747d8
Remove NormalFloat overwrites
Shougo May 20, 2019
70496e8
Add -prompt
Shougo May 20, 2019
0383c55
Improve prompt
Shougo May 20, 2019
1f3cc5b
Fix filter default mappings behavior
Shougo May 20, 2019
b0edaa9
Improve statusline behavior
Shougo May 21, 2019
339b5c2
Fix filter map behavior
Shougo May 21, 2019
95c6d65
silent edit denite-filter buffer
Shougo May 21, 2019
ec9ecad
Fix prompt
Shougo May 21, 2019
30259a4
Fix mode problem in denite#do_map()
Shougo May 21, 2019
7e4e7f6
silent filter window
Shougo May 21, 2019
28a61e9
Add filter-updatetime
Shougo May 22, 2019
52fc1b0
Fix post_action
Shougo May 22, 2019
3b5f95c
Add denite#get_status() support in denite filter
Shougo May 22, 2019
d593dff
Fix helptags
Shougo May 22, 2019
bb4df16
Fix choose_action
Shougo May 22, 2019
b3127a6
Fix auto_action problem
Shougo May 22, 2019
3ad18c8
Fix init cursor problem when auto_resize
Shougo May 26, 2019
3e82216
Add change sources support in custom action
Shougo May 26, 2019
9ca7513
Add updated_buffer, update_candidates
Shougo May 26, 2019
c164b54
Add async_filter
Shougo May 26, 2019
901bbe7
Add is_volatile
Shougo May 26, 2019
627fca3
Add -cached-filter option
Shougo May 26, 2019
f182a54
Fix update_buffer
Shougo May 26, 2019
dc81a2f
Remove candidates_len
Shougo May 27, 2019
d1d9780
Change filter_updatetime default value
Shougo May 27, 2019
152537d
Update README
Shougo May 27, 2019
4833bf2
Fix restore_sources
Shougo May 27, 2019
fb326a9
Fix update_candidates behavior
Shougo May 27, 2019
cbe15fc
Remove -cached-filter
Shougo May 28, 2019
1c939a3
Fix filtering freeze
Shougo May 28, 2019
91ee11c
Change updatetime
Shougo May 29, 2019
058827f
Silent buffer update
Shougo May 29, 2019
5375cb6
Update for travis
Shougo May 30, 2019
314f1d2
Fix update_buffer() error
Shougo May 30, 2019
4c869fc
Use sign APIs instead
Shougo May 31, 2019
4573296
Add new UI screenshot
Shougo Jun 1, 2019
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
4 changes: 2 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
sudo: false
dist: trusty
dist: xenial

language: python

python:
- 3.6
- 3.7

install:
- eval "$(curl -Ss https://raw.githubusercontent.com/neovim/bot-ci/master/scripts/travis-setup.sh) nightly-x64"
Expand Down
6 changes: 1 addition & 5 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,7 @@ export THEMIS_HOME := ./vim-themis


install: vim-themis
pip install pynvim --upgrade
pip install pytest --upgrade
pip install flake8 --upgrade
pip install mypy --upgrade
pip install vim-vint --upgrade
pip install --upgrade -r test/requirements.txt

lint:
vint --version
Expand Down
30 changes: 26 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@ denite.nvim

[![Build Status](https://travis-ci.org/Shougo/denite.nvim.svg?branch=master)](https://travis-ci.org/Shougo/denite.nvim)

Note: Denite.nvim does not define any of default mappings. You need to define
them.


## About

Expand Down Expand Up @@ -88,9 +91,28 @@ You must install "pynvim" module with pip
**Note:** You need to do 1. and 2. with the common-arch files (x86 or x64).


## Examples

```vim
" Define mappings
autocmd FileType denite call s:denite_my_settings()
function! s:denite_my_settings() abort
nnoremap <silent><buffer><expr> <CR>
\ denite#do_map('do_action')
nnoremap <silent><buffer><expr> d
\ denite#do_map('do_action', 'delete')
nnoremap <silent><buffer><expr> p
\ denite#do_map('do_action', 'preview')
nnoremap <silent><buffer><expr> q
\ denite#do_map('quit')
nnoremap <silent><buffer><expr> i
\ denite#do_map('open_filter_buffer')
nnoremap <silent><buffer><expr> <Space>
\ denite#do_map('toggle_select').'j'
endfunction
```


## Screenshots

![file/rec source](https://user-images.githubusercontent.com/13142418/34324674-b8ddd5b8-e840-11e7-9b77-d94e1b084bda.gif)
![SpaceVim Guide](https://user-images.githubusercontent.com/13142418/34324752-e5a89900-e842-11e7-9f87-6d8789ba3871.gif)
![colorscheme source](https://user-images.githubusercontent.com/13142418/34324786-f4dd39a2-e843-11e7-97ef-7a48ee04d27b.gif)
![floating window](https://user-images.githubusercontent.com/1239245/54329573-8b047380-4655-11e9-8b9a-ab4a91f4768f.gif)
![denite new UI](https://user-images.githubusercontent.com/1239245/58742567-a155ea80-8460-11e9-9925-09082def2c80.gif)
58 changes: 44 additions & 14 deletions autoload/denite.vim
Original file line number Diff line number Diff line change
Expand Up @@ -22,18 +22,6 @@ function! denite#get_status(name) abort
return !exists('b:denite_statusline') ? '' :
\ get(b:denite_statusline, a:name, '')
endfunction
function! denite#get_status_mode() abort
return denite#get_status('mode')
endfunction
function! denite#get_status_sources() abort
return denite#get_status('sources')
endfunction
function! denite#get_status_path() abort
return denite#get_status('path')
endfunction
function! denite#get_status_linenr() abort
return denite#get_status('linenr')
endfunction

function! s:start(sources, user_context) abort
if denite#initialize()
Expand All @@ -46,10 +34,52 @@ function! s:start(sources, user_context) abort
call setpos('.', pos)

let args = [a:sources, a:user_context]
return denite#util#rpcrequest('_denite_start', args)
return denite#util#rpcrequest('_denite_start', args, v:false)
endfunction

function! denite#do_action(context, action_name, targets) abort
let args = [a:context, a:action_name, a:targets]
return denite#util#rpcrequest('_denite_do_action', args)
return denite#util#rpcrequest('_denite_do_action', args, v:false)
endfunction

function! denite#do_map(name, ...) abort
let args = denite#util#convert2list(get(a:000, 0, []))
let esc = (mode() ==# 'i' ? "\<C-o>" : '')
return printf(esc . ":\<C-u>call denite#_call_map(%s, %s, %s)\<CR>",
\ string(a:name), 'v:false', string(args))
endfunction
function! denite#_call_map(name, is_async, args) abort
let is_filter = &l:filetype ==# 'denite-filter'

if is_filter
call denite#filter#_move_to_parent(a:is_async)
endif

if &l:filetype !=# 'denite'
return
endif

let args = denite#util#convert2list(a:args)

call denite#util#rpcrequest(
\ (a:is_async ? '_denite_do_async_map' : '_denite_do_map'),
\ [bufnr('%'), a:name, args], a:is_async)

if is_filter
let denite_statusline = get(b:, 'denite_statusline', {})

call win_gotoid(g:denite#_filter_winid)

if &l:filetype ==# 'denite-filter'
let b:denite_statusline = denite_statusline
else
stopinsert
endif
endif
endfunction
function! denite#call_map(name, ...) abort
call denite#_call_map(a:name, v:false, get(a:000, 0, []))
endfunction
function! denite#call_async_map(name, ...) abort
call denite#_call_map(a:name, v:true, get(a:000, 0, []))
endfunction
62 changes: 62 additions & 0 deletions autoload/denite/_main.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
# ============================================================================
# FILE: _main.py
# AUTHOR: Shougo Matsushita <Shougo.Matsu at gmail.com>
# License: MIT license
# ============================================================================

import sys
import io

from importlib.util import find_spec
if find_spec('pynvim'):
from pynvim import attach
else:
from neovim import attach


def attach_vim(serveraddr):
if len(serveraddr.split(':')) == 2:
serveraddr, port = serveraddr.split(':')
port = int(port)
vim = attach('tcp', address=serveraddr, port=port)
else:
vim = attach('socket', path=serveraddr)

# sync path
for path in vim.call(
'globpath', vim.options['runtimepath'],
'rplugin/python3', 1).split('\n'):
sys.path.append(path)
# Remove current path
del sys.path[0]

return vim


class RedirectStream(io.IOBase):
def __init__(self, handler):
self.handler = handler

def write(self, line):
self.handler(line)

def writelines(self, lines):
self.handler('\n'.join(lines))


def main(serveraddr):
vim = attach_vim(serveraddr)
from denite.child import Child
from denite.util import error_tb
stdout = sys.stdout
sys.stdout = RedirectStream(lambda data: vim.out_write(data))
sys.stderr = RedirectStream(lambda data: vim.err_write(data))
try:
child = Child(vim)
child.main_loop(stdout)
except Exception as exc:
error_tb(vim, 'Error in child: %r' % exc)


if __name__ == '__main__':
main(sys.argv[1])
5 changes: 4 additions & 1 deletion autoload/denite/custom.vim
Original file line number Diff line number Diff line change
Expand Up @@ -118,11 +118,14 @@ endfunction
function! denite#custom#_call_action(kind, name, context) abort
let custom = denite#custom#_get().action

let new_context = {}
for key in denite#util#split(a:kind)
if has_key(custom, key) && has_key(custom[key], a:name)
call call(custom[key][a:name][0], [a:context])
let new_context = call(custom[key][a:name][0], [a:context])
endif
endfor

return new_context
endfunction

function! s:set_custom(dest, name_or_dict, value) abort
Expand Down
Loading