From f2bce08b9412b0b50d3d7af8dff7903b40f13bff Mon Sep 17 00:00:00 2001 From: Ben Sima Date: Tue, 11 Jun 2019 13:40:01 -0700 Subject: migrate vim to use home-manager settings --- vim.nix | 16 ++++++++++++++++ vimrc | 35 ++++++++++++++++++++++++++++++++++- 2 files changed, 50 insertions(+), 1 deletion(-) create mode 100644 vim.nix diff --git a/vim.nix b/vim.nix new file mode 100644 index 0000000..57f79ba --- /dev/null +++ b/vim.nix @@ -0,0 +1,16 @@ +{ ... }: + +{ + programs.vim = { + enable = true; + plugins = [ + "ctrlp" + "fugitive" + "editorconfig-vim" + "surround" + "vim-colorschemes" + "vim-ripgrep" + ]; + extraConfig = builtins.readFile ../vimrc; + }; +} diff --git a/vimrc b/vimrc index 4c51ef1..5da401c 100644 --- a/vimrc +++ b/vimrc @@ -30,11 +30,34 @@ if has('syntax') && !exists('g:syntax_on') syntax enable endif -""" Mappings +""" Simple Mappings +let maplocalleader = "," + +" easy escape imap fd + " send to ix.io noremap i :w !ix +" edit files and buffers, relative to local +nmap ,e :edit +nmap ;e :edit =expand("%:h") . "/" +nmap ,o :buffer +nmap ;o :buffer =expand("%:h") . "/" + +" list buffers +nmap ,l :ls + +" delete buffer +nmap ,u :bdelete + +" ,d insert current date +nmap ,d :r !date +\%Y.\%m.\%d +nmap ,D :r !date +\%Y.\%m.\%d..\%H.\%M.\%S + +" grep (ripgrep) +nmap ,g :Rg + " Use to clear the highlighting of :set hlsearch. if maparg('', 'n') ==# '' nnoremap :nohlsearch=has('diff')?'diffupdate':'' @@ -59,3 +82,13 @@ map :vsp :exec("tag ".expand("")) set termguicolors let &t_8f = "\[38;2;%lu;%lu;%lum" let &t_8b = "\[48;2;%lu;%lu;%lum" + +""" Plugins with vim-plug +" 2019.06.11: disabling b/c I'd rather just use nix/home-manager for vim +" plugins, but this is nice code to have for reference too +"if empty(glob('~/.vim/autoload/plug.vim')) +" silent !curl -fLo ~/.vim/autoload/plug.vim --create-dirs +" \ https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim +" autocmd VimEnter * PlugInstall --sync | source $MYVIMRC +"endif +"so ~/.vim/plugins.vim -- cgit v1.2.3