Skip to content

Commit

Permalink
lua: tree#util#call_tree
Browse files Browse the repository at this point in the history
  • Loading branch information
zgpio committed Aug 5, 2020
1 parent f1df8f9 commit f51a5c9
Show file tree
Hide file tree
Showing 6 changed files with 9 additions and 11 deletions.
5 changes: 0 additions & 5 deletions runtime/autoload/tree/util.vim
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,6 @@ function! tree#util#execute_path(command, path) abort
endtry
endfunction

function! tree#util#call_tree(command, args) abort
let [paths, context] = v:lua.__parse_options(a:args)
call v:lua.start(paths, context)
endfunction

function! tree#util#cd(path) abort
if exists('*chdir')
call chdir(a:path)
Expand Down
6 changes: 5 additions & 1 deletion runtime/lua/tree.lua
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,10 @@ function M.string(expr)
return vim.fn.string(expr)
end
end
function M.call_tree(command, args)
local paths, context = __parse_options(args)
start(paths, context)
end
function M.print_error(s)
api.nvim_command(string.format("echohl Error | echomsg '[tree] %s' | echohl None", M.string(s)))
end
Expand Down Expand Up @@ -246,7 +250,7 @@ function __parse_options(cmdline)
end
end

return {args, options}
return args, options
end
function __expand(path)
if path:find('^~') then
Expand Down
2 changes: 1 addition & 1 deletion runtime/plugin/tree.vim
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,4 @@ let g:loaded_tree = 1

command! -nargs=* -range -bar -complete=customlist,v:lua.complete
\ Tree
\ call tree#util#call_tree('Tree', <q-args>)
\ call luaeval('require("tree").call_tree("Tree", _A)', <q-args>)
2 changes: 1 addition & 1 deletion src/app/dev.vim
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ local tree = require 'tree'
tree.custom_option('_', {root_marker='[in]:', })
tree.custom_column('filename', {
root_marker_highlight='Ignore',
max_width=40,
max_width=60,
})
tree.custom_column('time', {
format="%d-%M-%Y",
Expand Down
4 changes: 2 additions & 2 deletions src/app/transform.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,12 @@
f.write(line)
f.write('};\n')

f.write('array<QByteArray, 2> icons[] = {\n')
f.write('pair<string, string> icons[] = {\n')
for k, v in val.items():
code = v['code']
color = v['color']
print(k, code, color)
line = f' {{ {{"{code}", "{color}"}} }},\n'
line = f' {{"{code}", "{color}"}},\n'
f.write(line)
f.write('};\n')
else:
Expand Down
1 change: 0 additions & 1 deletion src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,6 @@ void eventloop(nvim::Nvim &nvim) {
break;
case 2:
{
Object methodName;
// [type(2), method, params]
msgpack::type::tuple<int64_t, Object, Object> msg;
obj.convert(msg);
Expand Down

0 comments on commit f51a5c9

Please sign in to comment.