nvimdev / dashboard-nvim

vim dashboard
MIT License
2.39k stars 193 forks source link

share your custom dashbaord #7

Closed glepnir closed 1 year ago

glepnir commented 4 years ago

You can share your custom dashboard in here. i will add it to wiki demo page. Thanks.

p00f commented 4 years ago

How about this: https://gist.github.com/shaggyrogers/2c928108d1fa87ab4462fad9be99ebec

p00f commented 4 years ago

It looks complete, the github file display might be misleading: image (Those vertical lines are because of indent guides, not a problem)

glepnir commented 4 years ago

seems like good.

ghost commented 4 years ago

image Still working in progress and maybe I will change but I will post because I like it. I tried to find a way to show loading time like doom emacs reading startuptime.vim code but it needs vimscript knowledge and I can't.

glepnir commented 4 years ago

Hey @btwiusegentoo neovim does not intend to add time calculations at startup. So this is impossible. I have communicated with them. Unless you call the ·startuptime· command asynchronously to read the output file and return the time. However, this will affect the startup speed. So I am not going to do this. You can add other things of interest to the footer.

ghost commented 4 years ago

Hey @btwiusegentoo neovim does not intend to add time calculations at startup. So this is impossible. I have communicated with them. Unless you call the ·startuptime· command asynchronously to read the output file and return the time. However, this will affect the startup speed. So I am not going to do this. You can add other things of interest to the footer.

Thanks for the explanation! If it affects startup speed, I think it's not worth.

66RING commented 4 years ago

cool, how do you guys generate the dashbaord picture?

ghost commented 4 years ago

cool, how do you guys generate the dashbaord picture?

I personally don't have any knowledge about design so I use this site to convert from picture. https://asciiart.club/

p00f commented 4 years ago

neofetch supports showing an actual image (not asciiart), can you look into this for dashboard-nvim? https://github.com/dylanaraps/neofetch

glepnir commented 4 years ago

I have been concerned about whether I can display pictures in vim for a long time. You can use uberzug in neovim to show that , But they are all based on terminal escape. Uberzug can only work on Linux, it is not universal on all platforms. Secondly, we can only get the picture display in the terminal buffer, and the picture cannot be escaped in the ordinary buffer. The dashboard builds an ordinary buffer. So I don't know if there is any way to display the correct sequence of pictures in the normal buffer. If you see any related implementation please let me know. I am happy to implement it

ghost commented 4 years ago

FWIW, I think sixel will be the future for terminal image display and there are plugin that uses it. https://github.com/mattn/vim-nyancat but I don't know other plugins that display image. the problem is sixel is still not supported by most terminals. Seems like ueberzug is the best solution for Linux that supports many terminals now but supporting macOS may be complicated because needs to support kitty or iterm2?

glepnir commented 4 years ago

sixel need terminal to support. Seems like kitty iterm2 alacritty doesn't support it. The imagcat works well in macos.But the neovim terminal cannot escape imagcat correctly. So unable to work together

p00f commented 4 years ago

also what if the client is a gui instead of a terminal?

glepnir commented 4 years ago

Like emacs the client need build with imagemagick.

glepnir commented 4 years ago

For this feature, it is actually not important. Because we write code in vim most of the time....

ghost commented 4 years ago

Just FWIW, about escape sequence. I don't think it's actually usable. but if someone want to give a try screen_2020-08-13-04-47-07 screen_2020-08-13-06-09-05

I was messing my init.vim today and I found a very hacky way to display image lol using floating window. ofcourse there are many problems. Maybe it's possible to use to display image using kitty or ueberzug idk I'm noob prerequisites: text file generated using chafa or something. chafa --size=120x25 neovim-logo-shadow.png >> ascii.txt define function

" Show image in dashboard using ansi escape sequences
function! DashboardImage()
    let s:width = 120
    let s:height = 17
    let s:row = float2nr(s:height / 5)
    let s:col = float2nr((&columns - s:width) / 2)
    let s:opts = {
                \ 'relative': 'editor',
                \ 'row': s:row,
                \ 'col': s:col,
                \ 'width': s:width,
                \ 'height': s:height,
                \ 'style': 'minimal'
                \ }
    let s:buf = nvim_create_buf(v:false, v:true)
    let s:win = nvim_open_win(s:buf, v:true, s:opts)
    hi! DashboardImage guibg=NONE guifg=NONE
    call nvim_win_set_option(s:win, "winblend", 0)
    call nvim_win_set_option(s:win, "winhl", "Normal:DashboardImage")
    terminal cat ~/Downloads/ascii.txt
    :exe "normal \<C-W>\<C-w>"
endfunction

and call when dashboard opened

" show image in dashboard
autocmd Filetype dashboard call DashboardImage()

problems

glepnir commented 4 years ago

Wow. It looks like good. But It seems that the frame loss is a bit serious for complex pictures

glepnir commented 4 years ago

you can call nvim_close_win(winid,v:true) and bind it to autocmd buffer leave to close it when leave dashboard.

ghost commented 4 years ago

Thanks! my 1st picture was rough because I have line height set in alacritty. 2nd is default xterm. still have frame loss but... I think it is acceptable for logo imo. I will prefer than ascii art. I tried using catimg instead of cat now and it works. and, thanks for letting me know how to use nvim_close_win. channging from WinLeave to BufLeave makes vim-which-key and FZF work. still there are errors when opening files

Error detected while processing function 10[30]..<SNR>49_callback:
line   21:
Vim(normal):Can't re-enter normal mode from terminal mode

I will try to see what I can do to fix. I hope it's possible to make this usable

ghost commented 4 years ago

Ok, I found a way that works fine for me.

" show image in dashboard
autocmd user DashboardReady call DashboardImage() | autocmd BufLeave <buffer> call CloseDashboardImage()
function! CloseDashboardImage()
    "let bufnr = bufnr('%')
    "execute bufnr . 'bdelete!'
    execute "bdelete! 2"
    "call nvim_win_close(DashboardImage(), v:true)
endfunction

(please ignore comments. it's what I tested to run simultaneously.) closing buffer instead of closing window works. I don't know if transparent window remains and I even don't know how to check but it works for me. Now, image window goes away when I open file from FZF, open terminal, open coc-explorer. that's what I confirmed. I get the error above if I close window.

Edit: Now experimenting with ueberzug. it works but it overlaps with other float windows like FZF because it's not using escape sequence and it's just showing picture above terminal. screen_2020-08-15-11-10-49 Edit2: I will give up to try ueberzug. FZF becomes totally unusable when ueberzug is showing image above. And I can't imagine a way to detect FZF/other floating windows including denite,which-key and kill ueberzug now. I will not sacrifice usability for appearance.

p00f commented 4 years ago

@btwiusegentoo can you tell me what you did to get ueberzug working? Thanks

ghost commented 4 years ago

@btwiusegentoo can you tell me what you did to get ueberzug working? Thanks

Hi! First, I had a script to launch ueberzug that home.nix above generates. I don't have code anymore but it's what I have in that screenshot selected in visual mode. uses variable that I set inside init.vim. And I called floating terminal like before, but set variable and run the script above. like nvim.vim from the screenshot. I set the variable imgwidth,imgheight first. set manually. it was something like 200 and 15 for me but I don't remember and it's not in the screenshot. and set $dashboardwidth,$dashboardheight to img{width,height}. I did this to set same size for floating window and ueberzug image. Now I think this is don't needed because ueberzug can draw outside floating window. so maybe window size can be something different and probably floating terminal is not needed? and I have $dashboardimg to specify image path(must have full path. ~/don't work), and the paddings. seems like $dashboardx = (&columns / 2) - (&imgwidth / 2) is good enough to centralize horizontally. idk math but this worked for me. $dashboardy = 0 was fine for me. finally launch the script with all variablesterminal ~/scripts/nvimimg.sh and unfocus from floating terminal exe "normal \<C-W>\<C-w>

glepnir commented 4 years ago

I had a easy scripts https://github.com/hardcoreplayers/dashboard-nvim/pull/15 . But many details need to be adjusted. So I will add full support when I have time. It only works on linux .

p00f commented 4 years ago

This will only work in terminal nvim right?

I had a easy scripts #15 . But many details need to be adjusted. So I will add full support when I have time. It only works on linux .

glepnir commented 4 years ago

If the gui vim support has a built-in terminal. It can be support.

Th3Whit3Wolf commented 4 years ago

Super Saiyan

dark light

p00f commented 4 years ago

How do I set the dashboard to the output of a command ? For example I would like header to be the output of cat sunjon.cat (see here this is really cool!) and the footer to be the output of fortune | lolcat

glepnir commented 4 years ago

@p00f I got it work like this image

p00f commented 4 years ago

Oh so that works. What about fortune | lolcat? (Lolcat turns the output RGB-rainbow)

glepnir commented 4 years ago

If it works fine in neovim built-in terminal, that will be work.

p00f commented 4 years ago

No I mean how do I do it? let g: dashboard_custom_header="???"

glepnir commented 4 years ago

@p00f I have not submitted pr,Please wait. About this cat file. tha author doesnot allow other to use .So you need build your own cat file ..

sunjon on Freenode that's my logo
sunjon on Freenode please don't use it yet, I'm saving it for my own project.
sunjon on Freenode rather, feel free to use it for your personal stuff
p00f commented 4 years ago

Ye I'll use it in my personal stuff, no need to include this

glepnir commented 4 years ago

I will create pr tomorrow

p00f commented 4 years ago

How do I do the fortune lolcat one tho

p00f commented 4 years ago

I tried

let foo = system('fortune | lolcat')
let g:dashboard_custom_footer = [foo]

But i get image even though it works in :terminal - image

ghost commented 3 years ago

I think it may have to do with your colorscheme taking over the output colors. I don't know though I might be wrong

p00f commented 3 years ago

@glepnir how did you get sunjon's neovim text to work? (just for my personal config)

glepnir commented 3 years ago

Please check readme . I had add option to do that image

glepnir commented 3 years ago

1

p00f commented 3 years ago

how did you lolcat it? i get a black background

p00f commented 3 years ago

Grimshot 2020-12-13 00-22-07


let g:dashboard_preview_command="cat"
let g:dashboard_preview_file="~/.config/environment.d/sway.conf"
let g:dashboard_preview_pipeline="lolcat"
let g:dashboard_preview_file_width=70
let g:dashboard_preview_file_height=10
glepnir commented 3 years ago

don't know why you got black background does it work fine with this command cat youfile | lolcat ?

p00f commented 3 years ago

that makes it blank (no header at all)

glepnir commented 3 years ago

don't know what happen. dashboard just call :terminal cat your file | lolcat in neovim. you can confirm by this command.

p00f commented 3 years ago

that works, but dashboard doesnt

glepnir commented 3 years ago

hmm can you send your test file here?

p00f commented 3 years ago

Grimshot 2020-12-13 11-48-42

glepnir commented 3 years ago

works fine for me image

AndiDomi commented 3 years ago

Here is mine: image Does anyone know how can I add colors to the header btw?