-
Notifications
You must be signed in to change notification settings - Fork 11
Expand file tree
/
Copy pathnvvim
More file actions
executable file
·74 lines (62 loc) · 1.48 KB
/
nvvim
File metadata and controls
executable file
·74 lines (62 loc) · 1.48 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
64
65
66
67
68
69
70
71
72
73
74
#!/bin/sh
usage ()
{
echo "Usage: nvim [directory]"
echo ""
echo "Where directory is where you want to store your notes."
echo ""
echo "Environment variables:"
echo "NVIM_HOME: Which directory to use as a default (if not overridden via command line). Defaults to current directory."
echo "NVIM_EDITOR: Command to execute to invoke vim. Defaults to 'vim'"
echo "NVIM_PYTHON3_SO: location of libpython3.so file if vim is compiled with 'python3/dyn' and the file is not /usr/lib/libpython3.so"
exit 1
}
if [ "$#" -gt 1 ]
then
usage
fi
if [ "$#" -gt 0 ]
then
if [ "$1" = "-h" -o "$1" = "--help" ]
then
usage
fi
export NVIM_HOME=$1
fi
if [ -z "$NVIM_HOME" ]
then
export NVIM_HOME=$PWD
fi
if [ -z "$NVIM_EDITOR" ]
then
export NVIM_EDITOR='vim'
fi
if [ -z "$NVIM_PYTHON3_SO" ]
then
export NVIM_PYTHON3_SO='/usr/lib/libpython3.so'
fi
if [ ! -d "$NVIM_HOME" ]
then
echo "Error: directory $NVIM_HOME does not appear to exist."
exit 1
fi
FLAGS=$($NVIM_EDITOR --version)
echo $FLAGS | grep '+python3' >/dev/null
PYTHON3=$?
if [ $PYTHON3 -eq 1 ]
then
echo "Error, $NVIM_EDITOR is not compiled with python3 support"
exit 1
fi
echo $FLAGS | grep 'python3/dyn' >/dev/null
PYTHON3DYN=$?
if [ $PYTHON3DYN -eq 0 ]
then
if [ ! -f "$NVIM_PYTHON3_SO" ]
then
echo "Error: $NVIM_EDITOR is compiled with dynamic python3 support, and I can't find libpython3.so"
usage
fi
export LD_PRELOAD=$NVIM_PYTHON3_SO
fi
cd "$NVIM_HOME" && $NVIM_EDITOR -c 'exec NVIM_init()'