{"id":683,"date":"2021-10-27T22:07:39","date_gmt":"2021-10-27T20:07:39","guid":{"rendered":"https:\/\/blog.chloesoe.ch\/?p=683"},"modified":"2021-10-27T22:37:02","modified_gmt":"2021-10-27T20:37:02","slug":"migrate-from-vim-to-neovim","status":"publish","type":"post","link":"https:\/\/blog.chloesoe.ch\/?p=683","title":{"rendered":"Migrate from ViM to neovim"},"content":{"rendered":"<p>Links used:<\/p>\n<ul>\n<li><a href=\"https:\/\/otavio.dev\/2018\/09\/30\/migrating-from-vim-to-neovim\/\">https:\/\/otavio.dev\/2018\/09\/30\/migrating-from-vim-to-neovim\/<\/a><\/li>\n<li><a href=\"https:\/\/thomasventurini.com\/articles\/install-neovim-05-in-ubuntu\/\">https:\/\/thomasventurini.com\/articles\/install-neovim-05-in-ubuntu\/<\/a><\/li>\n<\/ul>\n<h1>Main Steps<\/h1>\n<p>To use your existing <code>.vimrc<\/code> you can do this:<\/p>\n<pre><code>cat &lt;&lt; EOF &gt; ~\/.config\/nvim\/init.vim\nset runtimepath^=~\/.vim runtimepath+=~\/.vim\/after\nlet &amp;packpath = &amp;runtimepath\nsource ~\/.vimrc\nEOF<\/code><\/pre>\n<p>But if you want different init.vim than .vimrc (probably a good idea in the start phase) copy your stuff to:<\/p>\n<pre><code>cp -r ~\/.vim\/bundle ~\/.config\/nvim\/bundle\/\ncp ~\/.vimrc ~\/.config\/nvim\/init.vim<\/code><\/pre>\n<p>You then could add a file <code> ~\/.config\/nvim\/ginit.vim<\/code> for <code>nvim-qt<\/code> the Gvim equivalent of nvim. The normal  distinction with <code>has(gui_running)<\/code> does not work properly. We can add all GUI Neovim specific stuff there, for my side it is something like:<\/p>\n<pre><code>colorscheme peachpuff\n&quot;map ctrl-tab to switch splits in terminal mode\nnmap &lt;silent&gt; &lt;C-Tab&gt; :wincmd w&lt;CR&gt;\n\n&quot;open full screen\ncall rpcnotify(0, &#039;Gui&#039;, &#039;WindowMaximized&#039;, 1)\n\n&quot; Set Gui Font (`set guifont=` does not work in nvim-qt)\nif has(&#039;nvim&#039;)\n    GuiFont FreeMono:10\nelse<\/code><\/pre>\n<p>But later stuff in my .vimrc, like opening NERDTree, did not work in ginit.vim. For that I have extended my diff in init.vim:<\/p>\n<pre><code>if (has(&#039;gui_running&#039;) || get(g:, &#039;GuiLoaded&#039;, 1))<\/code><\/pre>\n<p>There is further a bug in nvim-qt in the newer package than the one from bionic, to open an additional empty buffer, see &quot; <a href=\"https:\/\/github.com\/equalsraf\/neovim-qt\/issues\/423\">https:\/\/github.com\/equalsraf\/neovim-qt\/issues\/423<\/a><\/p>\n<p>This can be fixed with three lines at the end of init.vim:<\/p>\n<pre><code>if @% == &quot;&quot;\n  bd\nendif<\/code><\/pre>\n<p>Now you can use it with your ViM configuration. There is one difference, my beloved command <code>gvim -d<\/code> does not work directly, we have to use <code>nvim-qt -- -d file1 file2<\/code>. With Termina nvim, everything is ok.<\/p>\n<h2>Vundle Troubleshoot<\/h2>\n<p>To update Plugins, you probably have to change your Vundle configuration:<\/p>\n<pre><code>set rtp+=~\/.config\/nvim\/bundle\/Vundle.vim\ncall vundle#begin(&quot;~\/.config\/nvim\/bundle&quot;)<\/code><\/pre>\n<p>now you can run <code>:PluginInstall<\/code> and <code>:PluginUpdate<\/code><\/p>\n<h1>Make Neovim Default<\/h1>\n<p>Add alternatives, for gvim somehow already \/usr\/bin\/gvim.nvim-qt exist.<\/p>\n<pre><code>sudo update-alternatives --install $(which vim) vim $(which nvim) 10<\/code><\/pre>\n<p>and then config your choice:<\/p>\n<pre><code>sudo update-alternatives --config vim\nsudo update-alternatives --config gvim<\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"<p>Links used: https:\/\/otavio.dev\/2018\/09\/30\/migrating-from-vim-to-neovim\/ https:\/\/thomasventurini.com\/articles\/install-neovim-05-in-ubuntu\/ Main Steps To use your existing .vimrc you can do this: cat &lt;&lt; EOF &gt; ~\/.config\/nvim\/init.vim set runtimepath^=~\/.vim runtimepath+=~\/.vim\/after let &amp;packpath = &amp;runtimepath source ~\/.vimrc EOF But if you want different init.vim than .vimrc (probably a good idea in the start phase) copy your stuff to: cp -r ~\/.vim\/bundle ~\/.config\/nvim\/bundle\/ cp&#8230; <a href=\"https:\/\/blog.chloesoe.ch\/?p=683\" class=\"more-link\">Continue reading <span class=\"screen-reader-text\">Migrate from ViM to neovim<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[7,11],"tags":[],"class_list":["post-683","post","type-post","status-publish","format-standard","hentry","category-linux","category-vim"],"_links":{"self":[{"href":"https:\/\/blog.chloesoe.ch\/index.php?rest_route=\/wp\/v2\/posts\/683","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blog.chloesoe.ch\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.chloesoe.ch\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.chloesoe.ch\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.chloesoe.ch\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=683"}],"version-history":[{"count":3,"href":"https:\/\/blog.chloesoe.ch\/index.php?rest_route=\/wp\/v2\/posts\/683\/revisions"}],"predecessor-version":[{"id":686,"href":"https:\/\/blog.chloesoe.ch\/index.php?rest_route=\/wp\/v2\/posts\/683\/revisions\/686"}],"wp:attachment":[{"href":"https:\/\/blog.chloesoe.ch\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=683"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.chloesoe.ch\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=683"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.chloesoe.ch\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=683"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}