aboutsummaryrefslogtreecommitdiff
path: root/README.md
diff options
context:
space:
mode:
authorCody Hiar <cody.hiar@investopedia.com>2016-07-27 12:08:38 -0600
committerCody Hiar <cody.hiar@investopedia.com>2016-07-27 12:08:38 -0600
commited9ada3dcfbb5e70105480d37dd5c99b7f83d5bb (patch)
treeafff8df631a8aa2c55b6cc23f50c6e5f5d6d87db /README.md
Initial commit of the working files.
Diffstat (limited to 'README.md')
-rw-r--r--README.md43
1 files changed, 43 insertions, 0 deletions
diff --git a/README.md b/README.md
new file mode 100644
index 0000000..4ff8937
--- /dev/null
+++ b/README.md
@@ -0,0 +1,43 @@
+# Dockerized Neovim
+Run neovim in a container and be cool like all the other cool kids.
+I like to dockerize all my tools so I am making this repo to dockerize Neovim.
+
+# Step 1: Build the image
+The first step is to build the the docker image.
+I call mine thornycrackers/neovim so you will have to change that accordingly for the following steps
+```
+$ docker build -t=thornycrackers/phpcs .
+```
+
+# Step 2: Run the image
+Say you have a local file called 'test.php' and you are in the same directory as the file.
+To open that file with the neovim container simply run the following
+```
+$ docker run -i -t -v $(pwd):/src thornycrackers/neovim /bin/sh -c 'nvim /src/test.php'
+```
+This will open up neovim and when you exit neovim it will exit the container.
+
+# Step 3: Make this command a little more useful
+So using that command is awesome but a little cumbersome everytime you want to run it against a different file.
+Create a file called 'phpcs' and make sure to give it executable permissions and place it somewhere in your $PATH.
+Copy the following inside of the 'phpcs' executable file.
+
+```
+#!/bin/bash
+# Command for running neovim
+
+if [[ "$1" = /* ]]; then
+ file_name="$(basename ${1})"
+ dir_name="$(dirname ${1})"
+else
+ file_name="$1"
+ dir_name="$(pwd)"
+fi
+
+# Run the docker command
+docker run -i -t -P -v "$dir_name":/src thornycrackers/neovim /bin/sh -c "cd /src;nvim $file_name"
+```
+
+Now you can run neovim as if you would regularly.
+The only gotcha I've deiscovered so far is that because you are mounting to the docker container you cannot go above the folder you open neovim in.
+This is a pretty rare case in my trials of using this but it is something to note.