hippo: Want a smooth C/C++ and Markdown workflow in Vim on Ubuntu without building a plugin stack from scratch? I use vimplus as the base, swap out the completion engine for a compile-free, faster coc.nvim + clangd stack, isolate every change inside user custom files, and wire up dual-mode Markdown preview (browser + terminal). This guide documents the complete, reproducible setup.


1. Architecture and Non-Invasive Principles

vimplus is a classic one-click Vim C/C++ configuration framework. Out of the box, it bundles NERDTree (file explorer), LeaderF (fuzzy finder), Tagbar (symbol outline), vim-airline (status line), and a cohesive set of comma (,) leader keybindings.

Running the stock setup on modern Ubuntu (22.04 / 24.04), however, hits two unavoidable pain points:

  1. Its default completion engine is YouCompleteMe (YCM), which pulls heavy C++ dependencies and compiles locally—slow and prone to Python/Clang version mismatches.
  2. It lacks live Markdown preview as well as modern LSP (Language Server Protocol) ergonomics like hover docs, symbol rename, and one-key Quickfix.

This guide follows a “framework base + non-invasive user-layer override” pattern:

  • Keep ~/.vimplus/.vimrc as the untouched skeleton—never edit it directly;
  • Put plugin additions/removals in ~/.vimrc.custom.plugins, keymaps and behavior in ~/.vimrc.custom.config, and LSP options in ~/.vim/coc-settings.json;
  • Replace YCM with coc.nvim + clangd and add markdown-preview.nvim + glow, avoiding local C++ build pitfalls while leaving a clean foundation for visual theming and performance tuning later.

2. Install System and Runtime Dependencies

Install the build toolchain, symbol indexer, Node.js (runtime for coc.nvim), clangd, and the terminal Markdown renderer glow in one pass:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
# 1. Core system dependencies
sudo apt update
sudo apt install -y \
build-essential cmake python3-dev \
fontconfig universal-ctags ack-grep \
git vim clangd terminator

# 2. Node.js 22 LTS (runtime for coc.nvim and markdown-preview.nvim)
curl -fsSL https://deb.nodesource.com/setup_22.x | sudo -E bash -
sudo apt install -y nodejs

# 3. yarn (required to build markdown-preview.nvim)
sudo npm install -g yarn

# 4. glow (renders Markdown directly in the terminal)
sudo snap install glow

What each core dependency provides:

Component Purpose
vim Vim 9.x (stock or upgraded on Ubuntu 22.04/24.04; check via vim --version | head -n 1)
universal-ctags / ack-grep Backends for Tagbar symbol outlines and LeaderF project-wide search
nodejs + yarn Runs the async coc.nvim LSP host and builds markdown-preview.nvim
clangd C/C++ language server providing completion, go-to-definition, references, and live diagnostics
glow Lightweight terminal Markdown renderer for reading docs in a standalone window or Vim’s built-in terminal split

Verify the installed versions:

1
2
3
4
5
vim --version | head -n 1
node --version # Expected: v22.x
yarn --version
clangd --version
glow --version

3. Install vimplus and the Custom Plugin Layer

3.1 Clone and Initialize vimplus

1
2
3
git clone https://github.com/chxuan/vimplus.git ~/.vimplus
cd ~/.vimplus
./install.sh

The installer symlinks ~/.vimrc -> ~/.vimplus/.vimrc and creates two user customization entry points in your home directory:

  • ~/.vimrc.custom.plugins: manages extra plugins to install or bundled plugins to disable;
  • ~/.vimrc.custom.config: overrides base options, keymaps, and theme settings.

3.2 Declare coc.nvim and Markdown Preview in ~/.vimrc.custom.plugins

Open ~/.vimrc.custom.plugins to disable stock YCM and add coc.nvim plus markdown-preview.nvim:

1
2
3
4
5
6
7
" ~/.vimrc.custom.plugins
" Disable heavy, hard-to-compile YouCompleteMe in favor of coc.nvim + clangd
UnPlug 'ycm-core/YouCompleteMe'

" Modern LSP client and live browser Markdown preview
Plug 'neoclide/coc.nvim', {'branch': 'release'}
Plug 'iamcco/markdown-preview.nvim', { 'do': 'cd app && yarn install' }

3.3 Batch-Install Plugins

1
vim -c "PlugInstall" -c "q" -c "q"

Tip: If markdown-preview.nvim throws a yarn install error during :PlugInstall, you do not need to reinstall everything—just run the build step manually inside its plugin directory:

1
cd ~/.vim/plugged/markdown-preview.nvim && yarn install && cd app && yarn install

4. Configure coc.nvim UX and Dual-Mode Markdown Preview

4.1 Wire Up LSP and Preview Shortcuts in ~/.vimrc.custom.config

Many users install coc.nvim and immediately run into “pressing Enter doesn’t confirm completion” or “gd intermittently fails”. Both issues come from missing interactive mappings and vimplus‘s default bindings overriding gd/gr. Add the following block to ~/.vimrc.custom.config to set everything up cleanly:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
" ~/.vimrc.custom.config

"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" 1. coc.nvim completion, navigation, and diagnostics enhancements
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" Always show the signcolumn to prevent text shifting when diagnostics appear
set signcolumn=yes
" Lower CursorHold delay from default 4000ms to 300ms for snappier diagnostics
set updatetime=300

" Use Tab / Shift-Tab to cycle completion candidates, Enter to confirm
inoremap <silent><expr> <TAB>
\ coc#pum#visible() ? coc#pum#next(1) :
\ CheckBackspace() ? "\<Tab>" :
\ coc#refresh()
inoremap <expr><S-TAB> coc#pum#visible() ? coc#pum#prev(1) : "\<C-h>"
inoremap <silent><expr> <CR> coc#pum#visible() ? coc#pum#confirm()
\: "\<C-g>u\<CR>\<c-r>=coc#on_enter()\<CR>"

function! CheckBackspace() abort
let col = col('.') - 1
return !col || getline('.')[col - 1] =~# '\s'
endfunction

" Press K to show hover docs for symbol under cursor (falls back to Vim help)
nnoremap <silent> K :call <SID>show_documentation()<CR>
function! s:show_documentation()
if CocAction('hasProvider', 'hover')
call CocActionAsync('doHover')
else
call feedkeys('K', 'in')
endif
endfunction

" Symbol rename (,rn) and quickfix code action (,qf)
nmap <leader>rn <Plug>(coc-rename)
nmap <leader>qf <Plug>(coc-fix-current)

" Bind gd/gy/gi/gr on VimEnter so vimplus defaults do not clobber them
autocmd VimEnter * nmap <silent> gd <Plug>(coc-definition)
autocmd VimEnter * nmap <silent> gy <Plug>(coc-type-definition)
autocmd VimEnter * nmap <silent> gi <Plug>(coc-implementation)
autocmd VimEnter * nmap <silent> gr <Plug>(coc-references)

"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" 2. Dual-mode Markdown preview (live browser sync + glow in terminal)
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" <F7> starts live browser preview, <F8> stops it
nmap <silent> <F7> <Plug>MarkdownPreview
nmap <silent> <F8> <Plug>MarkdownPreviewStop

" Buffer-local glow terminal preview for Markdown files (default leader is ,)
" ,mp: open standalone Terminator window; ,mv: Vim 9 built-in :terminal split
autocmd FileType markdown nnoremap <buffer> <leader>mp :silent !terminator -x 'cd %:h && glow %:t'<CR>
autocmd FileType markdown nnoremap <buffer> <leader>mv :terminal glow %:p<CR>A

4.2 Initialize ~/.vim/coc-settings.json and coc-clangd

Create a baseline coc.nvim config (avoid auto-selecting the first completion candidate, and disable format-on-save so you do not introduce unrelated formatting diffs in shared repos):

1
2
3
4
5
6
7
mkdir -p ~/.vim
cat > ~/.vim/coc-settings.json << 'EOF'
{
"suggest.noselect": true,
"coc.preferences.formatOnSave": false
}
EOF

Next, install the coc-clangd extension synchronously:

1
vim -c "CocInstall -sync coc-clangd" -c "q" -c "q"

Key tip for accurate C/C++ completion: clangd relies on a compile_commands.json file at the project root to resolve include paths and preprocessor macros accurately.

  • CMake projects: Pass -DCMAKE_EXPORT_COMPILE_COMMANDS=ON during configure, then symlink build/compile_commands.json to the project root.
  • Makefile projects: Install bear (sudo apt install bear) and run bear -- make once to generate it automatically.

5. Configure a Nerd Font

NERDTree and vim-airline rely on Nerd Font icon glyphs.

  • Recommended (aligned with this series’ desktop typography): Use Sarasa Term SC Nerd configured in Part 3—it enforces strict 2:1 CJK/Latin monospace alignment while natively covering Powerline, pill, and filetype glyphs.
  • Lightweight fallback for English-only code: If you have not installed Sarasa yet, use the font bundled with vimplus:
1
2
3
mkdir -p ~/.local/share/fonts
cp ~/.vimplus/fonts/"Droid Sans Mono Nerd Font Complete.otf" ~/.local/share/fonts/
fc-cache -vf ~/.local/share/fonts

Select the Nerd Font in Terminator / GNOME Terminal preferences, then fully close and reopen the terminal so the icons render properly (terminals load fonts at startup and do not always refresh existing windows mid-session).


6. Verification Checklist and Additional Languages

Open a C/C++ file in a project with compile_commands.json alongside a .md document and verify each feature:

Feature Shortcut / Command Expected Result
File tree ,n Toggles NERDTree on the left with properly rendered icons (no missing boxes)
Fuzzy file finder ,f Opens the LeaderF fuzzy search popup
Code completion Type . / -> or identifier coc.nvim opens clangd suggestions; Tab cycles, Enter confirms
Hover docs K Displays function/type signature and comments under the cursor
Definition & references gd / gr Jumps accurately to the definition or lists all references
Rename & quickfix ,rn / ,qf Safely renames symbols across files / opens diagnostic quickfixes
Symbol outline ,t Toggles Tagbar function/struct outline on the right
Browser Markdown preview <F7> / <F8> Starts and stops live browser-synced Markdown preview
Terminal Markdown preview ,mp / ,mv Renders via glow in a standalone Terminator window or Vim 9 :terminal split
LSP health check :CocInfo Shows clangd service status as running

To add Python, JSON, Shell, or frontend language support, install the matching coc extensions:

Extension Language Install Command
coc-pyright Python :CocInstall coc-pyright
coc-json JSON / JSONC :CocInstall coc-json
coc-sh Bash / Zsh :CocInstall coc-sh
coc-html / coc-css HTML / CSS :CocInstall coc-html coc-css

7. Backup and Cross-Machine Migration

All customizations live in just 3 user files plus ~/.vimplus, making backup and migration straightforward:

1
2
3
4
5
6
7
8
9
10
11
12
# Back up
tar czf ~/vimplus-backup.tar.gz -C ~ .vimplus .vimrc.custom.plugins .vimrc.custom.config .vim/coc-settings.json

# Restore on a new machine (install system deps, Node.js, and clangd first)
tar xzf ~/vimplus-backup.tar.gz -C ~
ln -sf ~/.vimplus/.vimrc ~/.vimrc
mkdir -p ~/.vim
ln -sf ~/.vimplus/colors ~/.vim/colors
ln -sf ~/.vimplus/ftplugin ~/.vim/ftplugin
ln -sf ~/.vimplus/autoload ~/.vim/autoload
vim -c "PlugInstall" -c "q" -c "q"
vim -c "CocInstall -sync coc-clangd" -c "q" -c "q"

With that, you have a compile-free Vim 9 terminal IDE with full LSP support and dual-mode Markdown preview up and running.

Next step (modern visuals & performance tuning): A freshly configured vimplus is already productive, but visually and performance-wise it still feels like a previous-generation terminal setup—its opaque background clashes with a dark frosted-glass desktop, completion popups lack rounded borders, and large files can freeze the editor. In the next part, we stick to the exact same non-invasive 3-file rule to upgrade classic Vim 9 + vimplus with transparent Catppuccin Mocha frosted glass + pill status line + native Vim 9 indent guides + ~130ms cold start + >2MB buffer-local large-file freeze protection 👉 No Neovim Required: Non-Invasively Turn Classic Vim 9 + vimplus into a Modern Dark Frosted-Glass Editor.


Series Navigation

# Article Core Topics
#0 Ubuntu Workstation Setup · Series Index End-to-end architecture blueprint, dual-machine baseline, and reading roadmap
#1 Ubuntu 22.04 GNOME Desktop Configuration Guide Fundamentals: GNOME extensions, window ergonomics, and X11 vs. Wayland
#2 Ubuntu GNOME Dark Frosted-Glass Desktop Framework and Dual File Manager Blur Opacity Fix (22.04 / 24.04) Fluent + Colloid + dynamic wallpaper, Blur my Shell tuning, and Nautilus/Nemo opacity fix
#3 Font Stack, Strict fontconfig Binding, fcitx5, and Shortcut Pitfalls Inter + HarmonyOS Sans SC + Sarasa, strong binding, and IME troubleshooting
#4 Terminal CLI, Qt5 Unification, VS Code/Cursor, and Chrome Alignment eza/bat/btop/fastfetch, qt5ct palette alignment, editors, and offline-safe Chrome script
#5 End-to-End Boot and Lockscreen Loop: GRUB, Plymouth, GDM, and Lockscreen GRUB baseline JPEG, Plymouth bgrt, non-destructive GDM, and global rollback matrix
#6 Ubuntu vimplus Setup and Configuration Guide (Current post) Non-invasive vimplus modernization: coc.nvim + clangd, full LSP keymaps, and dual-mode Markdown preview
#7 No Neovim Required: Non-Invasively Turn Classic Vim 9 + vimplus into a Modern Dark Frosted-Glass Editor Transparent Catppuccin Mocha, opaque rounded popups, pill status line, native Vim 9 indent guides, and buffer-local large-file optimization
#8 End-to-End Ubuntu Dev Tools Visual & Workflow Unification: VS Code, Cursor, tmux, Git Delta, fzf, and Typora Fine-tuned VS Code/Cursor, plugin-free tmux pill status bar, delta/fzf/fd/zoxide chain, and Typora/Guake/gedit polish