From 072be0befdf80e63d49557acde954853ffecba92 Mon Sep 17 00:00:00 2001 From: William Carroll Date: Wed, 12 Feb 2020 18:05:32 +0000 Subject: Nixify simple_vim idea I previously had an alias defined as `simple_vim`, which would start an instance of Vim with a bare bones config. I had a to-do to Nixify it. That is now (mostly) to-done. When I try and install it with `nix-env -f ~/briefcase -iA tools.simple_vim`, Nix fails and says that pkgs.stdenv is undefined. I will need to fix this one day, but it is neither important nor urgent... --- configs/shared/.config/nvim/simple.vim | 98 ---------------------------------- tools/simple_vim/config.vim | 98 ++++++++++++++++++++++++++++++++++ tools/simple_vim/default.nix | 10 ++++ 3 files changed, 108 insertions(+), 98 deletions(-) delete mode 100644 configs/shared/.config/nvim/simple.vim create mode 100644 tools/simple_vim/config.vim create mode 100644 tools/simple_vim/default.nix diff --git a/configs/shared/.config/nvim/simple.vim b/configs/shared/.config/nvim/simple.vim deleted file mode 100644 index ea40964ee803..000000000000 --- a/configs/shared/.config/nvim/simple.vim +++ /dev/null @@ -1,98 +0,0 @@ -" My barebones vimrc without any Vundle dependencies. -" -" I'm attempting to optimize the following: -" - Minimize dependencies -" - Maximize ergonomics -" - Maximize Tmux compatibility -" - Minimize shadowing of existing Vim KBDs -" -" Warning: This is currently unstable as it is a work-in-progress. -" -" Author: William Carroll - -" Use as the leader key. -let mapleader = " " -nnoremap ev :tabnew:edit ~/.vimrc -nnoremap sv :source ~/.vimrc -nnoremap w :w -nnoremap h :help - -" increment,decrement numbers -nnoremap + -" TODO: Restore with better KBD -" nnoremap - - -" Visit the CWD -nnoremap - :e . - -" Turn line numbers on. -set number - -" Easily create vertical, horizontal window splits. -nnoremap sh :vsplit -nnoremap sj :split:wincmd j -nnoremap sk :split -nnoremap sl :vsplit:wincmd l - -" Move across window splits. -" TODO: Change to . -nnoremap :wincmd h -nnoremap :wincmd j -nnoremap :wincmd k -nnoremap :wincmd l - -" TODO: Support these. -" nnoremap :q -" nnoremap :wincmd h -" nnoremap :wincmd j -" nnoremap :wincmd k -" nnoremap :wincmd l - -" Use instead of G to support: -" 20 - to jump to line 20 -" d20 - to delete from the current line until line 20 -" 20 - to select from the current line until line 20 -nnoremap G -onoremap G -vnoremap G - -" Easily change modes on keyboards that don't have CapsLock mapped to -inoremap jk - -" CRUD tabs. -nnoremap :tabnext -nnoremap :tabprevious -nnoremap :tabnew:edit . -nnoremap :tabclose -" TODO: Re-enable these once are supported. -" nnoremap :+tabmove -" nnoremap :-tabmove - -" Use H,L to goto beggining,end of a line. -" Swaps the keys to ensure original functionality of H,L are preserved. -nnoremap H ^ -nnoremap L $ -nnoremap ^ H -nnoremap $ L - -" Use H,L in visual mode too -vnoremap H ^ -vnoremap L $ -vnoremap ^ H -vnoremap $ L - -" Emacs hybrid mode -" TODO: model this after tpope's rsi.vim (Readline-style insertion) -cnoremap -cnoremap -inoremap ^ -inoremap $ -inoremap h -inoremap l - -" Indenting -" The following three settings are based on option 2 of `:help tabstop` -set tabstop=4 -set shiftwidth=4 -set expandtab -set autoindent diff --git a/tools/simple_vim/config.vim b/tools/simple_vim/config.vim new file mode 100644 index 000000000000..ea40964ee803 --- /dev/null +++ b/tools/simple_vim/config.vim @@ -0,0 +1,98 @@ +" My barebones vimrc without any Vundle dependencies. +" +" I'm attempting to optimize the following: +" - Minimize dependencies +" - Maximize ergonomics +" - Maximize Tmux compatibility +" - Minimize shadowing of existing Vim KBDs +" +" Warning: This is currently unstable as it is a work-in-progress. +" +" Author: William Carroll + +" Use as the leader key. +let mapleader = " " +nnoremap ev :tabnew:edit ~/.vimrc +nnoremap sv :source ~/.vimrc +nnoremap w :w +nnoremap h :help + +" increment,decrement numbers +nnoremap + +" TODO: Restore with better KBD +" nnoremap - + +" Visit the CWD +nnoremap - :e . + +" Turn line numbers on. +set number + +" Easily create vertical, horizontal window splits. +nnoremap sh :vsplit +nnoremap sj :split:wincmd j +nnoremap sk :split +nnoremap sl :vsplit:wincmd l + +" Move across window splits. +" TODO: Change to . +nnoremap :wincmd h +nnoremap :wincmd j +nnoremap :wincmd k +nnoremap :wincmd l + +" TODO: Support these. +" nnoremap :q +" nnoremap :wincmd h +" nnoremap :wincmd j +" nnoremap :wincmd k +" nnoremap :wincmd l + +" Use instead of G to support: +" 20 - to jump to line 20 +" d20 - to delete from the current line until line 20 +" 20 - to select from the current line until line 20 +nnoremap G +onoremap G +vnoremap G + +" Easily change modes on keyboards that don't have CapsLock mapped to +inoremap jk + +" CRUD tabs. +nnoremap :tabnext +nnoremap :tabprevious +nnoremap :tabnew:edit . +nnoremap :tabclose +" TODO: Re-enable these once are supported. +" nnoremap :+tabmove +" nnoremap :-tabmove + +" Use H,L to goto beggining,end of a line. +" Swaps the keys to ensure original functionality of H,L are preserved. +nnoremap H ^ +nnoremap L $ +nnoremap ^ H +nnoremap $ L + +" Use H,L in visual mode too +vnoremap H ^ +vnoremap L $ +vnoremap ^ H +vnoremap $ L + +" Emacs hybrid mode +" TODO: model this after tpope's rsi.vim (Readline-style insertion) +cnoremap +cnoremap +inoremap ^ +inoremap $ +inoremap h +inoremap l + +" Indenting +" The following three settings are based on option 2 of `:help tabstop` +set tabstop=4 +set shiftwidth=4 +set expandtab +set autoindent diff --git a/tools/simple_vim/default.nix b/tools/simple_vim/default.nix new file mode 100644 index 000000000000..7ea0b5ebc8a1 --- /dev/null +++ b/tools/simple_vim/default.nix @@ -0,0 +1,10 @@ +{ pkgs ? import {}, ... }: + +let + script = pkgs.writeShellScriptBin "simple_vim" '' + ${pkgs.vim}/bin/vim -u ${./config.vim} + ''; +in pkgs.stdenv.mkDerivation { + name = "simple_vim"; + buildInputs = [ script ]; +} -- cgit 1.4.1