Skip to content

Latest commit

 

History

History
140 lines (117 loc) · 8.05 KB

Windows.md

File metadata and controls

140 lines (117 loc) · 8.05 KB

Windows Users

Windows is problematic.

Basic Functionality

Warning

The entire section is a hack, and can break when you update Molten. The file contents below are up to date as of version 1.8.x

This plugin is a remote plugin, and there are reportedly problems with the :UpdateRemotePlugins command not generating the rplugin manifest file on Windows. This file is supposed to be autogenerated, but in a pinch you can create this file yourself.

Did you read the warning?

  1. Run :UpdateRemotePlugins and note the filepath that it prints, something like: remote/host: generated rplugin manifest: /home/benlubas/.local/share/nvim/rplugin.vim (but windows)
  2. Paste the below contents into that file (which should be empty except for a few comments).
  3. Edit the file path below so that it points to where molten is installed on your system. You must use \\\\ as the path separator (idk why). An example of this might look like: "C:\\\\Users\\\\username\\\\AppData\\\\Local\\\\nvim-data\\\\lazy\\\\molten-nvim\\\\rplugin\\\\python3\\\\molten
"                                            \/ --- This file path
call remote#host#RegisterPlugin('python3', '/home/benlubas/github/molten-nvim/rplugin/python3/molten', [
      \ {'sync': v:true, 'name': 'MoltenDeinit', 'type': 'command', 'opts': {}},
      \ {'sync': v:true, 'name': 'MoltenDelete', 'type': 'command', 'opts': {}},
      \ {'sync': v:true, 'name': 'MoltenEnterOutput', 'type': 'command', 'opts': {}},
      \ {'sync': v:true, 'name': 'MoltenReevaluateCell', 'type': 'command', 'opts': {}},
      \ {'sync': v:true, 'name': 'MoltenEvaluateLine', 'type': 'command', 'opts': {'nargs': '*'}},
      \ {'sync': v:true, 'name': 'MoltenEvaluateOperator', 'type': 'command', 'opts': {}},
      \ {'sync': v:true, 'name': 'MoltenEvaluateVisual', 'type': 'command', 'opts': {'nargs': '*'}},
      \ {'sync': v:true, 'name': 'MoltenExportOutput', 'type': 'command', 'opts': {'bang': '', 'nargs': '*'}},
      \ {'sync': v:true, 'name': 'MoltenGoto', 'type': 'command', 'opts': {'nargs': '*'}},
      \ {'sync': v:true, 'name': 'MoltenHideOutput', 'type': 'command', 'opts': {}},
      \ {'sync': v:true, 'name': 'MoltenImagePopup', 'type': 'command', 'opts': {}},
      \ {'sync': v:true, 'name': 'MoltenImportOutput', 'type': 'command', 'opts': {'nargs': '*'}},
      \ {'sync': v:true, 'name': 'MoltenInfo', 'type': 'command', 'opts': {}},
      \ {'sync': v:true, 'name': 'MoltenInit', 'type': 'command', 'opts': {'complete': 'file', 'nargs': '*'}},
      \ {'sync': v:true, 'name': 'MoltenInterrupt', 'type': 'command', 'opts': {'nargs': '*'}},
      \ {'sync': v:true, 'name': 'MoltenLoad', 'type': 'command', 'opts': {'nargs': '*'}},
      \ {'sync': v:true, 'name': 'MoltenNext', 'type': 'command', 'opts': {'nargs': '*'}},
      \ {'sync': v:true, 'name': 'MoltenOpenInBrowser', 'type': 'command', 'opts': {}},
      \ {'sync': v:true, 'name': 'MoltenPrev', 'type': 'command', 'opts': {'nargs': '*'}},
      \ {'sync': v:true, 'name': 'MoltenReevaluateAll', 'type': 'command', 'opts': {}},
      \ {'sync': v:true, 'name': 'MoltenRestart', 'type': 'command', 'opts': {'bang': '', 'nargs': '*'}},
      \ {'sync': v:true, 'name': 'MoltenSave', 'type': 'command', 'opts': {'nargs': '*'}},
      \ {'sync': v:true, 'name': 'MoltenShowOutput', 'type': 'command', 'opts': {}},
      \ {'sync': v:true, 'name': 'MoltenEvaluateArgument', 'type': 'command', 'opts': {'nargs': '*'}},
      \ {'sync': v:true, 'name': 'MoltenEvaluateRange', 'type': 'function', 'opts': {}},
      \ {'sync': v:true, 'name': 'MoltenAvailableKernels', 'type': 'function', 'opts': {}},
      \ {'sync': v:true, 'name': 'MoltenBufLeave', 'type': 'function', 'opts': {}},
      \ {'sync': v:true, 'name': 'MoltenRunningKernels', 'type': 'function', 'opts': {}},
      \ {'sync': v:true, 'name': 'MoltenDefineCell', 'type': 'function', 'opts': {}},
      \ {'sync': v:true, 'name': 'MoltenOperatorfunc', 'type': 'function', 'opts': {}},
      \ {'sync': v:false, 'name': 'MoltenSendStdin', 'type': 'function', 'opts': {}},
      \ {'sync': v:true, 'name': 'MoltenTick', 'type': 'function', 'opts': {}},
      \ {'sync': v:false, 'name': 'MoltenTickInput', 'type': 'function', 'opts': {}},
      \ {'sync': v:true, 'name': 'MoltenOnBufferUnload', 'type': 'function', 'opts': {}},
      \ {'sync': v:true, 'name': 'MoltenOnCursorMoved', 'type': 'function', 'opts': {}},
      \ {'sync': v:true, 'name': 'MoltenOnExitPre', 'type': 'function', 'opts': {}},
      \ {'sync': v:true, 'name': 'MoltenOnWinScrolled', 'type': 'function', 'opts': {}},
      \ {'sync': v:true, 'name': 'MoltenStatusLineInit', 'type': 'function', 'opts': {}},
      \ {'sync': v:true, 'name': 'MoltenStatusLineKernels', 'type': 'function', 'opts': {}},
      \ {'sync': v:true, 'name': 'MoltenUpdateInterface', 'type': 'function', 'opts': {}},
      \ {'sync': v:true, 'name': 'MoltenUpdateOption', 'type': 'function', 'opts': {}},
     \ ])

Hopefully that worked.

Images

Image.nvim currently supports two display options, kitty image protocol and uberzugpp. Kitty just doesn't work due to windows blocking escape codes (explained better here). That link also links two windows issues that, when resolved, would theoretically allow it to work.

Workarounds

There are four workarounds, choose one. The first two require/only work in WSL. The last two should work both with and without WSL.

Uberzugpp

Uberzugpp should work on WSL. You might have to configure it in a special way.

Kitty in Graphical WSL

kitty/discussions/7054

The title of that discussion says it all. This is a cursed method of using kitty in a graphical WSL session.

:MoltenImagePopup

The first officially supported way to view images on Windows. It's a far worse experience compared to the other methods, but you can configure vim.g.molten_auto_image_popup = true to at least see images automatically when your code produces them. It's also very simple, and doesn't have any dependencies.

Wezterm (via Wezterm.nvim)

The second officially supported way to render images without the use of WSL on Windows is to use Wezterm as your terminal emulator and setting vim.g.molten_image_provider = "wezterm". This is a bit of a workaround, but it's the only other way to get images to render in the terminal without needing an external pop-up window like used with :MoltenImagePopup. You can find the instructions for downloading and setting up Wezterm here.

The vim.g.molten_image_provider = "wezterm" option takes advantage of wezterm.nvim under the hood to create splits, and send images to wezterm's imgcat program automatically for you. This workflow style feels a little similar to how Rstudio handles plots, and it's a nice way to keep your code and output in the same window. If you want a quick glance at plots for fast iteration. If you want a larger more detailed view of your plots you may prefer to use the :MoltenImagePopup command instead.

An example set of configuration options for molten-nvim (but not necessarily limited to) to use Wezterm as the vim.g.molten_image_provider option would look like this:

{
  "benlubas/molten-nvim",
  build = ":UpdateRemotePlugins",
  dependencies = "willothy/wezterm.nvim",
  init = function()
    vim.g.molten_auto_open_output = false -- cannot be true if molten_image_provider = "wezterm"
    vim.g.molten_output_show_more = true
    vim.g.molten_image_provider = "wezterm"
    vim.g.molten_output_virt_lines = true
    vim.g.molten_split_direction = "right" --direction of the output window, options are "right", "left", "top", "bottom"
    vim.g.molten_split_size = 40 --(0-100) % size of the screen dedicated to the output window
    vim.g.molten_virt_text_output = true
    vim.g.molten_use_border_highlights = true
    vim.g.molten_virt_lines_off_by_1 = true
    vim.g.molten_auto_image_popup = false
  end,
},