Skip to content

Instantly share code, notes, and snippets.

@Kiwi

Kiwi/neovim.nix Secret

Created July 30, 2020 00:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Kiwi/238735923fcda195a0707a044acd82dc to your computer and use it in GitHub Desktop.
Save Kiwi/238735923fcda195a0707a044acd82dc to your computer and use it in GitHub Desktop.
neovim.nix
{ pkgs, lib, ... }:
with import (./tricky-channels.nix);
let
customPlugins.vim-sml = unstable.vimUtils.buildVimPlugin {
pname = "vim-sml";
version = "2013-10-23";
src = unstable.fetchFromGitHub {
owner = "cypok";
repo = "vim-sml";
rev = "4c4d59b3fb92ba6cfaf955432e214bda639e7621";
sha256 = "10s30inpfiavvzskkk2av4wbdli1mp92zd55p69577ynskz8hq4y";
};
};
customPlugins.vim-better-sml = unstable.vimUtils.buildVimPlugin {
pname = "vim-better-sml";
version = "2019-08-25";
src = unstable.fetchFromGitHub {
owner = "jez";
repo = "vim-better-sml";
rev = "1f36431290690f66c9de8316821edff605421dd5";
sha256 = "0v5wbbjxz7k3ifpnl5l06zkwp3wfcs52bzwhs9i89f9g1wkkgq74";
};
buildInputs = with pkgs; [ mlton ];
};
customPlugins.ats-vim = unstable.vimUtils.buildVimPlugin {
pname = "ats-vim";
version = "2019-10-21";
src = unstable.fetchFromGitHub {
owner = "vmchale";
repo = "ats-vim";
rev = "a17576687217a2e8066356cc211afb99b5de65e8";
sha256 = "0dv60za39v2w5d9mbk1r263fqpv11bdfyqp39b0snw40f0kh92z0";
};
};
in
{
imports = [ ];
environment.systemPackages = with pkgs; [
smlnj
mlton
(unstable.vim_configurable.customize {
name = "vim";
vimrcConfig.vam.knownPlugins = unstable.vimPlugins // customPlugins;
vimrcConfig.vam.pluginDictionaries = [
# vim-nix handles indentation better but does not perform sanity
{
names = [ "vim-addon-nix" ];
ft_regex = "^nix$";
}
{
names = [
"LanguageClient-neovim"
"tlib"
"direnv-vim"
"fzf-vim"
"fzfWrapper"
"ranger-vim"
"typescript-vim"
"vim-better-whitespace"
"vim-trailing-whitespace"
"vim-sml"
"vim-better-sml"
"vim-ledger"
"ats-vim"
"ale"
#"nerdtree"
#"nerdtree-git-plugin"
];
}
];
vimrcConfig.customRC = ''
" activates filetype detection
filetype plugin indent on
" activates syntax highlighting among other things
syntax on
" allows you to deal with multiple unsaved
" buffers simultaneously without resorting
" to misusing tabs
set hidden
" just hit backspace without this one and
" see for yourself
set backspace=indent,eol,start
" highlight white space
:highlight ExtraWhitespace ctermbg=red guibg=red
:match ExtraWhitespace /\s\+$/
" highlight white space
:highlight ExtraWhitespace ctermbg=red guibg=red
:match ExtraWhitespace /\s\+$/
" remove white space
:nnoremap <silent> <F5> :let _s=@/ <Bar> :%s/\s\+$//e <Bar> :let @/=_s <Bar> :nohl <Bar> :unlet _s <CR>
let g:LanguageClient_serverCommands = { 'haskell': ['hie-wrapper'] }
nnoremap <F4> :call LanguageClient_contextMenu()<CR>
map <Leader>lk :call LanguageClient#textDocument_hover()<CR>
map <Leader>lg :call LanguageClient#textDocument_definition()<CR>
map <Leader>lr :call LanguageClient#textDocument_rename()<CR>
map <Leader>lf :call LanguageClient#textDocument_formatting()<CR>
map <Leader>lb :call LanguageClient#textDocument_references()<CR>
map <Leader>la :call LanguageClient#textDocument_codeAction()<CR>
map <Leader>ls :call LanguageClient#textDocument_documentSymbol()<CR>
'';
})
(unstable.neovim.override {
# vimAlias = true;
configure = {
customRC = ''
if filereadable($HOME . "/.vimrc")
source ~/.vimrc
endif
'';
# let $RUST_SRC_PATH = '${
# pkgs.stdenv.mkDerivation {
# inherit (unstable.pkgs.rustc) src;
# inherit (unstable.pkgs.rustc.src) name;
# phases = [ "unpackPhase" "installPhase" ];
# installPhase = "cp -r src $out";
# }
# }'
packages.myVimPackage = with unstable.vimPlugins // customPlugins; {
# see examples below how to use custom packages
start = [
vim-addon-nix
LanguageClient-neovim
tlib
direnv-vim
fzf-vim
fzfWrapper
ranger-vim
typescript-vim
vim-better-whitespace
vim-trailing-whitespace
vim-sml
vim-better-sml
vim-ledger
ats-vim
ale
# nvim-completion-manager
# nvim-cm-racer
];
opt = [ ];
};
};
})
];
}
with import <nixpkgs> { };
{
unstable = import (fetchTarball "channel:nixos-unstable") { config = { allowUnfree = true; }; };
nixos-2003 = import (fetchTarball "channel:nixos-20.03") { config = { allowUnfree = true; }; };
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment