shortcut key to get the previous command in ksh - keyboard-shortcuts

Shortcut key to get the previous command in ksh
What is the shorcut key to get the previous command that was used in ksh?
I have tried using the history command but that is not my requirement.
I want to know the shortcut key.

If you first set the editor mode to "vi";
set -o vi
Then you can access history by entering command mode (press Esc key), and using either the up arrow or the 'k' key.
From there, vi editing syntax works - e.g. to edit the line enter insert mode ('i') etc. Hitting return will re-execute the command, and Ctrl-C will cancel.

Related

Atom Override keybinding for PlatformIO

I'm using the PlatformIO package, and I want to override the shortcut that allows me to focus in and out of the embedded terminal. The default shortcut is ctrl + alt + f. I want to change it to esc.
I tried this in my keymap.cson:
'atom-text-editor':
'esc': 'Platformio Ide Terminal: Focus'
I also tried with "escape" instead of "esc", but neither was able to override the default shortcut.
How do I accomplish this?
The correct key for Esc is esc, but more importantly, you need to use the correct command to focus. The following works, given that the terminal is visible.
'atom-text-editor':
'escape': 'platformio-ide-terminal:focus'
To toggle and focus the terminal in one keystroke, you need to use "composed" commands. In that case, you can put something like the following into your init.coffee:
atom.commands.add "atom-workspace", "my-custom-toggle": ->
activeEditor = atom.views.getView atom.workspace.getActiveTextEditor()
pioTerminal = document.querySelector(".platformio-ide-terminal.terminal-view")
parentNode = pioTerminal.parentNode if pioTerminal
if !parentNode or parentNode.style.display is "none"
atom.commands.dispatch(activeEditor, "platformio-ide-terminal:toggle")
atom.commands.dispatch(activeEditor, "platformio-ide-terminal:focus")
And then you use that command in your keymap.cson:
'atom-text-editor':
'escape': 'my-custom-toggle'

How to have special/accented characters support in IntelliJ terminal

I use the IntelliJ IDEA's Embedded Local Terminal quite a lot, but there is one thing that is driving me nuts : special and accented characters do not work.
This is what should but is not working :
HOME key to go to the beginning of the line : does nothing
END key to go to the end of the line : does nothing
[CTRL + left arrow] to go to previous word : prints D
[CTRL + right arrow] to go to next word : prints C
all accented characters : prints nothing at first, then ? when I hit another key
There are probably other combinations that should but do not work ... but these are the most annoying ones.
I'm using :
Ubuntu 16.04 virtual box guest running on a Windows 10 host
IntelliJ IDEA 2016.2.4
zsh
oh-my-zsh
Important notes :
in a GNU Terminal (outside of IntelliJ then) everything works perfectly, so I don't think that the "running inside a VM" thing is the source of the problem.
if I run bash instead of zsh the special characters are working (home, end, next work, etc...) but I still don't have propre support of accented characters (prints �), and I'd really prefer using zsh.
showkey --scancodes prints Couldn't get a file descriptor referring to the console
if I start od -c I get ^[[H for the HOME key and ^[[F for the END key
showkey --ascii works and prints ^[[H too for the HOME key
What I did already :
checked that the TERM variable is not overridden in .zshrc
add bindkey "${terminfo[khome]}" beginning-of-line and end of line equivalent in .zshrc
add lines (that seemd appropriate) in .inputrc for readline (OK I see now that this was useless as Zsh does not use readline)
edit : I could make the home/end keys work (see accepted answer below), but not the CTRL+LEFT and CTRL+RIGHT key (for forward-word and backward-word). After some more digging this seems to be an issue with IntelliJ not 100% properly emulating the terminal. 4
There is an issue here, with interesting input from an oh-my-zsh contributor : https://youtrack.jetbrains.com/issue/IDEA-118848#comment=27-1292473
They consider ditching smkx (which appears to be the root of the problem) from oh-my-zsh soon. I've checked out this PR and now my keys work fine (still need the bindings, but CTRL+LEFT and CTRL+RIGHT are ok now)
edit: accented/special characters are now properly supported in IntelliJ (yeehaa !), be sure to have at least the following version : IntelliJ IDEA 2016.3.1, Build #IC-163.9166.29, built on December 9, 2016
I can appreciate that zsh works fine outside IntelliJ.
Step 1
Find the correct key codes being used by the terminal inside Intellij. This will depend on the OS you are using. For OSX and Linux od -c followed by pressing the keys will result in the key code being emitted.
Step 2
Once you have the keycodes, modify your ~/.zshrc :
bindkey "$HOME_KEY_CODE_FROM_STEP_1" beginning-of-line
bindkey "$END_KEY_CODE_FROM_STEP_1" end-of-line
for example (as was the case for the OP):
bindkey "^[[H" beginning-of-line
bindkey "^[[F" end-of-line
and restart the terminal.

Can FlyCheck be used with Komodo(for Django) for checking syntax on the fly?

I want to use Komodo IDE for building one Django project.I want to use flycheck syntax checker so that it indicates the syntax errors on the fly.If fly-check cannot be integrated with Komodo,is there any other possibility to syntax checking on the fly?
Use the following process:
Goto Toolbox=>Add=>New Command
Enter the emacs command line arguments in the Run field:
emacs eval('(progn
(flycheck-declare-checker go-gofmt
"A Go syntax and style checker using the gofmt utility."
:command '("gofmt" source-inplace)
:error-patterns '(("^\\(?1:.*\\):\\(?2:[0-9]+\\):\\(?3:[0-9]+\\): \\(?4:.*\\)$" error))
:modes 'go-mode)
(add-to-list 'flycheck-checkers 'go-gofmt)))
Check all the boxes
Enter the path to emacs in the Start In field
Click the Key Binding tab
Use Ctrl+0 as the New Key Sequence
Press Ctrl+A,Ctrl+0
References
Komodo Documentation: Run Commands
Emacs Wiki: Flycheck

Create a file with content through ssh without a text editor

I am aware that it is possible to create a file in ssh through the "touch" command then editing it using text editors such as vi or pico to edit them and add content.
I was wondering if it was possible to create a file and add it's contents in one command line?
Something like:
[create file command] [filename.txt] ["this is the contents of filename.txt"]
The reason I'm asking if this was possible is because I have an ssh client in Go where a session only accepts one call to run and I plan to use this for an app that is automated with no user inputs so I want to avoid using text editors.
Here's one solution:
ssh [user#]hostname 'echo "this is the contents of filename.txt" > <path/filename>'
The echo with ">" overwrites an existing file, or creates a new file if it doesn't exist.
Replace ">" with ">>" to append the text to an existing file.
Cheers

how do you make Scite interactive?

Once I compile with Scite, my command prompt won't show up.
How do I set it up so I can accept inputs and outputs from the command prompt from my program using Scite?
In scite properties file Edit as below:
Change
command.go.*.c=$(FileName)
to
command.go.*.c=start $(FileName)
Pressing go opens the tatget file in new cmd window and is now interactable
Now you can give inputs
If you are using different language replace *.c with corrosponding one and put start before the command.