From 10f27ee8bd7a7f56f634dc8ea2bc4d40db9e655a Mon Sep 17 00:00:00 2001 From: jeschli Date: Tue, 23 Jan 2018 19:35:46 +0100 Subject: j vim: refactoring --- jeschli/2configs/vim.nix | 148 +++++++++++++++++++++++++++++------------------ 1 file changed, 92 insertions(+), 56 deletions(-) diff --git a/jeschli/2configs/vim.nix b/jeschli/2configs/vim.nix index 1a2231a86..65ce7dfa4 100644 --- a/jeschli/2configs/vim.nix +++ b/jeschli/2configs/vim.nix @@ -1,5 +1,6 @@ { config, pkgs, ... }: +with import ; let customPlugins.vim-javascript = pkgs.vimUtils.buildVimPlugin { name = "vim-javascript"; @@ -16,72 +17,76 @@ let owner = "mxw"; repo = "vim-jsx"; rev = "5b968dfa512c57c38ad7fe420f3e8ab75a73949a"; - sha256 = "1z3yhhbmbzfw68qjzyvpbmlyv2a1p814sy5q2knn04kcl30vx94a"; + sha256 = "1z3yhhbmbzfw68qjzyvpbmlyv2a1p814sy5q2knn04kcl30vx94a"; }; }; in { -# { environment.systemPackages = [ (pkgs.vim_configurable.customize { name = "vim"; - - vimrcConfig.customRC = '' - set nocompatible - - :imap jk - :vmap v v - :map gr :GoRun - :nnoremap :bnext - :nnoremap - :map nf :NERDTreeToggle - set autowrite - set number - set ruler - set path+=** - set wildmenu - - noremap x "_x - set clipboard=unnamedplus - - let g:jsx_ext_required = 0 - - let g:go_list_type = "quickfix" - let g:go_test_timeout = '10s' - let g:go_fmt_command = "goimports" - let g:go_snippet_case_type = "camelcase" - let g:go_highlight_types = 1 - let g:go_highlight_fields = 1 - let g:go_highlight_functions = 1 - let g:go_highlight_methods = 1 - let g:go_highlight_extra_types = 1 - autocmd BufNewFile,BufRead *.go setlocal noexpandtab tabstop=4 shiftwidth=4 - let g:rehash256 = 1 - let g:molokai_original = 1 - colorscheme molokai - let g:go_metalinter_enabled = ['vet', 'golint', 'errcheck'] - let g:go_metalinter_autosave = 1 - " let g:go_metalinter_autosave_enabled = ['vet', 'golint'] - " let g:go_def_mode = 'godef' - " let g:go_decls_includes = "func,type" - - - " Trigger configuration. Do not use if you use https://github.com/Valloric/YouCompleteMe. - let g:UltiSnipsExpandTrigger="" - let g:UltiSnipsJumpForwardTrigger="" - let g:UltiSnipsJumpBackwardTrigger="" - - " If you want :UltiSnipsEdit to split your window. - let g:UltiSnipsEditSplit="vertical" - - if has('persistent_undo') "check if your vim version supports it - set undofile "turn on the feature - set undodir=$HOME/.vim/undo "directory where the undo files will be stored - endif + vimrcConfig.customRC = let + colorscheme = ''colorscheme molokai''; + setStatements = '' + set autowrite + set clipboard=unnamedplus + set nocompatible + set path+=** + set ruler + set undodir=$HOME/.vim/undo "directory where the undo files will be stored + set undofile "turn on the feature + set wildignore+=*.o,*.class,*.hi,*.dyn_hi,*.dyn_o + set wildmenu + set listchars=trail:ΒΆ + ''; + remapStatements = '' + imap jk + map gr :GoRun " Map gr to execute go run + map nf :NERDTreeToggle + nnoremap + nnoremap :bnext + noremap x "_x + vmap v v + ''; + settingsForGo = '' + let g:go_decls_includes = "func,type" + let g:go_def_mode = 'godef' + let g:go_fmt_command = "goimports" + let g:go_highlight_extra_types = 1 + let g:go_highlight_fields = 1 + let g:go_highlight_functions = 1 + let g:go_highlight_methods = 1 + let g:go_highlight_types = 1 + let g:go_list_type = "quickfix" + let g:go_metalinter_autosave = 1 + let g:go_metalinter_enabled = ['vet', 'golint', 'errcheck'] + let g:go_snippet_case_type = "camelcase" + let g:go_test_timeout = '10s' + let g:jsx_ext_required = 0 + let g:molokai_original = 1 + let g:rehash256 = 1 ''; + in '' + ${colorscheme} + ${remapStatements} + ${setStatements} + ${settingsForGo} + " I dont know what this line is about + autocmd BufNewFile,BufRead *.go setlocal noexpandtab tabstop=4 shiftwidth=4 + ''; vimrcConfig.vam.knownPlugins = pkgs.vimPlugins // customPlugins; vimrcConfig.vam.pluginDictionaries = [ - { names = [ "undotree" "molokai" "Syntastic" "ctrlp" "surround" "snipmate" "nerdtree" "easymotion"]; } + { names = [ + "ctrlp" + "easymotion" + "molokai" + "nerdtree" + "snipmate" + "surround" + "Syntastic" + "undotree" + ]; + } { names = [ "vim-addon-nix" ]; ft_regex = "^nix\$"; } { names = [ "vim-go" ]; ft_regex = "^go\$"; } # wanted: nsf/gocode { names = [ "vim-javascript" ]; ft_regex = "^js\$"; } @@ -89,4 +94,35 @@ in { ]; }) ]; + + # set up the directories up if they are not there. +# Needs to be changed. +# vim = let +# dirs = { +# backupdir = "$HOME/.cache/vim/backup"; +# swapdir = "$HOME/.cache/vim/swap"; +# undodir = "$HOME/.cache/vim/undo"; +# }; +# files = { +# viminfo = "$HOME/.cache/vim/info"; +# }; +# +# mkdirs = let +# dirOf = s: let out = concatStringsSep "/" (init (splitString "/" s)); +# in assert out != ""; out; +# alldirs = attrValues dirs ++ map dirOf (attrValues files); +# in unique (sort lessThan alldirs); +# in +# pkgs.symlinkJoin { +# name = "vim"; +# paths = [ +# (pkgs.writeDashBin "vim" '' +# set -efu +# (umask 0077; exec ${pkgs.coreutils}/bin/mkdir -p ${toString mkdirs}) +# exec ${pkgs.vim}/bin/vim "$@" +# '') +# pkgs.vim +# ]; +# }; + } -- cgit v1.2.3 From dcae1c81a715081dfbf9b06b40c1ac78c2438a02 Mon Sep 17 00:00:00 2001 From: jeschli Date: Tue, 23 Jan 2018 19:40:10 +0100 Subject: jeschli brauerei: +aliases --- jeschli/1systems/brauerei/config.nix | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/jeschli/1systems/brauerei/config.nix b/jeschli/1systems/brauerei/config.nix index 2dec45795..e4109c638 100644 --- a/jeschli/1systems/brauerei/config.nix +++ b/jeschli/1systems/brauerei/config.nix @@ -35,6 +35,13 @@ time.timeZone = "Europe/Amsterdam"; nixpkgs.config.allowUnfree = true; # List packages installed in system profile. To search by name, run: # $ nix-env -qaP | grep wget + environment.shellAliases = { + n = "nix-shell"; + stocki = pkgs.writeDash "deploy" '' + cd ~/stockholm + exec nix-shell -I stockholm="$PWD" --run 'deploy --system="brauerei"' + ''; + }; environment.systemPackages = with pkgs; [ # system helper ag -- cgit v1.2.3