Emulate Linux nano Ctrl-K, Ctrl-U functionality?

Emulate Linux nano Ctrl-K, Ctrl-U functionality?

2
NewbieNewbie
2

    Apr 28, 2014#1

    Does anyone know if UltraEdit can be configured to emulate the Ctrl-K and Ctrl-U functionality of the editor nano that is found in Linux?

    Ctrl-K: Cut the current line and append it to the paste buffer. Move to the next line.
    Ctrl-U: Go to the first column and paste the lines currently in the paste buffer, moving the existing lines down.

    So, if I type Ctrl-K three times, three lines get deleted from my text, and they are now in the paste buffer.

    I go elsewhere in my document, anyplace in the line, and type Ctrl-U. The three lines in my paste buffer are inserted into the current line of my text, starting at column 0, pushing the existing text downwards.

    6,675585
    Grand MasterGrand Master
    6,675585

      Apr 28, 2014#2

      This is no problem. It can be done with the commands Edit - Select Line, Edit - Cut & Append and Edit - Paste after pressing of key HOME once or twice (depending on configuration setting Home key always goes to column 1 and current position of caret), or using command Search - Goto Line / column with line number 0 (= current line) and column number 1.

      So two macros are required for both tasks stored both in same macro file which is configured to be automatically loaded at startup of UE at Macro - Set Auto Load to be able to execute those 2 macros by their assigned hotkeys.

      See also the topic How to create a macro from a posted macro code?

      First macro with hotkey assignment Ctrl+K has the macro code:

      Code: Select all

      InsertMode
      ColumnModeOff
      IfSel
      CancelSelect
      EndIf
      SelectLine
      IfSel
      Clipboard 6
      CutAppend
      Clipboard 0
      EndIf
      This macro first enables insert mode and turns off column mode. Next it checks if something is currently selected and if this is the case, cancels the selection as you want only the current line in paste buffer and not the selection. Next the current line is selected and if this was possible (file was not empty), the line is cut from file and appended to paste buffer. As paste buffer the user clipboard 6 is used, but the macro makes always the system clipboard active again after line was cut.

      Second macro with hotkey assignment Ctrl+U has the macro code:

      Code: Select all

      InsertMode
      ColumnModeOff
      IfSel
      CancelSelect
      EndIf
      GotoLine 0 1
      Clipboard 6
      Paste
      ClearClipboard
      Clipboard 0
      Again a selection is canceled before moving caret to column 1 of current line. The clipboard is switched to user clipboard 6 and the contents of this clipboard is pasted at current position of the caret into the file. Next the paste buffer (clipboard 6) is cleared and system clipboard is selected again.

      UltraEdit has 9 user clipboards to hold data different to the system clipboard. You can use for this task any of them. I prefer to use clipboard 7 to 9 in macros and scripts and system clipboard + user clipboards 1 to 6 manually. There is also a clipboard history which can be used to paste text once copied or cut to a clipboard.
      Best regards from an UC/UE/UES for Windows user from Austria