From e1c7e0c41af190058d93ed7e5e40c05b7d15584e Mon Sep 17 00:00:00 2001 From: Dave Gallant Date: Tue, 19 Jan 2021 09:24:17 -0500 Subject: [PATCH] Move custom vim config out of home/default.nix into init.vim --- home/default.nix | 165 ++--------------------------------------------- home/init.vim | 158 +++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 162 insertions(+), 161 deletions(-) create mode 100644 home/init.vim diff --git a/home/default.nix b/home/default.nix index 498d2c8..0acbf14 100644 --- a/home/default.nix +++ b/home/default.nix @@ -281,168 +281,11 @@ viAlias = true; vimAlias = true; - extraConfig = '' - call plug#begin('~/.vim/plugged') - Plug 'LnL7/vim-nix' - Plug 'airblade/vim-gitgutter' - Plug 'ap/vim-css-color' - Plug 'artur-shaik/vim-javacomplete2' - Plug 'endel/vim-github-colorscheme' - Plug 'fatih/vim-go' - Plug 'godlygeek/tabular' - Plug 'hashivim/vim-terraform' - Plug 'itchyny/lightline.vim' - Plug 'junegunn/fzf' - Plug 'junegunn/fzf.vim' - Plug 'leafgarland/typescript-vim' - Plug 'morhetz/gruvbox' - Plug 'neoclide/coc.nvim', {'branch': 'release'} - Plug 'peitalin/vim-jsx-typescript' - Plug 'plasticboy/vim-markdown' - Plug 'rust-lang/rust.vim' - Plug 'scrooloose/nerdtree' - Plug 'sheerun/vim-polyglot' - Plug 'tpope/vim-commentary' - Plug 'tpope/vim-fugitive' - Plug 'tpope/vim-repeat' - Plug 'tpope/vim-surround' - Plug 'vifm/vifm.vim' - Plug 'vim-syntastic/syntastic' - Plug 'prettier/vim-prettier', { - \ 'do': 'yarn install', - \ 'for': ['javascript', 'typescript', 'css', 'less', 'scss', 'json', 'graphql', 'markdown', 'vue', 'yaml', 'html'] } - call plug#end() + configure = { + customRC = builtins.readFile ./init.vim; + vam.knownPlugins = pkgs.vimPlugins; + }; - set autoread - set cursorline - set encoding=utf-8 - set expandtab - set foldlevel=99 - set foldmethod=indent - set hlsearch - set ignorecase - set incsearch - set laststatus=2 - set modelines=0 - set mouse=a - set nocompatible - set noswapfile - set number relativenumber - set pastetoggle= - set ruler - set shiftwidth=2 - set showcmd - set showmode - set smartcase - set t_Co=256 - set tabstop=2 - set wildmenu - - " Remember line number - au BufReadPost * if line("'\"") > 0 && line("'\"") <= line("$") | exe "normal! g`\"" | endif - - " Search down into subfolders - " Provides tab-completion for all file-related tasks - set path+=** - filetype plugin indent on - - " Enable folding with the spacebar - nnoremap za - - " replace visually selected - vnoremap "hy:%s/h//g - - " Custom Commands - command JsonFormat execute "::%!jq '.'" - - " Shortcuts - map r :Rg - map f :Files - map g :GFiles - map n :NERDTreeToggle - map :tabn - map :tabp - map :tabnew - - " Copypasta - noremap y "+y - noremap p "+p - - " yaml indentation - au FileType yaml setlocal ts=2 sts=2 sw=2 expandtab - - " Python indentation - au BufNewFile,BufRead *.py set tabstop=4 softtabstop=4 shiftwidth=4 textwidth=79 expandtab autoindent fileformat=unix - let python_highlight_all=1 - syntax on - colorscheme gruvbox - - " highlight red lines - highlight ExtraWhitespace ctermbg=red guibg=red - match ExtraWhitespace /\s\+$/ - - " groovy syntax - au BufNewFile,BufRead *.groovy set tabstop=2 shiftwidth=2 expandtab - au BufNewFile,BufRead Jenkinsfile setf groovy - au BufNewFile,BufRead Jenkinsfile set tabstop=2 shiftwidth=2 expandtab - - " vim-go - let g:go_auto_sameids = 0 - let g:go_fmt_command = "goimports" - let g:go_fmt_experimental = 1 - let g:go_highlight_array_whitespace_error = 1 - let g:go_highlight_build_constraints = 1 - let g:go_highlight_chan_whitespace_error = 1 - let g:go_highlight_extra_types = 1 - let g:go_highlight_fields = 1 - let g:go_highlight_format_strings = 1 - let g:go_highlight_function_calls = 1 - let g:go_highlight_function_parameters = 1 - let g:go_highlight_functions = 1 - let g:go_highlight_generate_tags = 1 - let g:go_highlight_operators = 1 - let g:go_highlight_space_tab_error = 1 - let g:go_highlight_string_spellcheck = 1 - let g:go_highlight_trailing_whitespace_error = 0 - let g:go_highlight_types = 1 - let g:go_highlight_variable_assignments = 1 - let g:go_highlight_variable_declarations = 1 - let g:go_metalinter_autosave=1 - let g:go_metalinter_autosave_enabled=['golint', 'govet'] - let g:go_rename_command = 'gopls' - - " vim-terraform - let g:terraform_align=1 - let g:terraform_fmt_on_save=1 - let g:terraform_fold_sections=1 - - " rust.vim - let g:rustfmt_autosave = 1 - - " syntastic - set statusline+=%#warningmsg# - set statusline+=%{SyntasticStatuslineFlag()} - set statusline+=%* - let g:syntastic_always_populate_loc_list = 1 - let g:syntastic_auto_loc_list = 1 - let g:syntastic_check_on_open = 1 - let g:syntastic_check_on_wq = 0 - - " fzf.vim - let g:fzf_preview_window = 'right:60%' - let g:fzf_layout = { 'window': 'enew' } - - " vim-markdown - let g:vim_markdown_override_foldtext=0 - let g:vim_markdown_no_default_key_mappings=1 - let g:vim_markdown_emphasis_multiline=0 - let g:vim_markdown_conceal=0 - let g:vim_markdown_frontmatter=1 - let g:vim_markdown_new_list_item_indent=0 - - " vim-javacomplete2 - autocmd FileType java setlocal omnifunc=javacomplete#Complete - ''; }; }; } diff --git a/home/init.vim b/home/init.vim new file mode 100644 index 0000000..126fc28 --- /dev/null +++ b/home/init.vim @@ -0,0 +1,158 @@ + call plug#begin('~/.vim/plugged') + Plug 'LnL7/vim-nix' + Plug 'airblade/vim-gitgutter' + Plug 'ap/vim-css-color' + Plug 'artur-shaik/vim-javacomplete2' + Plug 'endel/vim-github-colorscheme' + Plug 'fatih/vim-go' + Plug 'godlygeek/tabular' + Plug 'hashivim/vim-terraform' + Plug 'itchyny/lightline.vim' + Plug 'leafgarland/typescript-vim' + Plug 'morhetz/gruvbox' + Plug 'neoclide/coc.nvim', {'branch': 'release'} + Plug 'peitalin/vim-jsx-typescript' + Plug 'plasticboy/vim-markdown' + Plug 'rust-lang/rust.vim' + Plug 'scrooloose/nerdtree' + Plug 'sheerun/vim-polyglot' + Plug 'tpope/vim-commentary' + Plug 'tpope/vim-fugitive' + Plug 'tpope/vim-repeat' + Plug 'tpope/vim-surround' + Plug 'vifm/vifm.vim' + Plug 'vim-syntastic/syntastic' + Plug 'prettier/vim-prettier', { + \ 'do': 'yarn install', + \ 'for': ['javascript', 'typescript', 'css', 'less', 'scss', 'json', 'graphql', 'markdown', 'vue', 'yaml', 'html'] } + call plug#end() + + set autoread + set cursorline + set encoding=utf-8 + set expandtab + set foldlevel=99 + set foldmethod=indent + set hlsearch + set ignorecase + set incsearch + set laststatus=2 + set modelines=0 + set mouse=a + set nocompatible + set noswapfile + set number relativenumber + set pastetoggle= + set ruler + set shiftwidth=2 + set showcmd + set showmode + set smartcase + set t_Co=256 + set tabstop=2 + set wildmenu + + " Remember line number + au BufReadPost * if line("'\"") > 0 && line("'\"") <= line("$") | exe "normal! g`\"" | endif + + " Search down into subfolders + " Provides tab-completion for all file-related tasks + set path+=** + filetype plugin indent on + + " Enable folding with the spacebar + nnoremap za + + " replace visually selected + vnoremap "hy:%s/h//g + + " Custom Commands + command JsonFormat execute "::%!jq '.'" + + " Shortcuts + map r :Rg + map f :Files + map g :GFiles + map n :NERDTreeToggle + map :tabn + map :tabp + map :tabnew + + " Copypasta + noremap y "+y + noremap p "+p + + " yaml indentation + au FileType yaml setlocal ts=2 sts=2 sw=2 expandtab + + " Python indentation + au BufNewFile,BufRead *.py set tabstop=4 softtabstop=4 shiftwidth=4 textwidth=79 expandtab autoindent fileformat=unix + let python_highlight_all=1 + syntax on + colorscheme gruvbox + + " highlight red lines + highlight ExtraWhitespace ctermbg=red guibg=red + match ExtraWhitespace /\s\+$/ + + " groovy syntax + au BufNewFile,BufRead *.groovy set tabstop=2 shiftwidth=2 expandtab + au BufNewFile,BufRead Jenkinsfile setf groovy + au BufNewFile,BufRead Jenkinsfile set tabstop=2 shiftwidth=2 expandtab + + " vim-go + let g:go_auto_sameids = 0 + let g:go_fmt_command = "goimports" + let g:go_fmt_experimental = 1 + let g:go_highlight_array_whitespace_error = 1 + let g:go_highlight_build_constraints = 1 + let g:go_highlight_chan_whitespace_error = 1 + let g:go_highlight_extra_types = 1 + let g:go_highlight_fields = 1 + let g:go_highlight_format_strings = 1 + let g:go_highlight_function_calls = 1 + let g:go_highlight_function_parameters = 1 + let g:go_highlight_functions = 1 + let g:go_highlight_generate_tags = 1 + let g:go_highlight_operators = 1 + let g:go_highlight_space_tab_error = 1 + let g:go_highlight_string_spellcheck = 1 + let g:go_highlight_trailing_whitespace_error = 0 + let g:go_highlight_types = 1 + let g:go_highlight_variable_assignments = 1 + let g:go_highlight_variable_declarations = 1 + let g:go_metalinter_autosave=1 + let g:go_metalinter_autosave_enabled=['golint', 'govet'] + let g:go_rename_command = 'gopls' + + " vim-terraform + let g:terraform_align=1 + let g:terraform_fmt_on_save=1 + let g:terraform_fold_sections=1 + + " rust.vim + let g:rustfmt_autosave = 1 + + " syntastic + set statusline+=%#warningmsg# + set statusline+=%{SyntasticStatuslineFlag()} + set statusline+=%* + let g:syntastic_always_populate_loc_list = 1 + let g:syntastic_auto_loc_list = 1 + let g:syntastic_check_on_open = 1 + let g:syntastic_check_on_wq = 0 + + " fzf.vim + let g:fzf_preview_window = 'right:60%' + let g:fzf_layout = { 'window': 'enew' } + + " vim-markdown + let g:vim_markdown_override_foldtext=0 + let g:vim_markdown_no_default_key_mappings=1 + let g:vim_markdown_emphasis_multiline=0 + let g:vim_markdown_conceal=0 + let g:vim_markdown_frontmatter=1 + let g:vim_markdown_new_list_item_indent=0 + + " vim-javacomplete2 + autocmd FileType java setlocal omnifunc=javacomplete#Complete