I´d like to have a shortcut to place a timestamp at any program that I use in Windows 10.
I didn't found any native resource for that.
I wonder if I could write some macro or script or some basic function that returns a timestamp, invoked by a shortcut, regardless of the current task that I´m working.
You can do it with powershell.
Create a shortcut with this command line:
powershell.exe -c "Get-Date | Set-Clipboard"
Each time you start the shortcut, the clipboard will get a new timestamp.
So I went to my desktop, right click on it, and used the command : New >> shortcut.
After right click on this new shortcut, and selected 'Properties'.
In the 'General' tab I put "NOW CTRL + ALT + bar" in the first field (that´s the sortcut´s name).
In the 'Shortcut' tab I put the command above in the first field,
and "CTRL + Alt + /" in the third field.
Related
I want to modify the beginning of every line of a txt file in Geany. Somehow it is possible to write in multiple lines at the same time (maybe with box selection?).
How to do this?
You need to install before the plugin Extra Selection.
For my configuration (Debian/Buster, Geany 1.33) I add to configure shortcuts key.
See plugin manual for more details :
Usage :
Under Tools -> Extra Selection, there are 7 new items: "Column
Mode", "Select to Line", "Select to Matching Brace", "Toggle
Rectangular/Stream", "Set Anchor", "Select to Anchor" and "Rectangle
Select to Anchor". Normally these should be bound to keys, for example
Alt-C, Alt-Shift-L, Ctrl-Shift-B, Ctrl+2, F12, Shift-F12 and
Alt-Shift-F12.
This is just an addition to the answer by #zaboop since the edit queue was full and many people might not have understood the solution properly.
In Geany you cannot edit different parts of multiple lines at once (like in VS Code) without using plugins.
Instead what you can do is you can edit the starting of multiple lines at once.To do so:
Hold Shift + Alt and press your up or down arrow keys to correspondingly select the lines above or below the current line.
Then release Shift + Alt and continue editing the lines.
No plugins needed.
Strangely, unlike the other answers, I had to press Shift + Ctrl while selecting a region, and selecting only works with the mouse, not with the keyboard. After selecting, I was able to edit multiple lines at once.
Configuration: (Debian-based) Raspberry Pi OS, accessed via VNC, Geany 1.33
Select the region, while pressing Alt-Shift, then move around with cursor with arrows.
In Eclipse, if I type cmd+L, it opens a dialog for me to enter a line number and it takes me there in the code. How do I do the same thing in Android Studio? Instead of having to scroll each time I need a specific line number.
Use Command + L for Mac OS X.
IntellijIDEA default keymap reference
Here is the IntellijIDEA default keymap reference. This is applicable to Android Studio too.
You can also find the document from Android Studio -> Help -> Default Keymap Reference
The shortcut to go to a specific line and/or column number is: CTRLG
(archive)
Examples:
Go to line 6
CtrlG6Enter
Go to line 6 and column 8
CtrlG6:8Enter
Go to column 4 on the current line
CtrlG:4Enter
Shortcut References:
AltHK = H̲elp -> Default K̲eymap Reference
IntelliJIDEA_ReferenceCard.pdf (archive)
Android Studio Shortcuts You Need the Most (archive) • PDF version (archive)
The shortcut to go to a particular line number on Android Studio is
On Mac
: Cmd + L
On Linux
: Ctrl + L
On Windows
: Ctrl + G
After this key in the line number in the dialog box that pops up.There is an option to insert the column number as well, but it is not necessary.
If you are in the specific file,
You can use Ctrl + G. And insert the line You wanted. If you want to go to a specific column of the lineNo you can insert lineNo:columnNo.
If you are in some file and you want to navigate into some line of a some other file,
You can simply use default navigation shortcut Ctrl + Shift + N, and insert fileName : lineNo.
NOTE: You don't need to insert the whole name of the file, some text that enables intellij to uniquely identify your file would be good enough. Your input text might turn into red color. But it works. :)
For Windows users shortcut is: Ctrl + G
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 1 year ago.
Improve this question
Is it possible to copy text from a file, opened with nano, to the shell?
I have a text file, and I want to copy several lines to the console, but I cannot find a keyboard shortcut to copy the text.
Nano to Shell:
1. Using mouse to mark the text.
2. Right-Click the mouse in the Shell.
Within Nano:
1. CTRL+6 (or CTRL+Shift+6 or hold Shift and move cursor) for Mark Set and mark what you want (the end could do some extra help).
2. ALT+6 for copying the marked text.
3. CTRL+u at the place you want to paste.
or
1. CTRL+6 (or CTRL+Shift+6 or hold Shift and move cursor) for Mark Set and mark what you want (the end could do some extra help).
2. CTRL+k for cutting what you want to copy
3. CTRL+u for pasting what you have just cut because you just want to copy.
4. CTRL+u at the place you want to paste.
Much easier method (for short pieces of text):
$ cat my_file
Ctrl+Shift+c to copy the required output from the terminal
Ctrl+Shift+v to paste it wherever you like
For whoever still looking for a copy + paste solution in nano editor
To select text
ctrl+6
Use arrow to move the cursor to where you want the mark to end
Note: If you want to copy the whole line, no need to mark just move the cursor to the line
To copy:
Press alt + 6
To paste:
Press ctrl + U
Reference
nano does not seem to have the ability to copy/paste from the global/system clipboard or shell.
However, you can copy text from one file to another using nano's file buffers. When you open another file buffer with ^R (Ctrl + r), you can use nanos built-in copy/paste functionality (outlined below) to copy between files:
M-6 (Meta + 6) to copy lines to nano's clipboard.
^K (Ctrl + k) to cut the current line and store it in nano's clipboard.
^^ (Ctrl + Shift + 6) to select text. Once you have selected the text, you can use the above commands to copy it or cut it.
^U (Ctrl + u) to paste the text from nano's clipboard.
Finally, if the above solution will not work for you and you are using a terminal emulator, you may be able to copy/paste from the global clipboard with Ctrl + Shift + c and Ctrl + Shift + v (Cmd + c and Cmd + v on OSX) respectively. screen also provides an external copy/paste that should work in nano. Finally if all you need to do is capture certain lines or text from a file, consider using grep to find the lines and xclip or xsel (or pbcopy/pbpaste on OSX) to copy them to the global clipboard (and/or paste from the clipboard) instead of nano.
The thread is quite old, but today I humbled around with the same question and all the mentioned solutions above did not help. As I wished to copy long lines my solution is - acording to what #themisterunknown wrote above - outside nano. I used awk!
awk '{ if (NR==87) print $0 }' filename
where NR==[line number] and $0 is complete line.
I don't know any way to do this directly in nano. However you can use "cat" or "grep" to display lines of your file in the console.
If you use a terminal multiplexer like "screen" you can copy and paste strings like this.
Simply use Ctrl+Shift+6 to copy current line or you can set mark using Ctrl+6 and copy multiple lines using above command as well.
Relatively straightforward solution:
From the first character you want to copy, hold Shift down and go all the way to the end.
Press Ctrl+K, which cuts the text from the file.
Press Ctrl+X, and then N to not save any changes.
Paste the cut text anywhere you want.
Alternatively, if your text fits into the screen, you can simply use mouse to select and it automatically copies it to clipboard.
The following works in Nano but also anywhere in a terminal:
Copy text from a terminal, after selecting with your mouse: Ctrl + shift + C.
And to past text in to a terminal: Ctrl + shift + V.
The copy buffer can't be accessed outside of nano, and nowhere I found any buffer file to read.
Here is a dirty alternative when in full NOX: Printing a given file line in the bash history.
So the given line is available as a command with the UP key.
sed "LINEq;d" FILENAME >> ~/.bash_history
Example:
sed "342q;d" doc.txt >> ~/.bash_history
Then to reload the history into the current session:
history -n
Or to make history reloading automatic at new prompts, paste this in .bash_profile:
PROMPT_COMMAND='history -n ; $PROMPT_COMMAND'
Note for AZERTY keyboards and very probably others layouts that require SHIFT for printing numbers from the top keys.
To toggle nano text selection (Mark Set/Unset) the shortcut is:
CTRL + SHIFT + 2
Or
ALT + a
You can then select the text with the arrows keys.
All of the others shortcuts works fine as the documentation:
CTRL + k or F9 to cut.
CTRL + u or F10 to paste.
Select the text in nano with the mouse and then right click on the mouse.
Text is now copied to your clipboard.
If it does not work try to start nano with the mouse option on :
nano -m filename
First method
This method seems to work when the content doesn't include ●.
Install xsel or similar and assign a global shortcut key for this command in your WM or DE:
xsel -o | sed -r 's/^ ?[[:digit:]]+($| +)//g' | perl -pe 's/\n/●/g' | sed -r 's/●●/\n\n/g; s/ ?● {1,}/ /g; s/●/\n/g' | xsel -b
Put this in your ~/.Xresources:
*selectToClipboard: false
Issue this in your xterm once to activate the above option:
xrdb -load ~/.Xresources
Now select the line(s) including the line numbers by pressing Shift while dragging the mouse. After the selection click your key combo; the line(s) are coppied and ready to be pasted anywhere you like.
Second method
Doesn't have the shortcoming of the first method.
Install xdotool and xsel or similar.
Put these two lines
Ctrl <Btn3Down>: select-start(PRIMARY, CLIPBOARD)
Ctrl <Btn3Up>: select-end(CLIPBOARD, PRIMARY)
in your ~/.Xresources like so:
*VT100*translations: #override \n\
Alt <Key> 0xf6: exec-formatted("xdg-open '%t'", PRIMARY, CUT_BUFFER0) \n\
Ctrl <Key>0x2bb: copy-selection(CLIPBOARD) \n\
Alt <Key>0x2bb: insert-selection(CLIPBOARD) \n\
Ctrl <Key> +: larger-vt-font() \n\
Ctrl <Key> -: smaller-vt-font() \n\
Ctrl <Btn3Down>: select-start(PRIMARY, CLIPBOARD) \n\
Ctrl <Btn3Up>: select-end(CLIPBOARD, PRIMARY)
Issue this in your xterm once to activate the above option:
xrdb -load ~/.Xresources
Create this scrip in your path:
#!/bin/bash
filepid=$(xdotool getwindowpid $(xdotool getactivewindow))
file=$(ps -p "$filepid" o cmd | grep -o --color=never "/.*")
firstline=$(xsel -b)
lastline=$(xsel)
sed -n ""$firstline","$lastline"p" "$file" | xsel -b
Assign a global shortcut key to call this script in your WM or DE.
Now when you want to copy a line (paragraph), select only the line number of that line (paragraph) by right mouse button while pressing Shift+Ctrl. After the selection click your custom global key combo you've created before. The line (paragraph) is coppied and ready to be pasted anywhere you like.
If you want to copy multiple lines, do the above for the first line and then for the last line of the range, instead of Shift+Ctrl+Btn3 (right mouse button), just select the number by left mouse button while pressing only Shift. After this, again call the script by your custom global shortcut. The range of lines are coppied and ready to pasted anywhere you like.
M-^ is copy Text. "M" in my environment is "Esc" key ! not "Ctrl";
so I use Esc + 6 to copy that.
[nano help] Escape-key
sequences are notated with the Meta (M-) symbol and can be entered using
either the Esc, Alt, or Meta key depending on your keyboard setup.
1) Ctrl + 6 to mark the text that you want to copy
2) Ctrl + k to cut the text and Ctrl + u to paste back to the original place
3) Go to the desired line where you want to paste the code marked in step (2). Ctrl + u to paste it.
Hope it helps.
I decided to give zsh a try. First i'll describe how things work right now and then i'll describe how I would like them to work.
Lets say I have 2 subfolders in current folder, 1st one "Documents", 2nd one "Downloads".
If I type "cd D" and press TAB, it will auto complete with "Do".
Press TAB again, it will auto complete with "Documents".
Press TAB again, it will auto complete with "Downloads".
Press TAB again, it will auto complete with "Documents" (I appreciate that here it dosen't go back to "Do" like Bash does).
At this point I have to pres Enter twice to change the directory. (first Enter to select "Documents" and second one to execute the comand).
How I would like zsh to behave:
If I type "cd D" and press TAB, I would like to auto complete with "Documents".
Press TAB again, should auto complete with "Downloads".
Press TAB again, should auto complete with "Documents".
Press Enter once and the directory should change to "Documents".
How can I do this? :-)
Wow, one year and no replies. I hope you found out how, but for others who might come across this via a search...
First make sure you have the completion module loaded with this line
zmodload zsh/complist
Then you can bind Enter, aka ^M, during menuselect to the function accept-line - which is normal behaviour - but by prefixing it with a dot, if forces it to leave menuselect mode before the function executes
bindkey -M menuselect '^M' .accept-line
How I can search within a specific block of code or selection in IntelliJ IDEA?
I got used to using this feature in Eclipse. In Eclipse you can just double click on the beginning of a curly bracket, and it'll highlight the entire block of code. After which you could do Command+f
(Ctrl+f on Windows) to search ONLY in the highlighted block, or you could just highlight whatever you need and search just that block of code.
Go to Settings | Keymap, search for the Find... action in the Other group. This action should have the following description:
Find a string in active editor, shows
modal dialog
Assign a keyboard shortcut to this action (you need to make a copy of default keymap to modify it), for example Ctrl+Alt+Shift+F.
When in editor, select any block of text, then press this shortcut, a dialog will open with the Scope automatically set to Selected text:
To quickly select the method body while standing on the opening curly brace use Ctrl+W.
As of 2020, I'm able to perform find in selection on PhpStorm
Select the block of text and hit Cmd + F on MacOS / Ctrl + F on other platforms
On the find toolbar (that appears on top) there's an In Selection button; use that to limit search scope to the selected text only
Here's the link to my original answer on JetBrains support forums
I'm using
PhpStorm 2020.1.2
Build #PS-201.7846.90, built on June 3, 2020
First select some text and press ctrl+R to open the dialog, then check the "in selection" option :
In current version, 2020.2, default for Find In Selection is Ctrl+Alt+E.
On IntelliJ in Mac:
In a file select the specific block in which we want to find something
Press CMD + F
Press CTRL + OPTION + G
Notice that the cursor has automatically landed in the find toolbar's text field
Type in what is intended to be found
Press enter to move the cursor to the first occurrence.