fvim icon indicating copy to clipboard operation
fvim copied to clipboard

how to make --wsl launch lunarvim and not just plain nvim

Open jmlucjav opened this issue 2 years ago • 9 comments

Hi

I want to use fvim as the gui for nvim on wsl. I see I can start fvim like this

fvim --wsl

and it works fine, but I use lunarvim as my preferred setup. As is, fvim is starting nvim without lvim's configuration.

FYI, lvim is just launching this:

export LUNARVIM_CONFIG_DIR="${LUNARVIM_CONFIG_DIR:-/home/jm/.config/lvim}"
export LUNARVIM_RUNTIME_DIR="${LUNARVIM_RUNTIME_DIR:-/home/jm/.local/share/lunarvim}"

exec nvim -u "$LUNARVIM_RUNTIME_DIR/lvim/init.lua" "$@"

Is there a way to make fvim start lvim in wsl instead of plain nvim?

I think I can achieve something similar like this:

SET NVIMSOCKET=66555
start /b cmd /c wsl lvim --listen "127.0.0.1:%NVIMSOCKET%" --headless
start C:\tools\fvim\fvim.exe --nvr 127.0.0.1:%NVIMSOCKET%

but I prefer to double check here if there is a better/cleaner way.

Thanks for this project!!

jmlucjav avatar Apr 03 '22 17:04 jmlucjav

I would love to say:

fvim --wsl --nvim lvim

... but: https://github.com/yatli/fvim/blob/c43c0c651038637a889990b7a147bcb542474a11/getopt.fs#L142

The nvim argument is ignored for wsl.

yatli avatar Apr 03 '22 18:04 yatli

I don't have access to my local git repo at the moment, can you please try:

- "wsl", ["bash"; "-l"; "-c"; $"nvim --embed {args |> escapeArgs |> join}"], true 
+ "wsl", ["bash"; "-l"; "-c"; $"{nvim} --embed {args |> escapeArgs |> join}"], true 

yatli avatar Apr 03 '22 18:04 yatli

mmm, I was testing the binary release, I don't have whatever is needed for compiling...(not a .net guy). If you can add that change, I'll test the next release

jmlucjav avatar Apr 03 '22 20:04 jmlucjav

Sure. Will ping you when it's done. My local RAID0 blew up and I'm too distracted at the moment.

yatli avatar Apr 03 '22 21:04 yatli

Sure, I will keep an eye on this. Good luck if your hardware mishap!

jmlucjav avatar Apr 04 '22 09:04 jmlucjav

I'm also interested in this change.

brneor avatar Jun 29 '22 20:06 brneor

Hi! I found a little workaround for starting Lunarvim with fvim:

  • add the environment variables for Lunarvim to your ~/.bashrc:

export LUNARVIM_RUNTIME_DIR="${LUNARVIM_RUNTIME_DIR:-"/home/user/.local/share/lunarvim"}" export LUNARVIM_CONFIG_DIR="${LUNARVIM_CONFIG_DIR:-"/home/user/.config/lvim"}" export LUNARVIM_CACHE_DIR="${LUNARVIM_CACHE_DIR:-"/home/user/.cache/lvim"}"

  • then start Fvim with the following command line: .\FVim.exe --wsl -u /home/user/.local/share/lunarvim/lvim/init.lua
  • in config.lua you can then add the configuration for fvim:

if vim.g.fvim_loaded then vim.cmd [[set guifont=FiraCode\ Nerd\ Font:h14]] vim.cmd [[FVimCursorSmoothMove v:true]] vim.cmd [[FVimCursorSmoothBlink v:true]] vim.cmd [[FVimCustomTitleBar v:true ]] vim.cmd [[FVimFontAutoSnap v:true]] vim.cmd [[FVimUIPopupMenu v:true]] vim.cmd [[FVimUIWildMenu v:true]] -- Ctrl-ScrollWheel for zooming in/out -- nnoremap <C-ScrollWheelUp> :set guifont=+<CR> -- nnoremap <C-ScrollWheelDown> :set guifont=-<CR> -- nnoremap <A-CR> :FVimToggleFullScreen<CR> end

Drawback is, that Telescope based menus aren't working at all. Therefore, Lunarvim still isn't usable with Fvim, but this might be the next step in the right direction.

edit:

Drawback is, that Telescope based menus aren't working at all.

That is not correct! The dashboard menus are not working! If you call telescope directly with e.g. :Telescope projects, then all works as expected!

edit 2: :Telescope projects does not work within the dashboard! You must have a source file open in the editor! Therefore you can open config.lua with "Configuration" and then everything is working as expected.

indika-dev avatar Sep 29 '22 06:09 indika-dev

I also would like to start fvim with a different „nvim“ in wsl. My backstory is a little different. I'm using fvim on windows and NixOS is my default wsl distribution. wsl nvim doesn't work:

PS C:\Users\to6338> wsl nvim
/run/current-system/sw/bin/bash: line 1: nvim: command not found

But wsl /home/nixos/.nix-profile/bin/nvim works as expected

I'll try your suggested patch and give feedback

mannahusum avatar Sep 26 '23 12:09 mannahusum

I'm overwhelmed with compiling fvim on Windows. It seems I'm unable to find the necessary dependencies:

PS C:\Users\to6338\Documents\fvim> .\add_nuget_source.ps1
Die Paketquelle namens "Avalonia Nightly" wurde erfolgreich entfernt.
Die Paketquelle namens "Avalonia Nightly" wurde erfolgreich hinzugefügt.
PS C:\Users\to6338\Documents\fvim> nuget install -prerelease Avalonia.Native
Feeds used:
  https://www.myget.org/F/avalonia-ci/api/v2

Pakete "Avalonia.Native" bis "C:\Users\to6338\Documents\fvim" werden installiert.
  CACHE https://www.myget.org/F/avalonia-ci/api/v2/FindPackagesById()?id='Avalonia.Native'&semVerLevel=2.0.0


Attempting to gather dependency information for package 'Avalonia.Native.0.10.999' with respect to project 'C:\Users\to6338\Documents\fvim', targeting 'Any,Version=v0.0'
Gathering dependency information took 57 ms
Attempting to resolve dependencies for package 'Avalonia.Native.0.10.999' with DependencyBehavior 'Lowest'
Unable to find a version of 'Avalonia' that is compatible with 'Avalonia.Native 0.10.999 constraint: Avalonia (>= 0.10.999)'.
PS C:\Users\to6338\Documents\fvim>

mannahusum avatar Sep 26 '23 13:09 mannahusum