Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed Issue on Mac #1

Closed
codeitlikemiley opened this issue Aug 16, 2023 · 0 comments
Closed

Fixed Issue on Mac #1

codeitlikemiley opened this issue Aug 16, 2023 · 0 comments

Comments

@codeitlikemiley
Copy link
Collaborator

codeitlikemiley commented Aug 16, 2023

Solution on related issue: https://github.com/neovide/neovide/issues/1982 Ive been Using Neovide for Rust Development

I've used it on all platforms , but mainly on my Mac M1

Common Issues that you guys will face

  1. CMD + H , cant be bind on Mac if it is launch using neovide cli

Solution: create Alias neovide , paste it on your zshrc/bashrc

function neovide(){
    ARG="${1:-.}"
    CUR="$(pwd)"
    FILE="${CUR}/${ARG}"
    PATH=$(env) NEOVIDE_CWD=$(pwd) open -a Neovide.app --args $(pwd)
}
  1. PATH and CWD is nil

This happens since Neovide runs on Sandbox on MacOS

The above snippets only fixes half of the problem.

CWD gets initialized is nil , you can check by running this

:lua print(vim.fn.getcwd())

So Most Plugins , Like Neo-Tree, Terminal etc that uses the vim.fn.getcwd() have issues your opening on the root folder

Screenshot 2023-08-16 at 9 43 43 PM

For us to fix that issue...

  • prefix our command with Neovide.app with NEOVIDE_CWD , which we already did on neovide alias
  • set our CWD on our Vim config

If using neovim with lua scripts, add the snippet on your initialization of the script , ie. lazy.lua

-- only set if NEOVIDE_CWD is set
if vim.fn.getenv("NEOVIDE_CWD") then
  vim.api.nvim_set_current_dir(vim.fn.getenv("NEOVIDE_CWD"))
end

For normal vim/nvim script

if !empty($NEOVIDE_CWD)
  " Change the current working directory to the value of NEOVIDE_CWD
  execute "cd" $NEOVIDE_CWD
endif

If your Rust users like me on mac, you can simple use my Nvim Configuration...

https://github.com/codeitlikemiley/nvim

That allows you to move quickly around panes, test and debug with Rust at ease...

Note all those Extra key bindings on rust only triggers if on rust project.

I think my config is 100% Better than with VSCODE with Rust :)

Hope you like it and Star thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant