Skip to content

Commit

Permalink
coc: ts setting
Browse files Browse the repository at this point in the history
  • Loading branch information
kovetskiy committed Jun 8, 2020
1 parent 4aa442d commit 33d5c3d
Show file tree
Hide file tree
Showing 6 changed files with 75 additions and 10 deletions.
3 changes: 1 addition & 2 deletions .config/coc/extensions/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
}
Expand Down
1 change: 1 addition & 0 deletions .vim/coc-settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -75,5 +75,6 @@
"\"",
"`"
],
"typescript.format.insertSpaceAfterOpeningAndBeforeClosingNonemptyBraces": true,
"coc.preferences.hoverTarget": "preview"
}
17 changes: 9 additions & 8 deletions .vimrc
Original file line number Diff line number Diff line change
Expand Up @@ -608,6 +608,11 @@ Plug 'w0rp/ale'
\ 'gts fix')
augroup end

augroup _ts
au!
au FileType typescript nmap <silent><buffer> <c-p> :call coc#rpc#request('runCommand', ['tsserver.organizeImports'])<CR>
augroup end

Plug 'mg979/vim-visual-multi'
let g:VM_custom_remaps = {'<c-p>': '[', '<c-s>': 'q'}
let g:VM_no_meta_mappings = 1
Expand Down Expand Up @@ -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'

Expand Down
4 changes: 4 additions & 0 deletions .zshrc
Original file line number Diff line number Diff line change
Expand Up @@ -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
53 changes: 53 additions & 0 deletions zsh/0-fzf-completion.zsh
Original file line number Diff line number Diff line change
@@ -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
}
7 changes: 7 additions & 0 deletions zsh/batrak.zsh
Original file line number Diff line number Diff line change
@@ -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
}

0 comments on commit 33d5c3d

Please sign in to comment.