in Education by
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)

1 Answer

0 votes
by
Jumping with f I'd do C-r a RET DEL That's not as good a vim. Vim really shines in this area. Navigating Windows My workflow is to have two windows, that leaves me with C-x o always doing what I want. I do a lot more buffer switching and not much window navigation. I don't try to get buffers in particular windows. I mult task by task switching, not looking at multiple windows at the same time, you might be different. I use helm and use an symbolic-label non-visual approach. It goes like this, I have the feeling that I need to something else, I think the words related to it, I hit C-x b, I type the words, the thing is at the top of helm-minibuffer. You can probably find a multi window workflow that will fit your style. Copy pasting, moving lines etc. There's kill-whole-line bound to C-S-backspace. c-u 80 / C-S-backspace // SECTION C-y I don't know how to repeat the last action that is not a motion. I often record a macro even for short things I'm going to use twice. Moving the Cursor C-l will call recenter-top-bottom. This will cycle through those positions. Good luck.

Related questions

0 votes
    This question already has answers here: Find and replace strings in vim on multiple lines (11 answers) Vim ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Apr 16, 2022 in Education by JackTerrance
0 votes
    I would prefer to write my commit messages in Vim, but it is opening them in Emacs. How do I configure Git ... for a single project. Select the correct answer from above options...
asked Feb 2, 2022 in Education by JackTerrance
0 votes
    This is currently how I copy code from an editor to a search field in VS code using vscodevim. ... JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked May 3, 2022 in Education by JackTerrance
0 votes
    I can use vi{ and va{ to select C++ code blocks. It helps me a lot when I need to yank ... questions, JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Aug 1, 2022 in Education by JackTerrance
0 votes
    I am interested in enabling code folding in Vim for Python code. I have noticed multiple ways to do ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Mar 11, 2022 in Education by JackTerrance
0 votes
    I am interested in enabling code folding in Vim for Python code. I have noticed multiple ways to do ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Mar 11, 2022 in Education by JackTerrance
0 votes
    I am interested in enabling code folding in Vim for Python code. I have noticed multiple ways to do ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Mar 11, 2022 in Education by JackTerrance
0 votes
    When I cut (kill) text in Emacs 22.1.1 (in its own window on X, in KDE, on Kubuntu), ... questions, JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Mar 27, 2022 in Education by JackTerrance
0 votes
    When coding in elisp, I find that I'm stopping at hyphens when moving by words, and would prefer ... JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Feb 12, 2022 in Education by JackTerrance
0 votes
    This question already has answers here: Forming a matrix by summing 2 arrays element-array wise using NumPy ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked May 10, 2022 in Education by JackTerrance
0 votes
    This question already has answers here: Forming a matrix by summing 2 arrays element-array wise using NumPy ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked May 8, 2022 in Education by JackTerrance
0 votes
    When I go to command mode and type :!mycommand % I get my command executed on the current file ( ... JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Jan 13, 2022 in Education by JackTerrance
0 votes
    I program with Emacs on Ubuntu (Hardy Heron at the moment), and I like the default text coloration ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Mar 27, 2022 in Education by JackTerrance
0 votes
    The context is that I am copy pasting React props definition into the function arguments, so that I ... .string.isRequired, formPlaceholder: PropTypes.string.isRequired, };...
asked May 7, 2022 in Education by JackTerrance
0 votes
    I've been using Vim exclusively for a few weeks now, and a few things are keeping me from being ... JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Mar 4, 2022 in Education by JackTerrance
...