I'm using IPython for some lectures and it would be very convenient if at different points during the lecture if I could add a few lines (say 3 or 4) to the input history. That way I could recall them with a couple of up-arrow keystrokes.
I don't want to clear the history or start the session with a new history. I need to push a few lines at a time.
Related
As the title says.
I want to be able to open from anywhere a split window with today's diary ready to write.
I'm pretty new to NVim so excuse my naivete.
I have written in my vimrc the following:
nnoremap <leader>nd <C>wv2<leader>w<leader>w
I want to bind <leader>nd (as in new diary) to the two actions: <C>wv (a vertical window split) followed by 2<leader>w<leader>w (accessing my 2nd wikis diary)
So when the motion is complete, I should have today's diary open split from what I am presently working on, with my cursor in the diary.
Is this even the right approach to executing something like this or do I need to do something entirely different?
I hoped it would do what I wanted it to do. But instead NVim isn't recognizing what I'm inputting at all. Only recognizing that I hit n. And thus does the last-search-action that is the default action corresponding to n in vims normal mode.
I'm writing a vscode plugin to simultaneously comment out and duplicate a line. A key sequence of actions within the plugin (modulo several selections etc) is the following:
vscode.commands.executeCommand("editor.action.commentLine");
vscode.commands.executeCommand("editor.action.copyLinesDownAction");
vscode.commands.executeCommand("editor.action.commentLine");
So this is fine and it works. The only problem is: the undo/redo history treats all these commands as separate operations... so I do the whole thing with a single keystroke, but if I want to undo, I have to hit Cmd+Z 3 times, which feels confusing.
How I instruct VSCode to treat a sequence of commands as a single "block" within the undo/redo history?
As per vim wiki:
Vim remembers the locations where changes occurred. Each position
(column number, line number) is recorded in a change list, and each
buffer has a separate change list that records the last 100 positions
where an undo-able change occurred.
One can then use g; to move to the last change in the change list. This list survives through different sessions. This means, that even if one did not make any change to the file after opening it in a new session, g; will move the cursor/point to the line where the latest change occurred in previous session.
From what I can tell, evil-mode does not have the change list per buffer which survives session. Or does it?
You probably want to have a look at Undo Tree, which is used by evil-mode if undo-tree is installed. I do not think that it has the g; functionality that you describe though. It can, however, maintain undo history between sessions.
Take a look at goto-last-change on melpa. Evil has default integration through g;.
assume I have focus on BrokerSyncMasteredRecord.cc. I want to fast copy BrokerSyncMasteredRecord.cc to the left by one stroke(like some hotkeys). the final state in pic 2. Currently, I can only use C-x b and type in a few chars of the buffer name. this is very slow.
NOTE: this should not be another opened replica buffer(e.g., BrokerSyncMasteredRecord.cc[replicated], you know what i mean if you are a emacs user) but exact the same buffer, just show in two different windows
I'll just quote the Emacs tutorial (f1 t) for you:
* MULTIPLE WINDOWS
------------------
One of the nice features of Emacs is that you can display more than
one window on the screen at the same time. (Note that Emacs uses the
term "frames"--described in the next section--for what some other
applications call "windows". The Emacs manual contains a Glossary of
Emacs terms.)
>> Move the cursor to this line and type C-l C-l.
>> Now type C-x 2 which splits the screen into two windows.
Both windows display this tutorial. The editing cursor stays in
the top window.
This basic tutorial is just 1000 lines, almost small enough to use as a capcha
for asking questions about Emacs:)
Commands entered after pressing M-x can be viewed using the up/down arrow keys.
How can I get a list of all the commands including menu bar invocation, commands
triggered using mouse clicks, etc. in Emacs?
For a complete list of history, type C-h l (lowercase "L").
Note: this list is complete in the sense that it keeps all events and commands that happened recently, but it's not complete in the sense that it only keeps track of the last 300 or so events (and corresponding commands).
I've used mwe-log-commands to make screencasts. It shows events and the commands they trigger as you work in Emacs.
command-log-mode
I've just forked it and made it into a proper minor-mode and global-minor-mode along with some other improvements as command-log-mode.
Give it a shot and file issues against me if the documentation is unclear or if you find any bugs.
So you want the history of of all commands, regardless of where they are executed? I don't know if emacs provides this by default, but you can add your own function to post-command-hook which is executed after every command, so you can use it to collect all the executed commands.
M-x view-lossage
From emacs documentation
(view-lossage)
Display last few input keystrokes and the commands run. For
convenience this uses the same format as edit-last-kbd-macro. See
lossage-size to update the number of recorded keystrokes.
To record all your input, use open-dribble-file.
(open-dribble-file FILE)
Start writing input events to a dribble file called FILE. Any
previously open dribble file will be closed first. If FILE is nil,
just close the dribble file, if any. If the file is still open when
Emacs exits, it will be closed then.
The events written to the file include keyboard and mouse input
events, but not events from executing keyboard macros. The events are
written to the dribble file immediately without line buffering.
Be aware that this records all characters you type! This may include
sensitive information such as passwords.