Phase 6: Neovim & LSP

Phase 6: Neovim & LSP

Mason (the standard Neovim LSP installer) does not work on Termux — no Android ARM64 binaries available. LSPs must be installed directly via pkg or npm and configured with a native fallback.

blink.cmp requires a Rust build for performance on ARM64:

pkg install rust binutils make clang
cd ~/.local/share/nvim/lazy/blink.cmp
cargo build --release

Install LSPs via Termux

# Node.js for npm-based LSPs
pkg install nodejs-lts
# TypeScript/JavaScript
npm install -g typescript typescript-language-server
# Python
npm install -g pyright
# Bash
npm install -g bash-language-server
# YAML/JSON/HTML/CSS
npm install -g yaml-language-server vscode-langservers-extracted
# Rust
pkg install rust-analyzer
# C/C++
pkg install clang

Configure Neovim for Termux

Suppress Mason on Termux

File: ~/.config/nvim/lua/domus/plugins/config/lsp/init.lua

Add at top of file:

---@diagnostic disable: undefined-global

Wrap ensure_installed to skip on Termux (around line 48):

require("mason-lspconfig").setup({
    ensure_installed = vim.fn.isdirectory("/data/data/com.termux") == 1 and {} or {
        "lua_ls", "pyright", "rust_analyzer", "ts_ls",
        -- ... rest of servers
    },

Add Termux Native LSP Fallback

Add after mason-lspconfig.setup() closes (before function end):

-- Termux fallback: setup LSPs using nvim 0.11 native API
if vim.fn.isdirectory("/data/data/com.termux") == 1 then
    vim.lsp.config.lua_ls = {
        cmd = { "lua-language-server" },
        filetypes = { "lua" },
        root_markers = { ".git", ".luarc.json", "init.lua" },
        settings = { Lua = { diagnostics = { globals = { "vim" } } } },
    }
    vim.lsp.config.pyright = {
        cmd = { "pyright-langserver", "--stdio" },
        filetypes = { "python" },
        root_markers = { ".git", "pyproject.toml", "setup.py" },
    }
    vim.lsp.config.rust_analyzer = {
        cmd = { "rust-analyzer" },
        filetypes = { "rust" },
        root_markers = { ".git", "Cargo.toml" },
    }
    vim.lsp.enable({ "lua_ls", "pyright", "rust_analyzer" })
end

Disable obsidian.nvim on Termux

File: ~/.config/nvim/lua/domus/plugins/specs/lang/markdown.lua

{
    "epwalsh/obsidian.nvim",
    cond = vim.fn.isdirectory("/data/data/com.termux") == 0, -- disable on Termux
    -- ...
},
Mason errors on startup are expected until ensure_installed is wrapped. System-installed LSPs work via native fallback.
Check Status

blink.cmp built from source (Rust)

[x]

LSPs installed via pkg/npm

[x]

Mason ensure_installed wrapped for Termux

[x]

Termux native LSP fallback configured

[x]

obsidian.nvim disabled on Termux

[x]