Table of Contents

neovim

My notes on nvim.

Installation

tl;dr: Prefer the tarball to snap or default package manager.

The regular apt-get repo is too out-of-date. When 0.9.5 was stable, Ubuntu 20.04 was providing 0.3 or 0.4.

GitHub recommends against snap for gh, and in WSL2, although I had snap, it didn't work, so I downloaded the tarball. (If you click Linux, it'll download the tarball. Otherwise scroll down and find/expand "Assets".) Then I extracted it into $HOME/.local/bin/.

cd ~/.local/bin/
wget https://github.com/neovim/neovim/releases/latest/download/nvim-linux64.tar.gz
tar -xvf nvim-linux64.tar.gz
ln -s nvim-linux64/bin/nvim nvim

Copilot

You need Node for the Copilot plugin (Getting Started instructions). It also works with Vim 9.0.0.0185+.

  1. Install Node.
  2. Get nvim (see above)
  3. Install plugin (used –filter=blob:none)
    1. git clone --filter=blob:none https://github.com/github/copilot.vim.git ~/.config/nvim/pack/github/start/copilot.vim
  4. read docs.

Copilot Chat

See Manual installation of CopilotChat.

mkdir -p ~/.config/nvim/pack/copilotchat/start
cd ~/.config/nvim/pack/copilotchat/start
# (Done as part of CoPilot installation) git clone --filter=blob:none --single-branch https://github.com/github/copilot.vim
git clone --filter=blob:none --single-branch https://github.com/nvim-lua/plenary.nvim
git clone --filter=blob:none --single-branch https://github.com/CopilotC-Nvim/CopilotChat.nvim

On macOS, I initially had trouble with diffs of the form [file:main.cpp](#file:main.cpp-context), so I edited ~/.config/nvim/pack/copilotchat/start/CopilotChat.nvim/lua/CopilotChat/client.lua:25.

sed -i 's/(#file:%s-context)/(%s)/' ~/.config/nvim/pack/copilotchat/start/CopilotChat.nvim/lua/CopilotChat/client.lua

Optional, MarkDown rendering:

git clone --filter=blob:none --single-branch https://github.com/nvim-treesitter/nvim-treesitter \
          ~/.config/nvim/pack/nvim-treesitter/start/

Add require'nvim-treesitter.configs'.setup… to .config/nvim/init.vim. Test CopilotChat like this, with treesitter, but not render-markdown.

See what you think of this first. (Rainbow parentheses may be gone. Might have to add something like rainbow-delimiters.nvim).

git clone --filter=blob:none --single-branch https://github.com/MeanderingProgrammer/render-markdown.nvim \
          ~/.config/nvim/pack/render-markdown.nvim/start/

taglist

The old taglist I have isn't working as expected in tmux. Opening the window would wrap neovim windows. The fix is to disable auto-resizing the winwidth.

let Tlist_Inc_Winwidth = 0

Along the way, I tried getting the latest release (since head auto runs tests). Maybe I should keep it.

git clone --filter=blob:none -b v4.6 https://github.com/yegappan/taglist ~/.local/share/nvim/site/plugin/

cscope

Cscope has been removed from neovim. If you want it back, install dhananjaylatkar/cscope_maps.nvim into .config/nvim/pack/cscope_maps/start/. (This may also work in ~/.local/share/nvim/site/pack/cscope_maps/start/, but you have to get the path right.)

Your hierarchy would look something like:

~/.config/nvim/pack/cscope_maps/
└── start
    └── cscope_maps.nvim
        └── lua
            ├── cscope
            │   └── pickers
            └── utils

Run the following commands:

mkdir -p ~/.config/nvim/pack/cscope_maps/start/
cd ~/.config/nvim/pack/cscope_maps/start/
git clone --filter=blob:none https://github.com/dhananjaylatkar/cscope_maps.nvim.git

Then in your init.vim, add the following snippet:

init.vim
lua << EOF
  require('cscope_maps').setup({
    disable_maps = true, -- Mapping C-] to :Cstag <cword> worse than :tag <cword>
-- Alternatively, if we liked the mappings, then customise these two:
--    skip_input_prompt = true,
--    cscope = { skip_picker_for_single_result = true },
  })
EOF

Mappings

The easiest way to find out where a mapping came from is to run this command:

  :verbose imap <key sequence>