# default key bindings complete_shortcut="${qfc_complete_SHORTCUT:-\C-f}" function get_cursor_position(){ # based on a script from http://invisible-island.net/xterm/xterm.faq.html exec < /dev/tty oldstty=$(stty -g) stty raw -echo min 0 # on my system, the following line can be replaced by the line below it echo -en "\033[6n" > /dev/tty # tput u7 > /dev/tty # when TERM=xterm (and relatives) IFS=';' read -r -d R row col stty $oldstty # change from one-based to zero based so they work with: tput cup $row $col row=$((${row:2} - 1)) # strip off the esc-[ col=$((${col} - 1)) echo "$row $col" } if [[ -d ~/.qfc/ ]]; then export PATH=~/.qfc/bin:"${PATH}" fi if [[ -n "$ZSH_VERSION" ]]; then # zshell function qfc_complete { # Add a letter and remove it from the buffer. # when using zsh autocomplete(pressing Tab), then running qfc, the BUFFER(qfc input) won't contain the trailing forward slash(which should happen when using zsh autocomplete for directories). # pressing a character then removing it makes sure that BUFFER contains what you see on the screen. BUFFER=${BUFFER}'a' BUFFER=${BUFFER[0,-2]} # get the cursor offset within the user input offset=${CURSOR} zle beginning-of-line # get the offset from the start of comandline prompt col=$(echo $(get_cursor_position) | cut -f 2 -d " ") # place the cursor at the next line