diff --git a/vim/Dockerfile b/vim/Dockerfile new file mode 100644 index 0000000..9d3b013 --- /dev/null +++ b/vim/Dockerfile @@ -0,0 +1,6 @@ +FROM alpine:latest + +RUN apk update && apk add --no-cache neovim && \ + mkdir -p /root/.config/nvim + +COPY init.vim /root/.config/nvim/init.vim diff --git a/vim/README.md b/vim/README.md new file mode 100644 index 0000000..2e497f5 --- /dev/null +++ b/vim/README.md @@ -0,0 +1,18 @@ +# What is this? +This is a very simple container which I use to edit configs inside a Docker +volume. It allows me to keep a lot more data inside a volume, cleaning up the +rest of the system. + +# Included script +The included script just mounts the given directory in the `nvim:latest` +volume. In order to use it, you should've built the container first. + +# Building the container +You can build the container with the following command: + +``` +docker build -t chewingbever/nvim:latest . +``` + +This will build the image and tag it correctly, making it useable in the `de` +script. diff --git a/vim/de b/vim/de new file mode 100755 index 0000000..18f7acf --- /dev/null +++ b/vim/de @@ -0,0 +1,2 @@ +#!/usr/bin/env bash +docker run --rm -it -v "$1":/data -w '/data' chewingbever/nvim:latest diff --git a/vim/init.vim b/vim/init.vim new file mode 100644 index 0000000..c4c5917 --- /dev/null +++ b/vim/init.vim @@ -0,0 +1,47 @@ +let g:mapleader = ' ' + +set splitbelow splitright +set expandtab tabstop=4 shiftwidth=4 +set incsearch smartcase nohlsearch +set swapfile directory=~/.vim/swap// +set undofile undodir=~/.vim/undo// + +nnoremap j jzz +nnoremap k kzz +nnoremap gg ggzz +nnoremap G Gzz + +nnoremap h :wincmd h +nnoremap j :wincmd j +nnoremap k :wincmd k +nnoremap l :wincmd l + +nnoremap :resize +3 +nnoremap :resize -3 +nnoremap :vertical resize +3 +nnoremap :vertical resize -3 + +inoremap jk +inoremap + +nnoremap a + +tnoremap jk + +nnoremap rr :terminal +nnoremap rh :vsp:wincmd h:term +nnoremap rl :vsp:term +nnoremap rk :sp:wincmd k:term +nnoremap rj :sp:term + +function! ToggleLineNumbers() + if &number + set nonumber + set norelativenumber + else + set number + set relativenumber + endif +endfunction + +nnoremap L :call ToggleLineNumbers()