#ProgrammingShortcuts #Efficiency #CursorMovement 🖱️
Hey there fellow programmers! 👋
So, let’s talk about cursor movement in coding. Have you ever wondered how those experienced programmers zip through their code with lightning speed? I mean, seriously, how do they do it? 🤔
As a beginner myself, I totally get the struggle of constantly moving my hand to the arrow keys or using the mouse to navigate. It just slows down the whole coding process, right? 🐢
But fear not, my friends! There are some nifty tricks and shortcuts that can help you move your cursor more efficiently, without having to disrupt your flow on the keyboard. Here are a few techniques you might find helpful:
– Utilize the Home, End, Page Up, and Page Down keys for quick vertical movements
– Try using Ctrl + Arrow Keys for faster word-by-word navigation
– Experiment with Ctrl + Home/End for jumping to the beginning or end of a line
By incorporating these shortcuts into your coding routine, you’ll be able to navigate through your code like a pro in no time! 🚀
Do you have any other tips or techniques for moving the cursor quickly and effectively? Share your wisdom with us! Let’s help each other level up our coding game. 💻
Happy coding, everyone! 💪👩💻👨💻
Vim
A handy hotkey combo to know is Ctrl + left/right arrow, which will bring your cursor to the beginning/end of the word its on.
This doesn’t change you having to move your hand to the arrow keys, but it’s still very good to know.
When I am using Emacs, there is shortcuts using left hand to move cursor around in a lot of ways, when a person is used to it, you can go very fast. And it doesn’t use the arrow keys for this, so it is easier when you are unused to it
But otherwise, learning shortcuts, you don’t need to have your hand on a mouse really, so your other hand could be closet to the other keys.
Navigating without mouse through keyboard shortcuts, I find is much quicker
Some are just good at moving their hands to the arrow keys, but I suspect many of the people you’re watching are using vim keybindings. Vim keys are explicitly designed to avoid this issue. You hit key to change mode (e.g. capslock, personally I use “jk”) and then hjkl become your arrow keys. Other keys like w and b jump word by word, ^ and $ go to beginning and end of line, etc. etc. Once you’re used to this, it is far faster than switching to arrow keys or using the mouse.
Keybindings, shortcuts and macros.
Whenever I code in vi, my other friends say “oh Unix Gandalf the White is here again”.
It’s just practice.
Also, I almost never use the mouse.
Those techniques are editor specific shortcuts. For example, M-a moves cursor at the beginning of line, M-e to the end of line, M-k “kills” deletes the line etc… M stands for Meta and it’s usually Ctrl and these shortcuts are from Emacs. Just learn Vim/Emacs and literally every editor can emulate that stuff.
When those shortcuts enter your muscle memory you are unstoppable hahah
tldr: look up “vim” and “vim motions”
slightly longer answer: There are many ways to move around text quickly. A lot of IDEs have shortcuts to get to the definitions and declarations of functions, methods, classes, a lot of them have the cuts to go to the matching brackets, which both immensely increase your speed when operating with code. However, when you see more experienced developers (and showoffs), there is always a chance they use either Vim or Vim motions integrated into a real IDE, which allow for very fast text traversal and editing at the cost of hours of practice required to actually remember them
You can use CTRL+arrow keys to move by word.
Press the HOME or END keys to jump to start/end of a line.
Invest time to learn vim bindings if you code editor supports it.
>I find it inefficient to move my hand all the way to the arrow keys on my keyboard
VIMbait detected
Thank you everyone! Gonna have a look at Vim!
Learn vim hotkeys
You have to learn Vim/Neovim. It’s called mouseless coding. I love that you asked. When I first started programming, I thought it is just magic, some personal tool used by the tutor that I won’t have.
Practice?
Moving hand? Arrow keys? Laughing with my HHKB…😎
Honestly I think it’s that most programmers have played pc games their whole lives
xset r 140 60
Ctrl+D in Sublime Text 😉
I’m going to throw in a completely different option. I use a 60% keyboard where the arrows are bound to func (which I use the caps key for) IJKL. My hands don’t have to travel to reach arrow keys.
Ctrl/shift + arrow keys, and if you have a full keyboard then buttons like end, home, etc are good for beginning & end of line. Also all IDEs have their own shortcuts, I like intelliJ’s just cause I’m used to it but mostly use mouse anyways besides the ones I listed above
Besides all the home, end, ctrl arrow word select, one of the best shortcuts for me is one most IDEs have that move you to the last cursor position. So if you say ctrl click a method and trace that through a few files you can hit that key combo a few times to get to the last place. Also useful if you scroll up to declarations it’s nice to jump back where you were last.
When you’re familiar with the project, a lot of time can be saved by using different kind of search tools that speeds up navigation: search for file by name, search for something in the file, iterate over same words, all of this are either exact or fuzzy search.
For me the main paradigm in navigation is to use different ways on different “levels” like dirs/files, single file, single class/function, single line. And arrows and ctrl+arrows are only used on the last (smallest) levels, everything else is more efficient with search
This sounds like you already knew about vim and decided to make a post acting like you didn’t
HOME or END is the Key 🙂
Are you watching other people do this when they’re actually coding, or just something you noticed in YouTube videos and other presentations? Because those are rehearsed. It’s very easy to write code very quickly when you’ve written that specific code a half-dozen times already.
Emacs
vim rules
They’re not, they are using keyboard shortcuts…
Honestly it’s just “learn the tools you use”. When I was a TA at a bootcamp my boss let me know that if he used a tool alot he would spend 1hr a week learning how to use that tool better. In my current software role I use vim so I don’t need the mouse at all but you can be equally as fast if you take w/e code editor you are using (likely VS Code and that’s fine), but if you take some time each week and learn new things about your tools you will get faster and faster and faster
Git gud.
All the help there is, is using proper shortcuts/keybindings for your IDE, getting used to them and using everything that you feel would speed up how quickly you move. Before you find out it will come natural and won’t be struggling with it.
Ctrl+left/right and using the home/end keys gets you 90% of the way to super fast, VIM bindings can get you the other 10%.
Ctrl-click is pretty handy in IDEs that have a “jump to definition” too.
It is about not using mouse
People who code fast are not always better than those who code slow. Anyway they know the hot keys
You don’t need vim to do this and the purists are trying to bait you.
I’m gonna break the circlejerk here and say don’t bother with vim if you’re a beginner. It’s nice to know at best and it won’t make you a better programmer if you’re lacking in other departments, namely problem solving.
They are fast but as a person who codes I’ve learned that Lot of it is actually just knowing the shortcuts of your application. There are tons of tricks to quickly move things around in VS code for instance you don’t actually need to select a line to copy it. If the cursor is at the end of the line you can just ctrl c/x
Not a programmer but I use (vim-style) remapping to do all movement on the homerow system-wide. It’s wonderful for writing text, especially adding undo, redo, delete word forward and back.
[https://manybutfinite.com/post/home-row-computing/](https://manybutfinite.com/post/home-row-computing/)
If you’re basing that on youtube videos those people are editing out any mistakes they make and speeding up a lot times.