Skip to content
Shaobin-Jiang edited this page Mar 1, 2024 · 1 revision

IceNvim has many built-in utilities that make it one of a kind.

Enhanced Yanking

Neovim by itself allows what you have yanked from within to be accesed from outside of neovim with a minimal configuration. However, it is not always so easy. If you are trying to yank unicode characters and you happen to be using neovim on windows or wsl, things will get... well, nasty, for you will find that the content you have yanked become unintelligible once you paste it somewhere else.

The problem is that the general solution to accessing the yanked content from outside neovim is to pass the content to windows' default clipboard application CLIP.exe, which unfortunately handles unicode characters poorly. So it is now apparent how to deal with the problem: we replace the CLIP.exe with another that can handle unicode characters properly.

IceNvim uses uclip.exe as the replacement. The executable is not shipped with IceNvim, and the enhanced yanking feature is disabled by default. Once you install it following the instruction here, though, it will start to work at once.

Automatic IME Switching

Using neovim plus an input method can be a painful experience for anyone who has ever tried it. Say that you are entering some Chinese characters, and then you press esc to return to normal mode and type a combination of key... And you find the input method's selection box popping out. This is just a glimpse of the annoying cases the combined using of neovim and IME can bring about. Fortunately, IceNvim deals with this via an external im-select.exe.

With the executable installed (instructions go here), IceNvim will automatically switch to the English language when you leave insert mode and will return your IME to its original state, that is, the state it had been in when you were about to leave insert mode, when you later go back to insert mode. No more repeated manual IME switching.

Automatic Directory Switching

Imagine this: you are at location A in your terminal, and you decide to open a file at location B with neovim. Now, after you have started neovim, run :pwd to check out the current working directory. You will find your working directory is still at path A.

This is extremely inconvenient. Either when you are trying to launch a shell process from within neovim or open a file explorer tree, you will find that they are not under the same path as your currently opened file. Of course, automatic directory changing is provided by neovim (the autochdir option), but it is not an ideal solution. The autochdir option strictly changes the working directory to whatever directory your current file is at, so if you are working in a project and you are opening a file in a subfolder of that project, the working directory will not be the project folder, but the child folder.

Switching to the project directory is also something already available if you are using project.nvim. However, the plugin has not been worked on for more than a year when this documentation is first written and as far as I am concerned, the switching does not always work properly. For this very reason, I have decided to write my own version of directory switching for IceNvim.

IceNvim determines which directory to switch to by looking for such files or folders like package.json, .git/, etc. If they are not found, then IceNvim will switch the working directory to wherever the current file is.

This feature can be turned off. You can also determine the file pattern for root detection. See the customization for more details.

Check Nerd Icons

It is recommended that you use IceNvim with a nerd font. That is because IceNvim uses a variety of text icons. In order to check out whether these icons would be displayed properly, you can press Space + u + i start IceNvim's icon viewer.

Switch Colorscheme

VsCode has a cool feature: Ctrl + k + Ctrl + t enables you to quickly change your colorscheme. I used VsCode before using neovim but I liked this function very much and so I implemented it for IceNvim. By pressing the same keys, you can start a colorscheme switcher, whose listed themes, after being selected, will be preversed even after you restart neovim (unlike the default colorscheme picker provided by telescope).

Clone this wiki locally