Comments (9)
I created lightline plugin before NeoVim was forked from Vim, and Lua API became so common. So the design does not look well with the Lua API (I don't use NeoVim and not tested the plugin with the Lua API). Having said that, gitbranch = 'v:lua.gitBranch'
should work, but it needs some patch fixing code not working with v:lua
. I can't include as it is, the question here is how can we check the function existence of v:lua.F
?
diff --git a/autoload/lightline.vim b/autoload/lightline.vim
index e1f09ca..5ca6c20 100644
--- a/autoload/lightline.vim
+++ b/autoload/lightline.vim
@@ -296,7 +296,7 @@ endfunction
function! s:subseparator(components, subseparator, expanded) abort
let [a, c, f, v, u] = [a:components, s:lightline.component, s:lightline.component_function, s:lightline.component_visible_condition, s:lightline.component_function_visible_condition]
let xs = map(range(len(a:components)), 'a:expanded[v:val] ? "1" :
- \ has_key(f, a[v:val]) ? (has_key(u, a[v:val]) ? "(".u[a[v:val]].")" : (exists("*".f[a[v:val]]) ? "" : "exists(\"*".f[a[v:val]]."\")&&").f[a[v:val]]."()!=#\"\"") :
+ \ has_key(f, a[v:val]) ? (has_key(u, a[v:val]) ? "(".u[a[v:val]].")" : f[a[v:val]]."()!=#\"\"") :
\ has_key(v, a[v:val]) ? "(".v[a[v:val]].")" : has_key(c, a[v:val]) ? "1" : "0"')
return '%{' . (xs[0] ==# '1' || xs[0] ==# '(1)' ? '' : xs[0] . '&&(') . join(xs[1:], '||') . (xs[0] ==# '1' || xs[0] ==# '(1)' ? '' : ')') . '?"' . a:subseparator . '":""}'
endfunction
@@ -380,7 +380,7 @@ function! s:expand(components) abort
endfunction
function! s:func(name) abort
- return exists('*' . a:name) ? '%{' . a:name . '()}' : '%{exists("*' . a:name . '")?' . a:name . '():""}'
+ return '%{' . a:name . '()}'
endfunction
function! s:line(tabline, inactive) abort
from lightline.vim.
I don't like to use luaeval
here. I believe we could check function existence in a consistent way, hope anyone asks NeoVim devs if they have thoughts on making exists("*v:lua.F")
works.
from lightline.vim.
Although this issue isn't resolved, I can do nothing to fix in this plugin so closing the issue. I still think the request for NeoVim neovim/neovim#24587 (comment) is reasonable. Please help them by writing a NeoVim patch to make Vim script plugins work well on NeoVim.
from lightline.vim.
@jonhoo @pauldesmondparker @glepnir NeoVim v0.9.5 does not work with exists("*v:lua.F")
. Existence check for user-defined functions should be prefixed by *
.
from lightline.vim.
hmm i dont know why it through invaid expression. i don't check lightline code :P should return 0 when it start with *v:lua
..for viml user custom function it start with *
for lua i just use v:lua
directly...let me think about it.
from lightline.vim.
Thank you, worked like a charm. Not sustainable, but at least it was nice to see it work directly.
Any chance of using this, to check for the Lua function:
function! IsLuaFunction(name) abort
return luaeval(a:name)->type() == v:t_func
endfunction
from lightline.vim.
@itchyny neovim/neovim#26485 has landed and makes exists
able to check for v:lua
functions 🎉 I'm hoping that means there's a path to getting v:lua.F
to work? Currently it yields:
E15: Invalid expression: v:lua
from lightline.vim.
This check should check "*v:lua."
right? The patch implements in the different way than proposed by the original issue.
from lightline.vim.
Yes. Opportunistic but breaks compatibility T.T working on it
from lightline.vim.
Related Issues (20)
- [Feature request] Formal arguments in component_function HOT 5
- Powerline transparent colorscheme
- bug : Undefined variable: g:lightline HOT 2
- Calling 'vim.diagnostic.goto_next()' inactivates lightline HOT 7
- Update tabline color on mode change HOT 3
- Lineinfo column doesn't match cursor column position HOT 2
- incorrect branch name on Gsplit HOT 4
- `component_function` does not accept vim9 function HOT 1
- Custom colorscheme mode HOT 5
- `laststatus=2` doesn't seem to be working HOT 1
- extra spaces from lightline-problem-12 HOT 1
- All Highlighted/Selected Character Count? HOT 6
- middle active/inactive items missing from statusline HOT 7
- Using `vim.lsp.buf.hover()` breaks lightline. HOT 8
- How to use Catppuccin theme on lightline?
- Returning a statusline item from a component function HOT 2
- theme support for grubbox HOT 2
- How do I ignore certain filetypes? HOT 2
- Changing the color of modified file symbol HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from lightline.vim.