diff --git a/.config/coc/extensions/package.json b/.config/coc/extensions/package.json index 790e940a..6bbe5764 100755 --- a/.config/coc/extensions/package.json +++ b/.config/coc/extensions/package.json @@ -3,10 +3,9 @@ "coc-css": ">=1.2.3", "coc-git": ">=1.7.13", "coc-go": ">=0.7.0", - "coc-java": ">=1.4.10", + "coc-java": ">=1.4.11", "coc-json": ">=1.2.6", "coc-pairs": ">=1.2.21", - "coc-python": ">=1.2.12", "coc-tsserver": ">=1.5.1", "coc-xml": ">=1.11.1" } diff --git a/.vim/coc-settings.json b/.vim/coc-settings.json index b7966fa1..9567f775 100755 --- a/.vim/coc-settings.json +++ b/.vim/coc-settings.json @@ -75,5 +75,6 @@ "\"", "`" ], + "typescript.format.insertSpaceAfterOpeningAndBeforeClosingNonemptyBraces": true, "coc.preferences.hoverTarget": "preview" } diff --git a/.vimrc b/.vimrc index 1b29d186..a66a953e 100644 --- a/.vimrc +++ b/.vimrc @@ -608,6 +608,11 @@ Plug 'w0rp/ale' \ 'gts fix') augroup end + augroup _ts + au! + au FileType typescript nmap :call coc#rpc#request('runCommand', ['tsserver.organizeImports']) + augroup end + Plug 'mg979/vim-visual-multi' let g:VM_custom_remaps = {'': '[', '': 'q'} let g:VM_no_meta_mappings = 1 @@ -761,14 +766,10 @@ Plug 'kovetskiy/coc.nvim', {'do': { -> coc#util#install()}} let b:_coc_timer_moved = 1 endfunc! - autocmd CursorHold * call _coc_timer_hold() - autocmd CursorHoldI * call _coc_timer_hold() - autocmd CursorMoved * call _coc_timer_moved() - autocmd CursorMovedI * call _coc_timer_moved() - - func! ChooseTypeToImport(candidates) - echo string(a:candidates) - endfunc! + autocmd CursorHold *.java call _coc_timer_hold() + autocmd CursorHoldI *.java call _coc_timer_hold() + autocmd CursorMoved *.java call _coc_timer_moved() + autocmd CursorMovedI *.java call _coc_timer_moved() Plug 'majutsushi/tagbar' diff --git a/.zshrc b/.zshrc index 60d03860..eac06cae 100644 --- a/.zshrc +++ b/.zshrc @@ -1454,3 +1454,7 @@ if [[ "$HISTFILE_OVERRIDE" ]]; then fi setopt share_history + +#bindkey -e '^I' fzf-completion + +#for f in ~/dotfiles/zsh/*; do source $f; done diff --git a/zsh/0-fzf-completion.zsh b/zsh/0-fzf-completion.zsh new file mode 100644 index 00000000..dab549f7 --- /dev/null +++ b/zsh/0-fzf-completion.zsh @@ -0,0 +1,53 @@ +fzf-completion() { + local tokens cmd prefix trigger tail matches lbuf d_cmds + setopt localoptions noshwordsplit noksh_arrays noposixbuiltins + + # http://zsh.sourceforge.net/FAQ/zshfaq03.html + # http://zsh.sourceforge.net/Doc/Release/Expansion.html#Parameter-Expansion-Flags + tokens=(${(z)LBUFFER}) + if [ ${#tokens} -lt 1 ]; then + zle ${fzf_default_completion:-expand-or-complete} + return + fi + + cmd=$(__fzf_extract_command "$LBUFFER") + + # Explicitly allow for empty trigger. + trigger=${FZF_COMPLETION_TRIGGER-'**'} + [ -z "$trigger" -a ${LBUFFER[-1]} = ' ' ] && tokens+=("") + + # When the trigger starts with ';', it becomes a separate token + if [[ ${LBUFFER} = *"${tokens[-2]}${tokens[-1]}" ]]; then + tokens[-2]="${tokens[-2]}${tokens[-1]}" + tokens=(${tokens[0,-2]}) + fi + + tail=${LBUFFER:$(( ${#LBUFFER} - ${#trigger} ))} + # Kill completion (do not require trigger sequence) + if [ $cmd = kill -a ${LBUFFER[-1]} = ' ' ]; then + matches=$(command ps -ef | sed 1d | FZF_DEFAULT_OPTS="--height ${FZF_TMUX_HEIGHT:-50%} --min-height 15 --reverse $FZF_DEFAULT_OPTS $FZF_COMPLETION_OPTS --preview 'echo {}' --preview-window down:3:wrap" __fzf_comprun "$cmd" -m | awk '{print $2}' | tr '\n' ' ') + if [ -n "$matches" ]; then + LBUFFER="$LBUFFER$matches" + fi + zle reset-prompt + # Trigger sequence given + elif [ ${#tokens} -gt 1 -a "$tail" = "$trigger" ]; then + d_cmds=(${=FZF_COMPLETION_DIR_COMMANDS:-cd pushd rmdir}) + + [ -z "$trigger" ] && prefix=${tokens[-1]} || prefix=${tokens[-1]:0:-${#trigger}} + [ -z "${tokens[-1]}" ] && lbuf=$LBUFFER || lbuf=${LBUFFER:0:-${#tokens[-1]}} + + if eval "type _fzf_complete_${cmd} > /dev/null"; then + prefix="$prefix" eval _fzf_complete_${cmd} ${(q)lbuf} + elif [ ${d_cmds[(i)$cmd]} -le ${#d_cmds} ]; then + _fzf_dir_completion "$prefix" "$lbuf" + else + _fzf_path_completion "$prefix" "$lbuf" + fi + # Fall back to default completion + elif eval "type _fzf_complete_${cmd} > /dev/null"; then + prefix="$prefix" eval _fzf_complete_${cmd} ${(q)lbuf} + else + zle ${fzf_default_completion:-expand-or-complete} + fi +} diff --git a/zsh/batrak.zsh b/zsh/batrak.zsh new file mode 100644 index 00000000..f70f42e8 --- /dev/null +++ b/zsh/batrak.zsh @@ -0,0 +1,7 @@ +_fzf_complete_batrak() { + cmd="${BUFFER}" + eval set -- $cmd + zparseopts -E -D -- \ + -l=o_list + echo "o_list=$o_list" >> /tmp/x +}