Unity with vim or terminal editor

October 29, 2023

Unity with Vim or terminal editor

Background Problem

I develop some a game prototype project with an Unity Engine. and i use amd-a9 with 4GB of ram as my main laptop. the first i use the recomended enviroment to develop on unity. which is use VSCode with Devkit extension and unity plugin. for detail i use linux with xfce and the unity version is 2022LTS. well my laptop crash. yes, repeatly i try open project then not longer after that will crash.

my first solution is use omnisharp plugin in VS Codium. then i can develop my game but the crash still appear if i doing to fast. simply because i write code same time with unity compile the c# or i accidentally switch with alt+tab.

next solution for me is to use vim. i use vim to edit linux config file, some thing like samba config and bashrc. so let's screw it.

then, i gave up at first. because i don't know how it doesn't work. i installed the nvim.coc with omnisharp-vim. not work.

then, i install nvim and use kickstart-nvim. then i try to add omnisharp with lazy.nvim. i don't understand.

the first light

after hours to try something with omnisharp thing and search on internet. the first solution come out.

if using Nvim. then you use kickstart-Nvim. then just install omnisharp with mason-plugin

  1. on Normal mode of nvim typing the :Mason
  2. navigate with j to down and k to up
  3. on omnisharp line then press i to install
  4. wait for finish, try navigate to top page, to see the installing process.

try to quit nvim if omnisharp not running.

Unity side

after installed omnisharp on nvim. then i can code.

but if i want to see my other project or new project then the omnisharp not shown.

this because, you must generate sln file and update visual code packed.

try do this:

  • update visual studio package on unity package manager to recent.
  • open prereference window. Edit>Prerefrence>external tools
  • select visual studio code as code editor
  • generate project file.

Note: try not to give checklist while generate project file. this because omnisharp will have more process then making crash your laptop.

Vim light

i lose hope to use vim as unity code editor. but i meet this code

let g:OmniSharp_server_use_net6=1

yes this code i need to run with my installed dotnet on linux. OMG why i don't realize. then i have vim intellisense worked. but sometime omnisharp have to mush time to recognize unity code. event not shown at all.

helix

i on terminal editor hoping now. i meet helix and i try. i kinda like it. but setting omnisharp LSP is hard too.

but i can use it. the trick is.

  • download OmniSharp-Roslyn for net6
  • extract it
  • add to PATH

there you go.

conclusion

the hours i spend to use omnisharp work in my code editor. i realize intellisense on code editor need lsp to be runnig out of the box. i know lsp stand for Language Server Program. a program can give feedback of recomendation of language while writing some code.

  • if you using Mason. then you must install omnisharp on Mason package
  • if you using omnisharp-vim and use dotnet to run c# program don't forget to add let g:OmniSharp_server_use_net6=1 on your .vimrc and run :OmniSharpInstall on vim.

Trivia

is copilot an advance program of LSP?. i mean they kinda same.

By Rokugatsua