diff --git a/home/common/.direnvrc b/home/common/.direnvrc index 3df1010..d82fe92 100644 --- a/home/common/.direnvrc +++ b/home/common/.direnvrc @@ -23,13 +23,13 @@ use_nix() { log_status using cached derivation fi local term_backup=$TERM path_backup=$PATH - if [ -n ${TMPDIR+x} ]; then + if ! [ -z ${TMPDIR+x} ]; then local tmp_backup=$TMPDIR fi eval "$(< $cache)" export PATH=$PATH:$path_backup TERM=$term_backup TMPDIR=$tmp_backup - if [ -n ${tmp_backup+x} ]; then + if ! [ -z ${tmp_backup+x} ]; then export TMPDIR=${tmp_backup} else unset TMPDIR diff --git a/home/common/coc.vim b/home/common/coc.vim new file mode 100644 index 0000000..86cbe04 --- /dev/null +++ b/home/common/coc.vim @@ -0,0 +1,46 @@ +" Use tab for trigger completion with characters ahead and navigate. +" Use command ':verbose imap ' to make sure tab is not mapped by other plugin. +inoremap + \ pumvisible() ? "\" : + \ check_back_space() ? "\" : + \ coc#refresh() +inoremap pumvisible() ? "\" : "\" + +function! s:check_back_space() abort +let col = col('.') - 1 +return !col || getline('.')[col - 1] =~# '\s' +endfunction + +" Use to confirm completion, `u` means break undo chain at current position. +inoremap complete_info()["selected"] != "-1" ? "\" : "\u\" + +" Use to trigger completion. +inoremap coc#refresh() + +" Remap keys for gotos +nmap gd (coc-definition) +nmap gy (coc-type-definition) +nmap gi (coc-implementation) +nmap gr (coc-references) + +" Highlight symbol under cursor on CursorHold +autocmd CursorHold * silent call CocActionAsync('highlight') + +" Remap for rename current word +nmap rn (coc-rename) + +" Remap for format selected region +xmap f (coc-format-selected) +nmap f (coc-format-selected) + +" Remap for do codeAction of selected region, ex: `aap` for current paragraph +xmap a (coc-codeaction-selected) +nmap a (coc-codeaction-selected) + +" Remap for do codeAction of current line +nmap ac (coc-codeaction) +" Fix autofix problem of current line +nmap qf (coc-fix-current) + +" Use `:Format` to format current buffer +command! -nargs=0 Format :call CocAction('format') diff --git a/home/common/init.vim b/home/common/init.vim new file mode 100644 index 0000000..c64216c --- /dev/null +++ b/home/common/init.vim @@ -0,0 +1,33 @@ +colorscheme gruvbox +let g:gruvbox_number_column = 'bg1' + +let g:startify_bookmarks = [ + \ '~/dev/fitnesspilot/microservices', + \ '~/dev/fitnesspilot/clients/fitnesspilot-web', + \ '~/dev/fitnesspilot/microservices/fitnesspilot', + \ '~/dev/fitnesspilot/microservices/coachtasks', + \ '~/dev/fitnesspilot/microservices/notifications', + \ '~/dev/fitnesspilot/microservices/googlefitimport', + \ ] + +let mapleader=" " +let g:camelcasemotion_key = '' + +" omnisharp-vim config: +let g:OmniSharp_server_stdio = 1 +let g:OmniSharp_server_path = '/home/felschr/.nix-profile/bin/omnisharp' +let g:OmniSharp_selector_ui = 'fzf' +let g:OmniSharp_highlight_types = 3 +let g:ale_linters = { + \ 'cs': ['OmniSharp'] + \ } + +" nvim-lsp using neovim's official LSP interface +" call nvim_lsp#setup("tsserver", {}) +" call nvim_lsp#setup("ghcide", {}) + +set relativenumber + +map ; :Files +map :NERDTreeToggle +map (easymotion-prefix) diff --git a/home/common/neovim.nix b/home/common/neovim.nix index aefa546..0798f04 100644 --- a/home/common/neovim.nix +++ b/home/common/neovim.nix @@ -75,12 +75,14 @@ in lightline-vim lightline-ale nerdtree + vim-startify vim-polyglot vim-multiple-cursors vim-surround vim-commentary vim-easymotion vim-gitgutter + vim-fugitive camelcasemotion # nvim-lsp # nixos-rebuild currently fails @@ -88,7 +90,6 @@ in ale vim-orgmode vim-nix - vim-fugitive coc-nvim coc-emmet @@ -103,35 +104,6 @@ in omnisharp-vim ]; - extraConfig = '' - colorscheme gruvbox - let g:gruvbox_number_column = 'bg1' - - let mapleader=" " - let g:camelcasemotion_key = '' - - " coc config - inoremap coc#refresh() - - " omnisharp-vim config: - let g:OmniSharp_server_stdio = 1 - let g:OmniSharp_server_path = '/home/felschr/.nix-profile/bin/omnisharp' - let g:OmniSharp_selector_ui = 'fzf' - let g:OmniSharp_highlight_types = 3 - let g:ale_linters = { - \ 'cs': ['OmniSharp'] - \} - - " call nvim_lsp#setup("tsserver", {}) - " call nvim_lsp#setup("ghcide", {}) - - set relativenumber - set wildmenu - set wildmode=longest,list,full - - map ; :Files - map :NERDTreeToggle - map (easymotion-prefix) - ''; + extraConfig = with builtins; readFile ./init.vim + readFile ./coc.vim; }; }