Added neovim container

pull/3/head
Jef Roosens 2021-01-26 16:40:58 +01:00
parent 0128dce6f6
commit cc754571de
4 changed files with 73 additions and 0 deletions

6
vim/Dockerfile 100644
View File

@ -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

18
vim/README.md 100644
View File

@ -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.

2
vim/de 100755
View File

@ -0,0 +1,2 @@
#!/usr/bin/env bash
docker run --rm -it -v "$1":/data -w '/data' chewingbever/nvim:latest

47
vim/init.vim 100644
View File

@ -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 <silent> <leader>h :wincmd h<CR>
nnoremap <silent> <leader>j :wincmd j<CR>
nnoremap <silent> <leader>k :wincmd k<CR>
nnoremap <silent> <leader>l :wincmd l<CR>
nnoremap <silent> <Up> :resize +3<CR>
nnoremap <silent> <Down> :resize -3<CR>
nnoremap <silent> <Right> :vertical resize +3<CR>
nnoremap <silent> <Left> :vertical resize -3<CR>
inoremap jk <Esc>
inoremap <Esc> <nop>
nnoremap <leader>a <C-^>
tnoremap <silent> jk <C-\><C-n>
nnoremap <silent> <leader>rr :terminal<CR>
nnoremap <silent> <leader>rh :vsp<CR>:wincmd h<CR>:term<CR>
nnoremap <silent> <leader>rl :vsp<CR>:term<CR>
nnoremap <silent> <leader>rk :sp<CR>:wincmd k<CR>:term<CR>
nnoremap <silent> <leader>rj :sp<CR>:term<CR>
function! ToggleLineNumbers()
if &number
set nonumber
set norelativenumber
else
set number
set relativenumber
endif
endfunction
nnoremap <silent> <leader>L :call ToggleLineNumbers()<CR>