diff --git a/derivations/dev/go.nix b/derivations/dev/go.nix index f429511..fb9c859 100644 --- a/derivations/dev/go.nix +++ b/derivations/dev/go.nix @@ -7,6 +7,53 @@ }: let go = builtins.getAttr "go_${version}" pkgs; + commonVimRC = '' + let g:tagbar_type_go = { + \ 'ctagstype' : 'go', + \ 'kinds' : [ + \ 'p:package', + \ 'i:imports:1', + \ 'c:constants', + \ 'v:variables', + \ 't:types', + \ 'n:interfaces', + \ 'w:fields', + \ 'e:embedded', + \ 'm:methods', + \ 'r:constructor', + \ 'f:functions' + \ ], + \ 'sro' : '.', + \ 'kind2scope' : { + \ 't' : 'ctype', + \ 'n' : 'ntype' + \ }, + \ 'scope2kind' : { + \ 'ctype' : 't', + \ 'ntype' : 'n' + \ }, + \ 'ctagsbin' : 'gotags', + \ 'ctagsargs' : '-sort -silent' + \ } + + " vim-go { + let g:go_highlight_functions = 1 + let g:go_highlight_methods = 1 + let g:go_highlight_structs = 1 + let g:go_highlight_interfaces = 1 + let g:go_highlight_operators = 1 + let g:go_highlight_build_constraints = 1 + let g:go_fmt_command = 'gofmt' + let g:go_fmt_options= '-s' + let g:go_def_mode = 'godef' + let g:go_def_reuse_buffer = 0 + + au FileType go nmap gds (go-def-split) + au FileType go nmap gdv (go-def-vertical) + au FileType go nmap gdt (go-def-tab) + au FileType go nmap gi (go-imports) + " } + ''; buildInputs = with pkgs; [ glibc.out glibc.static @@ -21,8 +68,8 @@ let gox.bin #ginkgo ginkgo.bin #gomega - (import ./vim-go.nix{inherit pkgs;}) - (import ./neovim-go.nix{inherit pkgs;}) + ( import ./vim-go.nix { pkgs=gitpkgs; commonRC=commonVimRC; } ) + ( import ./neovim-go.nix { pkgs=gitpkgs; commonRC=commonVimRC; } ) ]; in pkgs.stdenv.mkDerivation { diff --git a/derivations/dev/neovim-go.nix b/derivations/dev/neovim-go.nix index 88ff577..8b5e35d 100644 --- a/derivations/dev/neovim-go.nix +++ b/derivations/dev/neovim-go.nix @@ -1,192 +1,15 @@ -{ pkgs }: - pkgs.neovim.override { - vimAlias = false; - configure = { - # add custom .vimrc lines like this: - customRC = '' - set nocompatible +{ commonRC, ... } @ args : - " leader - let mapleader = ',' - - set hidden - syntax on - set hlsearch - set number - - " mappings to stop insert mode - imap jjj - imap kkk - imap lll - imap hhh - set scroll=11 - - noremap :tabn - noremap :tabp - let g:ctrlp_map = '' - set wildignore+=*/site/*,*.so,*.swp,*.zip - let g:ctrlp_custom_ignore = { - \ 'dir': '\v[\/]\.(git|hg|svn|)$$', - \ 'file': '\v\.(exe|so|dll)$$', - \ } - - "let g:ctrlp_match_func = { 'match': 'pymatcher#PyMatch' } - "let g:pydiction_location = '~/.vim/bundle/pydiction/complete-dict' - - " allways show status line - set ls=2 - set tabstop=4 - set shiftwidth=4 - set softtabstop=4 - set expandtab - "set textwidth=80 - - let g:tagbar_type_go = { - \ 'ctagstype' : 'go', - \ 'kinds' : [ - \ 'p:package', - \ 'i:imports:1', - \ 'c:constants', - \ 'v:variables', - \ 't:types', - \ 'n:interfaces', - \ 'w:fields', - \ 'e:embedded', - \ 'm:methods', - \ 'r:constructor', - \ 'f:functions' - \ ], - \ 'sro' : '.', - \ 'kind2scope' : { - \ 't' : 'ctype', - \ 'n' : 'ntype' - \ }, - \ 'scope2kind' : { - \ 'ctype' : 't', - \ 'ntype' : 'n' - \ }, - \ 'ctagsbin' : 'gotags', - \ 'ctagsargs' : '-sort -silent' - \ } - - " syntastic { - au FileType qf setlocal wrap linebreak - let g:syntastic_always_populate_loc_list = 1 - let g:syntastic_auto_loc_list = 0 - let g:syntastic_check_on_open = 1 - let g:syntastic_check_on_wq = 0 - if has("gui_running") - set mouse=a - else - set mouse= - endif - - set wildignore+=*/site/*,*.so,*.swp,*.zip - let g:ctrlp_custom_ignore = { - \ 'dir': '\v[\/]\.(git|hg|svn|)$$', - \ 'file': '\v\.(exe|so|dll)$$', - \ } - " } - - " spelling {{{ - au BufRead,BufNewFile *.md,*.markdown setlocal spell spelllang=en_us,de_de - " }}} - - " sync default register to clipboard { - if has('unnamedplus') - set clipboard=unnamedplus - else - set clipboard=unnamed - endif - " } - - " colored brackets { - let g:rbpt_colorpairs = [ - \ ['brown', 'RoyalBlue3'], - \ ['Darkblue', 'SeaGreen3'], - \ ['darkgray', 'DarkOrchid3'], - \ ['darkgreen', 'firebrick3'], - \ ['darkcyan', 'RoyalBlue3'], - \ ['darkred', 'SeaGreen3'], - \ ['darkmagenta', 'DarkOrchid3'], - \ ['brown', 'firebrick3'], - \ ['gray', 'RoyalBlue3'], - \ ['black', 'SeaGreen3'], - \ ['darkmagenta', 'DarkOrchid3'], - \ ['Darkblue', 'firebrick3'], - \ ['darkgreen', 'RoyalBlue3'], - \ ['darkcyan', 'SeaGreen3'], - \ ['darkred', 'DarkOrchid3'], - \ ['red', 'firebrick3'], - \ ] - let g:rbpt_max = 16 - let g:rbpt_loadcmd_toggle = 0 - - au VimEnter * RainbowParenthesesToggle - au Syntax * RainbowParenthesesLoadRound - au Syntax * RainbowParenthesesLoadSquare - au Syntax * RainbowParenthesesLoadBraces - " } - - set t_ut= - colorscheme PaperColor - - " Python {{{ - augroup ft_python - au! - au FileType python setlocal omnifunc=pythoncomplete#Complete - au FileType python setlocal define=^\s*\\(def\\\\|class\\) - augroup END - " }}} - - " YAML {{{ - augroup ft_yaml - au! - setlocal autoindent sw=2 et tabstop=2 shiftwidth=2 softtabstop=2 - augroup END - " }}} - - " vim-go { - let g:go_highlight_functions = 1 - let g:go_highlight_methods = 1 - let g:go_highlight_structs = 1 - let g:go_highlight_interfaces = 1 - let g:go_highlight_operators = 1 - let g:go_highlight_build_constraints = 1 - let g:go_fmt_command = 'gofmt' - let g:go_fmt_options= '-s' - let g:go_def_mode = 'godef' - let g:go_def_reuse_buffer = 0 - - au FileType go nmap gds (go-def-split) - au FileType go nmap gdv (go-def-vertical) - au FileType go nmap gdt (go-def-tab) - " } - - " deoplete { - let g:deoplete#enable_at_startup = 1 - let g:deoplete#enable_smart_case = 1 - " } - ''; - - vam.knownPlugins = pkgs.vimPlugins; # optional - vam.pluginDictionaries = [ # full ducomentation at github.com/MarcWeber/vim-addon-manager - "deoplete-go" - "deoplete-nvim" - "vim-go" - "vim-addon-vim2nix" - "vim-airline" - "vim-addon-nix" - "ctrlp" - "syntastic" - "vim-css-color" - "rainbow_parentheses" - "vim-colorschemes" - "vim-colorstepper" - "vim-signify" - ]; - }; - extraPythonPackages = with pkgs.python2Packages; [ - ]; - withPython3 = true; - } +(import ../../pkg-configuration/vim-derivates/neovim.nix args // { + additionalRC = commonRC + '' + " deoplete { + let g:deoplete#enable_at_startup = 1 + let g:deoplete#enable_smart_case = 1 + " } + ''; + additionalPlugins = [ + "deoplete-go" + "deoplete-nvim" + "vim-go" + ]; +}) diff --git a/derivations/dev/vim-go.nix b/derivations/dev/vim-go.nix index 1ff0c9a..4fadf04 100644 --- a/derivations/dev/vim-go.nix +++ b/derivations/dev/vim-go.nix @@ -1,151 +1,8 @@ -{ pkgs }: pkgs.vim_configurable.customize { +{ commonRC, ... } @ args : + +import ../../pkg-configuration/vim-derivates/vim.nix (args // { name = "vim-for-go"; - vimrcConfig = { - # add custom .vimrc lines like this: - customRC = '' - set nocompatible - - " leader - let mapleader = ',' - - set hidden - syntax on - set hlsearch - set number - - " mappings to stop insert mode - imap jjj - imap kkk - imap lll - imap hhh - set scroll=11 - - noremap :tabn - noremap :tabp - let g:ctrlp_map = '' - set wildignore+=*/site/*,*.so,*.swp,*.zip - let g:ctrlp_custom_ignore = { - \ 'dir': '\v[\/]\.(git|hg|svn|)$$', - \ 'file': '\v\.(exe|so|dll)$$', - \ } - - "let g:ctrlp_match_func = { 'match': 'pymatcher#PyMatch' } - "let g:pydiction_location = '~/.vim/bundle/pydiction/complete-dict' - - " allways show status line - set ls=2 - set tabstop=4 - set shiftwidth=4 - set softtabstop=4 - set expandtab - "set textwidth=80 - - let g:tagbar_type_go = { - \ 'ctagstype' : 'go', - \ 'kinds' : [ - \ 'p:package', - \ 'i:imports:1', - \ 'c:constants', - \ 'v:variables', - \ 't:types', - \ 'n:interfaces', - \ 'w:fields', - \ 'e:embedded', - \ 'm:methods', - \ 'r:constructor', - \ 'f:functions' - \ ], - \ 'sro' : '.', - \ 'kind2scope' : { - \ 't' : 'ctype', - \ 'n' : 'ntype' - \ }, - \ 'scope2kind' : { - \ 'ctype' : 't', - \ 'ntype' : 'n' - \ }, - \ 'ctagsbin' : 'gotags', - \ 'ctagsargs' : '-sort -silent' - \ } - - " syntastic { - au FileType qf setlocal wrap linebreak - let g:syntastic_always_populate_loc_list = 1 - let g:syntastic_auto_loc_list = 0 - let g:syntastic_check_on_open = 1 - let g:syntastic_check_on_wq = 0 - if has("gui_running") - set mouse=a - else - set mouse= - endif - - set wildignore+=*/site/*,*.so,*.swp,*.zip - let g:ctrlp_custom_ignore = { - \ 'dir': '\v[\/]\.(git|hg|svn|)$$', - \ 'file': '\v\.(exe|so|dll)$$', - \ } - " } - - " spelling {{{ - au BufRead,BufNewFile *.md,*.markdown setlocal spell spelllang=en_us,de_de - " }}} - - " sync default register to clipboard { - if has('unnamedplus') - set clipboard=unnamedplus - else - set clipboard=unnamed - endif - " } - - " colored brackets { - let g:rbpt_colorpairs = [ - \ ['brown', 'RoyalBlue3'], - \ ['Darkblue', 'SeaGreen3'], - \ ['darkgray', 'DarkOrchid3'], - \ ['darkgreen', 'firebrick3'], - \ ['darkcyan', 'RoyalBlue3'], - \ ['darkred', 'SeaGreen3'], - \ ['darkmagenta', 'DarkOrchid3'], - \ ['brown', 'firebrick3'], - \ ['gray', 'RoyalBlue3'], - \ ['black', 'SeaGreen3'], - \ ['darkmagenta', 'DarkOrchid3'], - \ ['Darkblue', 'firebrick3'], - \ ['darkgreen', 'RoyalBlue3'], - \ ['darkcyan', 'SeaGreen3'], - \ ['darkred', 'DarkOrchid3'], - \ ['red', 'firebrick3'], - \ ] - let g:rbpt_max = 16 - let g:rbpt_loadcmd_toggle = 0 - - au VimEnter * RainbowParenthesesToggle - au Syntax * RainbowParenthesesLoadRound - au Syntax * RainbowParenthesesLoadSquare - au Syntax * RainbowParenthesesLoadBraces - " } - - set t_ut= - colorscheme PaperColor - - " Python {{{ - augroup ft_python - au! - au FileType python setlocal omnifunc=pythoncomplete#Complete - au FileType python setlocal define=^\s*\\(def\\\\|class\\) - augroup END - " }}} - - " YAML {{{ - augroup ft_yaml - au! - setlocal autoindent sw=2 et tabstop=2 shiftwidth=2 softtabstop=2 - augroup END - " }}} - - + additionalRC = commonRC + '' " Disable AutoComplPop. let g:acp_enableAtStartup = 0 " Use neocomplete. @@ -155,42 +12,8 @@ if !exists('g:neocomplete#sources#omni#input_patterns') let g:neocomplete#sources#omni#input_patterns = {} endif - - " vim-go { - let g:go_highlight_functions = 1 - let g:go_highlight_methods = 1 - let g:go_highlight_structs = 1 - let g:go_highlight_interfaces = 1 - let g:go_highlight_operators = 1 - let g:go_highlight_build_constraints = 1 - let g:go_fmt_autosave = 1 - let g:go_fmt_command = 'gofmt' - let g:go_fmt_options= '-s' - let g:go_def_mode = 'godef' - let g:go_def_reuse_buffer = 0 - - au FileType go nmap gds (go-def-split) - au FileType go nmap gdv (go-def-vertical) - au FileType go nmap gdt (go-def-tab) - au FileType go nmap gi (go-imports) - " } - - ''; - - vam.knownPlugins = pkgs.vimPlugins; # optional - vam.pluginDictionaries = [ # full ducomentation at github.com/MarcWeber/vim-addon-manager - "vim-go" - "neocomplete" - "vim-addon-vim2nix" - "vim-airline" - "vim-addon-nix" - "ctrlp" - "syntastic" - "vim-css-color" - "rainbow_parentheses" - "vim-colorschemes" - "vim-colorstepper" - "vim-signify" - ]; - }; -} + ''; + additionalPlugins = [ + "neocomplete" + ]; +})