4

I am working on a Chromebook. Mostly I code in an online IDE, which supports Vim mode, but from time to time I need full Vim support. For example, I need it to be able to use macros and filter content through typical Linux commands, e.g. :%!sort | uniq -c | sort -n.

I've searched for extensions that run Vim in Chrome, but looks like there are only extensions that allow navigating the page with Vim shortcuts, not the editor itself. Any suggestions?

1

5 Answers 5

4

If you have a recent enough and powerful enough Chromebook, then you should consider Crostini, which can give you a Linux container running in a lean virtual machine in your Chromebook.

If you have an older Chromebook, you can consider Crouton, which can give you a chroot with a Linux distribution into your Chromebook.

Both approaches will allow you to install a Linux distribution such as Debian or Ubuntu into your Chromebook, which will allow you to have a native Vim package which is able to spawn a shell and run all the standard Linux utilities.

The advantage of the former approach, Crostini, is that you're running on a lean virtual machine that allows you to keep all your Chromebook security features enabled, so you should prefer that approach if it's available for your Chromebook.

The latter, Crouton, requires that you switch your Chromebook to developer mode. There are security implications to switching to developer mode, so make sure you understand them well. The Crouton page and wiki include pointers to information about that, so I'd recommend you start with those.

0
3

Just (yesterday) bought a Lenovo Duet Chromebook to replace my Android tablet. Immediately swithed on the Linux Beta option in the setting menu. Turned out the linux environment comes with Vim (not gvim) preinstalled!

1
2

I know that this someone else has already answered, but for those on enterprise enrolled Chromebooks there is a WASM port by Rhysd available here.

1
2

It's actually possible to get Vim (7.4) on a Chromebook without using Crostini nor Crouton! You can get it from the Chrome Web Store.

1
  • 1
    Welcome to Vi and Vim! I've made a few edits to your post to improve the link placement and note that the version is 7.4 (AFAICT).
    – D. Ben Knoble
    Jun 4, 2021 at 18:43
0

Every linux machine should have vi, rather pissed it's not available at the vanilla chromeos bash prompt. So obtained the vim executable and the required library from a donor system, then in chromeos copied those files to appropriate directories as follows on a chromebook in developer mode.

  echo $PATH     # Make sure /usr/local/bin is in your executable path
  sudo cp vim /usr/local/bin       # copy the executable
  sudo ln -s /usr/local/vim /usr/local/vi      # I've called it vi for 40 yrs
  vi    # see what missing libraries it complains about

  echo $LD_LIBRARY_PATH    # Make sure /usr/local/lib64 in library path 
  sudo cp libtinfo.so.5.9 /usr/local/lib64   # get the big file, not a link
  sudo ln -s /usr/local/lib64/libtinfo.so.5.9 /usr/local/lib64/libtinfo.so.5

In my case, I copied them over from an old chromebook under crouton, but could almost certainly copy them over from crostini as well. Also, I did not need to copy over the libtinfo.so library till recently when a chromeos update silently gifted me with only libtinfo.so.6

To find the appropriate files on the donor linux system:

  which vim
  sudo find / -name "libtinfo.so*" -exec ls -l {} +

That find command executes "ls -l" on all files that match the pattern. The one that vi under chromeos complains is missing may just be a link, you want to copy over the big file that has the library data in it.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.