-
Notifications
You must be signed in to change notification settings - Fork 0
Useful Tools for 2030 Practical
KoalaLyfestyle edited this page Mar 25, 2024
·
6 revisions
- Navigate to a specific folder - cd "[folder_name]" -> in this case, if your folder name has a space, enclose your folder name in a string so that the space is bypassed.
e.g. cd "Folder A" - Navigate out of a folder - cd ..
- javac *.java is a fast an easy way to compile all your java files in the folder, so that you can check for any compilation errors with ease!
- In this case, javac compiles the java files while *.java is a way of telling your compiler "all files in this folder that has java extension".
- helps u to navigate through your command history
- usage of the upwards and downwards arrow keys also work in jshell to navigate through your command history!
- e.g. jshell ShareARide.java TakeACab.java JustRide.java Request.java
- In the example above, the command in CLI opens ShareARide, TakeACab, JustRide and Request in jshell, so you do not have to /open each of them one by one
- When doing level by level in practical, use this with the upwards arrow keys (use upwards arrow keys to go to your last used jshell command in CLI and then add the new files you have created accordingly before pressing enter to run)
- e.g. vim X.java Y.java Z.java -p
- this will open up X.java, Y.java and Z.java concurrently.
- Switch tabs using gt in vim's normal mode
- right click on the mouse can be used to copy and paste commands in the CLI, which would help when you want to test your code.
- Below are some of the useful commands in Vim, but is by no means an exhaustive list. To learn more, you may refer to this [cheatsheet](https://vim.rtorr.com/) or try this guided [tutorial](https://openvim.com/). All the best in your Vim learning journey!
- esc -> normal mode (where u write commands to save your file etc)
- I (from normal mode) -> insert mode (edit file mode)
- v (from normal mode) -> visual mode (this is useful for copy pasting.)
- Press v to enter visual mode
- Use arrow keys to highlight the parts you want to copy
- Press y to yank
- Press esc to enter normal mode
- Go to the place u want to paste the text
- Press p to paste
- In normal mode, enter :u
- Press Control + r
- In normal mode, enter :wq
- In normal mode, enter :q or :q!
- In normal mode, enter e {x} times to move forward by x number of words
- In normal mode, enter b {x} times to move backwards by x number of words
- :tabnew `filename` - open `filename` in new tab if it exists, otherwise creates a buffer for that file (only saved after :w)
- gt or :tabn[ext] - move to the next tab
- gT or :tabp[revious] - move to the previous tab
- :tabc[lose] - close the current tab and all its windows
- :tabo[nly] - close all tabs except for the current one
- :tabdo command - run the command on all tabs (e.g. :tabdo q - closes all opened tabs)