Cut and Paste

From Gwen Morse's Wiki
Jump to: navigation, search
;;; Adam's TinyFugue Configuration -- cut-n-paste.tf 
;;; cut-n-paste.tf

;;; Additional bindings that work with kbregion.tf
;;; They are more like emacs bindings

/unbind ^k
/unbind ^w
/unbind ^x^x

/bind ^k    = /kb_cut_to_eol
/bind ^@	= /kb_set_mark
/bind ^\32	= /kb_set_mark
/bind ^w	= /kb_cut_region
/bind ^[w	= /kb_copy_region
/bind ^y	= /kb_paste_buffer
/bind ^x^x	= /kb_exchange_point_and_mark

;;; Define a macro to cut from the cursor position to the end of line
;
/def -i kb_cut_to_eol = \
    /set _kb_mark=$[kbpoint()]%;\
    /dokey_end%;\
    /if ( _kb_mark > -1 ) \
        /let mark=%{_kb_mark}%;\
        /set _kb_region=%;\
        /if ( _kb_mark > kbpoint() ) \
            /test _kb_region := substr(kbtail(), 0, kbpoint() - _kb_mark)%;\
        /else \
            /test _kb_region := substr(kbhead(), _kb_mark, kbpoint())%;\
        /endif%;\
        /echo -e %% Region copied into buffer.%;\
        /set _kb_mark=-1%;\
        /test kbdel(mark)%;\
    /endif