overlays-personal/pkgs/vim/default.nix

289 lines
7.8 KiB
Nix
Raw Normal View History

2018-02-20 12:27:46 +01:00
{ pkgs
2020-03-05 18:25:48 +01:00
, extraPlugins ? []
, extraOptions ? ""
2018-02-20 12:27:46 +01:00
, ...
}:
# At first, largely adapted from:
# https://www.mpscholten.de/nixos/2016/04/11/setting-up-vim-on-nixos.html
# Changed quite a bit since
with pkgs;
let
plugins = let inherit (vimUtils) buildVimPluginFrom2Nix; in {
2020-06-05 10:00:11 +02:00
"vim-hcl" = buildVimPluginFrom2Nix { # created by nix#NixDerivation
name = "vim-hcl";
src = fetchgit {
url = "git://github.com/jvirtanen/vim-hcl";
rev = "c64a006facad8c3cc0f16ba324e63524932a96e7";
sha256 = "0547xgbk725rnib8ka775a8r57dlywkyw1kjwma78n93h64dwnlr";
};
dependencies = [];
};
2018-02-20 12:27:46 +01:00
"systemd-syntax" = buildVimPluginFrom2Nix { # created by nix#NixDerivation
name = "systemd-syntax";
src = fetchgit {
url = "git://github.com/Matt-Deacalion/vim-systemd-syntax";
2020-03-04 19:49:21 +01:00
rev = "394a516f524e74ac8808ede1496b25d8b9824827";
sha256 = "0fqk5fxrdf8nazic244ia4bi75midmpj896vdkdmxnv563lnhkcy";
2018-02-20 12:27:46 +01:00
};
dependencies = [];
};
"opencl-syntax" = buildVimPluginFrom2Nix { # created by nix#NixDerivation
name = "opencl-syntax";
src = fetchgit {
url = "git://github.com/petRUShka/vim-opencl";
2020-03-04 19:49:21 +01:00
rev = "7668b018fe9461c6b51e0b736ed84aa84d6bafce";
sha256 = "0z8qasymkkaa272bjxmkp4sgd8qr4ypcqxlyzxgh5imp3gmrc6n1";
2018-02-20 12:27:46 +01:00
};
dependencies = [];
};
"vim-gnupg" = buildVimPluginFrom2Nix { # created by nix#NixDerivation
name = "vim-gnupg";
src = fetchFromGitHub {
owner = "jamessan";
repo = "vim-gnupg";
2020-03-04 19:49:21 +01:00
rev = "f663d0e857bd88cb39c16ca45c37a27488648562";
sha256 = "0y0g3br54sj0h8s6ashny2km2260qw8psqxq00jn0l2chjwsi0d9";
2018-02-20 12:27:46 +01:00
};
dependencies = [];
};
2019-10-08 17:15:39 +02:00
vim-timedot = buildVimPluginFrom2Nix {
2019-10-08 17:06:41 +02:00
pname = "vim-timedot";
2019-10-08 17:15:39 +02:00
version = "2019-10-08";
2019-10-08 17:06:41 +02:00
src = fetchFromGitHub {
2019-10-08 17:15:39 +02:00
owner = "jpotier";
2019-10-08 17:06:41 +02:00
repo = "vim-timedot";
2019-10-08 17:15:39 +02:00
rev = "ab48ee1002e25ae705dd84bb3db8b88bb0c2dc93";
sha256 = "0vgga3fmppb71apd31bwji98d62vs1p77c1hssshmh2fc7yck6s8";
2019-10-08 17:06:41 +02:00
};
};
2020-07-22 14:38:51 +02:00
vim-selinux = buildVimPluginFrom2Nix {
name = "vim-selinux";
src = fetchFromGitHub {
owner = "lzap";
repo = "vim-selinux";
rev = "735743a3539431c33824cb432b92267a0fc82251";
sha256 = "16pk2zscyiayfccn760p2zki4cjfhp26bikisgswjg900zwr5yns";
};
};
vim-neuron = buildVimPluginFrom2Nix {
name = "vim-neuron";
src = fetchFromGitHub {
owner = "fiatjaf";
repo = "neuron.vim";
2020-11-26 10:14:35 +01:00
rev = "853fbe273f9f40defe69a9d50d267fee1bbc6b5a";
sha256 = "0l6qxmd1y67jam8np37ywks95nbs53bvmh51y4ak4078mz2n1nji";
};
};
2020-04-22 10:34:33 +02:00
vim-lilypond = buildVimPluginFrom2Nix { # created by nix#NixDerivation
name = "vim-lilypond";
src = "${pkgs.lilypond.outPath}/share/lilypond/${pkgs.lilypond.version}/vim";
dependencies = [];
};
2018-02-20 12:27:46 +01:00
}; in vim_configurable.customize {
name = "vim";
vimrcConfig.packages.myVimPackage = with pkgs.vimPlugins; with plugins; {
# loaded on launch
start = [
calendar-vim
dhall-vim
2020-03-31 10:23:08 +02:00
editorconfig-vim
2018-02-20 12:27:46 +01:00
fzf-vim
fzfWrapper
2020-05-01 09:08:42 +02:00
goyo
2019-11-04 14:09:59 +01:00
gundo
2018-02-20 12:27:46 +01:00
nerdtree
2020-03-04 19:49:21 +01:00
opencl-syntax
2018-02-20 12:27:46 +01:00
repeat
surround
systemd-syntax
2019-04-29 12:53:20 +02:00
vim-abolish
2018-02-20 12:27:46 +01:00
vim-airline
vim-airline-themes
2019-02-24 13:54:00 +01:00
vim-better-whitespace
2018-02-20 12:27:46 +01:00
vim-gnupg
2020-06-05 10:00:11 +02:00
vim-hcl
2019-02-24 13:54:00 +01:00
vim-ledger
2020-04-22 10:34:33 +02:00
vim-lilypond
vim-neuron
2018-02-20 12:27:46 +01:00
vim-nix
vim-orgmode
2020-07-22 14:38:51 +02:00
vim-selinux
2020-03-04 19:49:21 +01:00
vim-speeddating
2018-03-20 14:00:44 +01:00
vim-terraform
2019-10-08 17:06:41 +02:00
vim-timedot
2018-02-20 12:27:46 +01:00
vimtex
2020-03-05 18:28:57 +01:00
] ++ extraPlugins;
2018-02-20 12:27:46 +01:00
# manually loadable by calling `:packadd $plugin-name`
opt = [
];
# To automatically load a plugin when opening a filetype, add vimrc lines like:
# autocmd FileType php :packadd phpCompletion
};
vimrcConfig.customRC = ''
" Must have for vim
set nocompatible
" Display nbsp
set listchars=tab:\|\ ,nbsp:·
set list
" Remap ESC on ,,
map ,, <ESC>
imap ,, <ESC>
scriptencoding utf-8
" Must be *after* pathogen (not using pathogen anymore)
filetype plugin indent on
" Leader
let mapleader=","
nnoremap <leader>a :echo("\<leader\> works! It is set to <leader>")<CR>
" let maplocalleader = "-"
" Highlighting
syntax enable
if has('gui_running')
" When gui is running, it pretty much sets its own colors
2019-07-13 10:51:16 +02:00
set guifont=Victor\ Mono\ 14
2018-05-13 19:21:04 +02:00
set notitle
set guioptions=a
2018-02-20 12:27:46 +01:00
else
" If we're in a terminal, then we stay default, terminal will choose
" which colors it likes.
endif
" Set line numbering
set number
" Don't wrap lines, it's ugly
set nowrap
" Deal with tabs
set softtabstop=2
set tabstop=2 " 1 tab = 2 spaces
set shiftwidth=2 " Indent with 2 spaces
set expandtab " Insert spaces instead of tabs
" Set par as default wrapper
set formatprg=${par.outPath}/bin/par\ -w80
" Set mouse on
set mouse=a
" Don't set timeout - this breaks the leader use
set notimeout
set ttimeout
" Color lines in a different shade up to 80 columns
let &colorcolumn=join(range(81,999),",")
" automatically jump to the end of the text you just copied/pasted:
xnoremap <silent> y y`]
nnoremap <silent> yy yy`]
xnoremap <silent> p p`]
xnoremap <silent> P P`]
nnoremap <silent> p p`]
nnoremap <silent> P P`]
" vimtex options
let g:vimtex_fold_enabled=1
let g:vimtex_fold_manual=1
let g:vimtex_compiler_enabled=0
2020-08-07 11:07:40 +02:00
let g:tex_flavor = 'latex'
2018-02-20 12:27:46 +01:00
" conceal to unicode symbols
nnoremap <leader>l :silent let &conceallevel = (&conceallevel+1)%4<CR>
2019-07-23 17:59:01 +02:00
set conceallevel=0
2018-02-20 12:27:46 +01:00
set concealcursor=nvc
let g:tex_conceal="abdmgs"
" nice pluginless stuff
set path+=**
set wildmenu
" Tag generation
2020-03-28 11:47:31 +01:00
command! MakeTags !${universal-ctags}/bin/ctags -R .
2018-02-20 12:27:46 +01:00
" Less noise in netrw
let g:netrw_altv=1
let g:netrw_banner=0
let g:netrw_browse_split=4
let g:netrw_list_hide=netrw_gitignore#Hide()
let g:netrw_list_hide.=',\(^\|\s\s\)\zs\.\S\+'
let g:netrw_liststyle=3
let g:netrw_winsize=25
" Normal backspace
set backspace=indent,eol,start
" Set filetype tex for tikz files
au BufNewFile,BufRead *.tikz set filetype=tex
" Thx Mats for the following
:cnoremap <C-A> <Home>
:cnoremap <C-B> <Left>
:cnoremap <C-F> <Right>
:cnoremap <C-E> <End>
" NERDTree when starting
"autocmd vimenter * NERDTree
let g:NERDTreeDirArrowExpandable = '+'
let g:NERDTreeDirArrowCollapsible = '-'
2018-08-24 11:37:58 +02:00
2018-12-05 12:20:06 +01:00
" SmartCase (only search by case if capital letter is used)
2018-08-24 11:37:58 +02:00
set ignorecase
set smartcase
2018-12-05 12:20:06 +01:00
" Allow for more than 10 tabs to be opened at once
set tabpagemax=40
2019-07-13 10:10:25 +02:00
" Help ledger
2019-07-13 10:34:26 +02:00
let g:ledger_bin = '${hledger}/bin/hledger'
let g:ledger_extra_options = '--pedantic --explicit --check-payees'
2019-09-05 14:25:14 +02:00
" Virtual Edit maaan
set ve=block
2020-03-05 18:33:06 +01:00
2020-11-24 09:20:33 +01:00
" Read Vagrantfile as ruby source
2020-11-26 16:00:03 +01:00
augroup vagrant
au!
au BufRead,BufNewFile Vagrantfile set filetype=ruby
augroup END
2020-11-26 10:20:48 +01:00
2020-03-05 18:33:06 +01:00
" Extra options
${extraOptions}
'';
2018-02-20 12:27:46 +01:00
}
2020-10-31 18:25:45 +01:00
# " vimwiki stuff
# " let g:vimwiki_global_ext = 0
# " let g:vimwiki_conceallevel = 0
# " let g:vimwiki_auto_chdir = 1
# " let g:vimwiki_list = [
# " \{'path': '~/zk/'},
# " \{'path': '~/vimwiki/personal.wiki'}
# " \]
# " :autocmd FileType vimwiki map <leader>d :VimwikiMakeDiaryNote
# " :autocmd FileType vimwiki Goyo 80x20
# "
# " function! ToggleCalendar()
# " execute ":Calendar"
# " if exists("g:calendar_open")
# " if g:calendar_open == 1
# " execute "q"
# " unlet g:calendar_open
# " else
# " g:calendar_open = 1
# " end
# " else
# " let g:calendar_open = 1
# " end
# " endfunction
# " :autocmd FileType vimwiki map <leader>c :call ToggleCalendar()