-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy path.nvim-setup.sh
More file actions
executable file
·63 lines (52 loc) · 2.1 KB
/
.nvim-setup.sh
File metadata and controls
executable file
·63 lines (52 loc) · 2.1 KB
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
56
57
58
59
60
61
62
63
#!/usr/bin/env bash
# SPDX-FileCopyrightText: Tim Sutton
# SPDX-License-Identifier: MIT
# This script sets up the environment for Neovim/LSP to work with QGIS Python libraries
# Source this script before running nvim: source .nvim-setup.sh
#
# Project keybindings are under <leader>p - run :WhichKey <leader>p in neovim
# Colors
CYAN='\033[38;2;83;161;203m'
GREEN='\033[92m'
ORANGE='\033[38;2;237;177;72m'
RESET='\033[0m'
QGIS_BIN=$(which qgis 2>/dev/null)
if [[ -z "$QGIS_BIN" ]]; then
echo -e "${ORANGE}Warning: QGIS binary not found in PATH${RESET}"
echo "Make sure you're in the nix develop shell first"
return 1 2>/dev/null || exit 1
fi
# Extract the Nix store path (removing /bin/qgis)
QGIS_PREFIX=$(dirname "$(dirname "$QGIS_BIN")")
# Construct the correct QGIS Python path
QGIS_PYTHON_PATH="$QGIS_PREFIX/share/qgis/python"
# Check if the Python directory exists
if [[ ! -d "$QGIS_PYTHON_PATH" ]]; then
echo -e "${ORANGE}Warning: QGIS Python path not found at $QGIS_PYTHON_PATH${RESET}"
return 1 2>/dev/null || exit 1
fi
# Add virtualenv if it exists
VENV_PATH=""
if [[ -d ".venv" ]]; then
VENV_PATH=$(find .venv/lib -maxdepth 1 -name "python*" -type d | head -1)/site-packages
fi
export PYTHONPATH="$QGIS_PYTHON_PATH:$VENV_PATH:$PYTHONPATH"
echo -e "${GREEN}Neovim environment configured for QGIS development${RESET}"
echo ""
echo -e "QGIS Python: ${CYAN}$QGIS_PYTHON_PATH${RESET}"
if [[ -n "$VENV_PATH" ]]; then
echo -e "Virtualenv: ${CYAN}$VENV_PATH${RESET}"
fi
echo ""
echo -e "Project keybindings: ${CYAN}<leader>p${RESET}"
echo -e " ${CYAN}<leader>pq${RESET} - QGIS commands"
echo -e " ${CYAN}<leader>pt${RESET} - Testing"
echo -e " ${CYAN}<leader>pc${RESET} - Code quality"
echo -e " ${CYAN}<leader>pd${RESET} - Documentation"
echo -e " ${CYAN}<leader>px${RESET} - Debugging"
echo ""
echo -e "Run ${CYAN}:WhichKey <leader>p${RESET} in neovim for full menu"
echo ""
echo -e "${ORANGE}Note:${RESET} Add this to your neovim config to auto-load .nvim.lua:"
echo -e " ${CYAN}vim.opt.exrc = true${RESET}"
echo -e " ${CYAN}-- For .nvim.lua: use neoconf.nvim or nvim-config-local plugin${RESET}"