Currently I try to switch from vim to emacs and have some difficulty while editing code. For most of the very simple vim keystrokes, I found an emacs version like simple movement
h, j, k, l are C-b, C-n, C-p, C-f
w, b are M-f, M-b
I, A are C-a, C-e
...
but for some of the "more advanced" features I am used to, I am not sure what the emacs way of doing stuff is.
Here are some problems I have in my current workflow when I use emacs.
Please show me how emacs people do this stuff (obviously without using a vim emulation) or what the alternative emacs-friendly workflow is.
Jumping with f
When I write something in vim and notice, I need to change something in that line I can use f to simply jump to it
int foo = caallFoo();
^
In this case I would Fad to delete that 'a'. In emacs, I currently M-b and C-f until I find the character I want to edit. I try to use Ace Jump (which is a nice plugin) but for jumping in the line I currently am in this still feels bad.
So what is the emacs way of quickly navigating in a line without going crazy?
Navigating windows
My workflow often includes having multiple windows open in vim (lets say a file-browser, 4 code windows and a tagbar) and navigating works with C-w h, C-w j, C-w k and C-w l. When I press C-w s or C-w v a new window, it opens and relayouts all windows.
So far I've seen C-x 2 and C-x 3 in emacs to open new windows, but the size of them becomes smaller each time, as the newly created window and the focused window now share the space the focused window used to have. To navigate I only found C-x o which just cycles through the windows and does not let me pick a specific window to go to.
I've seen that some people use plugins to get a more sane multi-window workflow.
Is there already some good window-navigation built into emacs or should I find a plugin that does the job for me? Or is my workflow with around 4-6 windows something I should not do in emacs.
Copy pasting, moving lines etc.
Something I like to do in code files is to create comments to visually mark certain sections.
////////////////////////////////////////////////////////////////////////////////
// SECTION
////////////////////////////////////////////////////////////////////////////////
In vim I create it with something like 80a/yyppklC (80 times append a '/', copy that line and paste it two times, in the second line change everything after the second '/') and enter the name.
The creation of the first line is just as easy in emacs C-u 80/ (80 times write '/') but copy-pasting would be something like C-a C-SPC C-e M-w C-y C-y (go to the beginning if the line, set a mark, go to the end of the line, copy everything, two times make a new line and paste). And then to write the section name C-a C-p C-f C-f C-k (go to the previous line, go to the beginning, go two chars right, delete until the end)
My emacs variant uses many keystrokes and is conceptually more complicated. If I could repeat the last action like in Vim, I would not have the problem with copy pasting (in vim 80a/j.j.) but in emacs repeating the last command would be navigating to the next line instead of "80 times insert '/'")
How do I better copy/cut/paste whole lines? Or what is the alternative?
How do I repeat the last action which is not a motion?
Moving the cursor
Something of a more simple movement I like to do while looking through code is moving the cursor with C-d and C-u. In emacs I only know C-v and M-v which moves the screen up and down and place the cursor at the beginning. How do I move the cursor down half a screen? Or alternativly how do I place the cursor in the middle/top/bottom of the screen like H, M, L do in vim?
JavaScript questions and answers, JavaScript questions pdf, JavaScript question bank, JavaScript questions and answers pdf, mcq on JavaScript pdf, JavaScript questions and solutions, JavaScript mcq Test , Interview JavaScript questions, JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)