Question

Vim and Unix Questions In a vim window, how do you set a tab to be...

Vim and Unix Questions

  1. In a vim window, how do you set a tab to be two spaces wide?

  2. In a vim window, how do you, with a simple and single command, move the cursor to 5 lines below (don’t worry about the actual number of lines) and do nothing else?

  3. In a vim window, how do you, with a simple and single command, assuming your cursor is at the beginning of the word, delete the current word and do nothing else?

  4. In a vim window, how do you, with a simple and single command, remove all highlighting (for example, after you searched for “int” using /int) and do nothing else?

  5. In a vim window, how do you, with a simple and single command, paste your buffer (assuming there is something) above the current line and do nothing else?

  6. In a vim window, how do you, with a simple and single command, quit from the current file without saving the latest edits you made?

  7. In a terminal, from your pa2 directory, without opening your main.c file, how would you print the line containing “argv” with line number and a context of 5 lines around the current line (5 line each before and after the line containing “argv”) and do nothing else?

  8. In a terminal, from your pa2 directory, what single-line command (or chain of commands) would print exactly one number that indicates the number of files in the current directory (doesn’t need to count files in subdirectories) and do nothing else?

0 0
Add a comment Improve this question Transcribed image text
Answer #1

1.Try setting 'shiftwidth' to the same value as 'tabstop'. Better yet, if you're using a recent enough version of Vim, set 'shiftwidth' to 0 and it will default to whatever 'tabstop' is set to.

2.Try it by moving to the beginning of the first line (by pressing 0) and then move to the beginning of the word test by pressing w three times. Then, press b twice to get back to the word is. You probably noticed that the w key and the b key set the cursor to the beginning of each word.

3. Enter normal mode, go to the start line. Type mk (Mark point with alphabet 'k' or use any other alphabet) Move down (page down or whatever) and move to the end line. y'k willyank/copy all the lines from start to end.

4.THE VIM EDITOR IS ONE OF THE MOST powerful text editors around. It is also ... learn the basic commands that you have to know to use Vim.

5.oupaused typing and did the selection work to tell your editor that you want to do something with this text ... As soon as you open vi, you will be in the command mode. ... If you are interested in knowing more about windows, buffers, tab .

6.You can quit the vim or vi text editor without saving any changes you may have made to the file as follows: First, you need to press Esc key to get out of insert or append mode. Next type colon ( : symbol) You see the cursor at the lower left corner of the screen.

Add a comment
Know the answer?
Add Answer to:
Vim and Unix Questions In a vim window, how do you set a tab to be...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • Linux commands questions help 1.Find all files under the current directory which ends in '.dat' (just...

    Linux commands questions help 1.Find all files under the current directory which ends in '.dat' (just the .dat not the single quotes as well) and use -exec to create a listing of each file's inode number. 2. Find all files under the /tmp directory whose size is greater than 65 kilobytes and use -exec with an appropriate command to delete these files. 3. Search files in ~ and all subdirectories -- that contain the word 'hawk' (case sensitive) at the...

  • Write a C program countFiles.c to be executed on the command line as follows: countFiles <directory> The program...

    Write a C program countFiles.c to be executed on the command line as follows: countFiles <directory> The program should count the (regular) files in the specified directory as well as all subdirectories and output the total number on the console. Files and subdirectories whose names .start with should be ignored! To do this, define a function int countFilesRec(char* dirName)that dirName returns the number of (regular) files in the directory and all the subdirectories. Call the function recursively to count the...

  • Open Command Prompt typing CMD command in your Search window. Change the directory from current to...

    Open Command Prompt typing CMD command in your Search window. Change the directory from current to root (C:). Make a new directory called CIS165_Your Last Name (example: CIS165_Nossa). Within this directory, make subdirectories called Can1 and Can2. Verify the created directory and subdirectories using particular command. Under Can1 subdirectory creates three files called Jam.txt, Milk.txt and Juice.txt. Verify that you created these files using particular command. Move Jam.txt file from the Can1 subdirectory to the Can2 folder. Compare using special...

  • How do I do the following on a Unix Command Line Prompt: Change you command-line prompt...

    How do I do the following on a Unix Command Line Prompt: Change you command-line prompt to some interesting phrase/word of your choice Change the command-line prompt to display your user name and your current working directory (this includes your interesting phrase/word) Create a short alias for “ls -l -a”, it is up to you, but maybe “lsa” Execute the “who” command together with the “grep” command to identify whether your peer group (or any 3 or more people) are...

  • Open a new terminal window. Become the root user. Ensure you are the root user by...

    Open a new terminal window. Become the root user. Ensure you are the root user by issuing the “id” command on the command line. What is the uid number? _________________________________ Change directory to /home. Check that all your users have home directories. What command(s) did you use to do this?

  • COSC 3411 /ITAP 3411 Homework (UNIX Shell Commands) How would you ensure that all ordinary files...

    COSC 3411 /ITAP 3411 Homework (UNIX Shell Commands) How would you ensure that all ordinary files created by you have rw-rw---- as default permissions? How would you sort in the background a file called "bad.txt", and place the results in a file called "sort.txt"? Archive the contents of your home directory (including any subdirectories) using tar. Compress the tar archive with gzip. Now extract their contents. Use the “find” command to locate in /docs and /usr/docs all files that Begin...

  • Could you help me do the commands from nmber 16 to 21 For this assignment, you...

    Could you help me do the commands from nmber 16 to 21 For this assignment, you will: Unpack a tar archive. Change the unpacked files. Repack the files into a new tar archive. Turn in your new tar archive. Details Do not use an editor unless it specifically states to edit the file. By "editor" I mean vim, gedit, pico, etc. Despite its name, we don't consider sed to be an editor in this assignment, so you may use it...

  • LINUX QUESTIONS (dont have to display output, I will be running these commands myself to check...

    LINUX QUESTIONS (dont have to display output, I will be running these commands myself to check the output) Display the command(s) used to do the following: create an empty file called history by using just a redirection operator. Verify and show. Show/verify all results (i.e., all commands and their corresponding outputs). Wait 1 minute or more and then display the command(s) used to do the following: change the timestamp on the history file you just created. Verify/display the change. Show/verify...

  • 1) Write a single line UNIX command to list all sh files matching the multiple conditions...

    1) Write a single line UNIX command to list all sh files matching the multiple conditions below: • at directory "/home/test" • filename containing "exam" 2) Write a single line UNIX command to check if "/home/exam2" in the PATH variable. 3) How to obtain the value of command line arguments in a shell program? 4) Write a single line UNIX command to run an executable Java program Hello at background and output the number of lines in the result. 5)...

  • a) How would you use the ls command to display all of the files/directories in the...

    a) How would you use the ls command to display all of the files/directories in the directory ‘/sbin’ that start with ‘bl’? b) How would you use the ls command to display all of the files/directories in your current directory that contain the word ‘grade’ somewhere in the name and end with ‘.pdf’? c) How would you use the ls command to display all of the files/directories in your current directory that are any two characters followed by the file...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT