Do I save time using the h, j, k, l keys? [closed] - vim

As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.
Closed 11 years ago.
I've tried using the h, j, k and l keys for a while in Vim, but did not get used to it and fell back to using the arrow keys. My question is: from your experience, is it worth switching to these keys? Did you achieve faster typing/navigating?

When I first used Vim, it seemed very difficult to stick to hjkl after years of maintining a habit of navigating with arrow keys.
Then I learned actual touch typing.
After that, not only did hjkl feel more natural than the arrow keys. Everything computer-related became faster. It's really worth the investment timewise (I'm assuming you're not a touch typer, otherwise you wouldn't have asked this question).
By the way, Vim is incredibly useful when learning to touch type. Just keep a keyboard diagram closer to the screen than to the actual keyboard when learning, ideally a keybord diagram with vim usage on it.

IMHO, no, it's not worth the trouble. I've tried it, and I couldn't get used to it either.
The whole point of those using those keys was that most keyboards, at the time of Vi's creation, did not have arrow keys. I've yet to run across a modern keyboard without those keys.
I could be wrong.

I like it. Having discovered visual mode used with f/F and t/T could cut and replace so quickly, easy access to ; became necessary. And you can go straight to . with the 3rd finger too.

Related

Easy typing for non-english keyboards vim users [closed]

As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.
Closed 10 years ago.
In English or US keyboards keys like \, /, [ and ] are very easily typed with only one key stroke. Usually is not the same for non-english keyboards.
Is there a way to achieve the same easiness of typing for these type of keyboards?
If it is a matter of mapping keys can you please put clear instructions to do it? (Spanish layout example is welcome)
EDIT: Examples by distinct languages are very welcome!
I've suggested something already in the comments. Now, as far as simple mappings go, for normal mode you can always do the simple remapping of main keys.
nnoremap : >>
nnoremap ; >>
for example, for indent (I'm on Croatian keyboard layout here ... where the < and > characters are, I have ; and : ... I'm sure you understand the example). You can analogly remap all your local characters with parenthesis, brackets or any other essential characters.
I personally just use the US keyboard whenever I'm programming cause I need most of these special keys as characters anyways. You could use different keymappings, but I personally don't think this is such a good solution - if you ever have to work on another machine you won't be able to use vim at all. If you need to type spanish characters you can just switch your keyboard layout back when typing.

Emacs as an editor (as opposed to VIM) [closed]

As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.
Closed 11 years ago.
I recently started using emacs as an everyday environment, half because I always wanted to gain the perspective of "the other side," and half because I'm forced to at work :P. Its been a week and I can definitely see the advantages of using emacs and what it means to "live inside emacs." The buffers are very convenient and just the ability to search through the buffer as if it is an editor is amazing. Emacs has been my "shell" since the day I started it last week.
However, when it comes to editing code, I am still not convinced that I should use emacs as opposed to vim. I don't know if it is because I am too used to vim, but with emacs to move around text I always need an extra key, such as 'M-f' instead of 'w,' or 'C-f' instead of 'l'. Is this just a learning curve that I have to overcome?
I am not trying to start a flame war, I would just like some perspective. Thanks!
I started with vim but left it many years ago for emacs. I can say that it took me much longer to be converted to the baseline editing interaction (key combinations, non-modal, etc.) than it did to recognize the value of "living inside emacs," as you say. So my advice would be to actually do the emacs tutorial (C-h t, yes it's worth it) to be sure you're really using the full power of emacs' baseline editing interactions, and give it a month to see if you're converted organically. If not, then give each vim-mode and viper a try. If you're still not converted then do your code editing in vim. :-)
But the most salient point here is do not jump to vim-mode or viper, give it a good long while to see if you can enjoy emacs editing interaction without introducing more emacs add-ons which might have weird interactions with other emacs add-ons.
One thing that distinguishes vi (and gvim and nvi and all the other vi clones) is that it's modal. That means that when you're not in edit mode, you can use single letters as commands. Other editors, like emacs, don't have modes, so a single letter with no modifier is usually just inserted into the buffer. That's why commands in emacs need to have modifiers.

Learning a new language project [closed]

As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.
Closed 10 years ago.
Does anyone have a standard project that they use when learning a new language. Kinda like a specification document of a project that includes all aspects of programming. Does anyone use some sort of beginning type project when learning a new language? I guess it also depends on the type of language and what's it's capable of.
Contributing something to an open source project seems to work for me. In addition to getting exposed to some coding habits in the language , you get to work on something useful.
Going through the first few problems of Project Euler is a very good way to get a handle on topics like I/O, recursion, iteration, and basic data structures. I'd highly recommend it.
A friend of mine had a coworker who coded a minesweeper every time when he wanted to learn a new language with GUI.
I like making simple websites for learning.
Pro: you can put it online and show it to people.
Con: the language has to be suitable for web development.
Writing a simple ray tracer:
math functions (pow, sqrt, your own intersection routines)
recursion (because it is a whitted style recursive one)
iteration (for all pixels)
how to write custom types (rays, possibly vectors)
pixel wise graphics
have something to play with compiler's (optimization-) flags
optional:
simple GUI
file reading writing
I've also done so with metatrace.

Why don't more people use emacs with viper-mode? [closed]

As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.
Closed 12 years ago.
I've started to use emacs, and I've found out that while the editor-specific features of emacs are better than those of vi, the text-manipulation methods of vi are better than those of emacs (and easier on your control-pinky!).
It seems that viper-mode, a marriage of the two best parts of each editor, is the ideal solution for someone that wants a complete editor.
But before I start investing my time learning the vi commands in the emacs environment, I'd like to know why it doesn't seem like many people use viper-mode. Is there something I'll find out after using it a while that will cause me to switch to plain emacs or vi?
Because you are either a vi person or an emacs person. The same way you're either a dog person or a cat person.
On a more serious note, why would I change? vi offers me all the power I need and I'm pretty certain the emacs people would feel the same way about their editor of choice.
I've used vi for over twenty years and some of its features still surprise me (admittedly, it's usually vim rather than vi nowadays). I don't want to dedicate the next twenty years of my life at becoming adept with emacs. There's no benefit and plenty of cost, and pretty much all of my non-minor decisions are subject to cost/benefit analyses.
Mostly, it comes down to what you're comfortable with. It took years for me to stop trying to use the WordStar 3.3 CTRL-K CTRL-X key sequence to exit from most editors. It had burnt itself into my spinal cord so that all the brain had to do was issue an exit command and the lowest levels of the nervous system would take over.
And, anyway, emacs with its strange command sequence like
CTRL META LEFTSHIFT RIGHTSHIFT WINDOWS OPENAPPLE ALT K
is better suited to aliens with 87 fingers, or elite pianists :-)
People who want vi-like usage use vi, people who want Emacs-like usage use Emacs.
I think you get some vi people moving to Emacs to get functionality like org-mode (or some other "killer" functionality that doesn't exist in vi). And those people probably use viper-mode to ease the transition.
Regarding the actual question of "is there something I'll find out..." - everybody is different. Maybe viper's lack of C-o command (do one command and go back to insert mode (or something like that)) is just too painful to not have. Or, maybe you'll find that the allure of not having to switch between command and insert modes is attractive and go for straight Emacs.
I think the benefit of viper-mode or vimpulse is that it makes the learning curve for vi-users is negligible for 95% of what you'll do. But you have the possibility of using the other parts of Emacs that you can't get in vim (whatever those things are that you find attractive).
I "get" vim, that is a massive investment. I get vimscript, that is another massive investment. I have no desire to learn the wildly complex internals of another editor and the intricacies of emacs-lisp, especially since the only thing I would really want there that I can't have here is better repl support.
Also, viper is nowhere near enough. vimperator comes close, but nothing beats vim.
Because I don't want vi, I want vim with syntax highlighting.

Good guide on VIM Scripting? [closed]

As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.
Closed 10 years ago.
I've used VIM for 10+ years, but never really into VIM scripting (always subjectively beliving that this was one area where VIM was weaker than Emacs).
Recently, the realization "in a VIM script, I can execute normal mode commands" made my mind go "a-ha" and suddenly start realizing why parts of VIM script is the way it is.
normal ma10jd'a20kp
is much more elegant than
Marker m = currentLocation();
advanceLines(10);
Buffer b = delete(currentLocation(), m);
advanceLines(-20);
insertBuffer(b);
Now question is -- what's a good resource to learn vim scripting from?
Thanks!
The best advice I can give is that you read:
:help usr_41.txt
which will give you a good overview of the basics. Then find some things that you want to do and create functions for them. While you're doing this, make heavy use of:
:help function-list
to get an idea of what all the built in functions are. Most of it is fairly similar to other scripting languages (albeit a harsher syntax), so any experience you have of text manipulation in python or whatever will be useful.
Also, look on the vim scripts page and Google to get examples of existing scripts to help expand your knowledge.
Finally (and probably most importantly), don't be afraid to ask on stackoverflow or the Vim mailing list and there'll be plenty of support for any problems you may have.
Learn Vimscript the Hard Way is worth checking out too.
http://learnvimscriptthehardway.stevelosh.com/
Al gave you a good answer. I'd also add vim.wikia that has a few tips related to your question.
On a side note.
I wouldn't say that ma10jd'a20kp is more elegant. I see the following problems:
it's quite difficult to maintain (what if the number of lines shall become a parameter?),
people like to override keys they never learned to use (this could be fixed with a banged :normal!),
some normal-mode commands have strange behaviour on side-case (like <esc> when the cursor is on the first column),
it messes the mark a, and the unnamed register -- other scripts, or even the user may expect their values to not be altered by your script.
I'm in a similar situation. It's still on my "to read" list, but I just found Scripting the Vim editor today. The articles from IBM's DeveloperWorks are usually very good, so probably worth checking out.

Resources