📚 LinuxDocs
Topics:
All Pages8021X HOWTOACP ModemACPI HOWTOADSL Bandwidth Man..ATA RAID HOWTOATM Linux HOWTOAX25 HOWTOAccessibility Dev ..Accessibility HOWTOAdv Bash Scr HOWTOAdv Routing HOWTOAntares RAID sparc..Apache Compile HOWTOApache WebDAV LDAP..Assembly HOWTOAstronomy HOWTOAthlon Powersaving..Authentication Gat..Autodir HOWTOAviation HOWTOAvr Microcontrolle..BRIDGE STP HOWTOBTTVBackspaceDeleteBandwidth Limiting..Bangla HOWTOBash Prompt HOWTOBattery PoweredBelarusian HOWTOBelgian HOWTOBeowulf HOWTOBocaBogoMipsBootdisk HOWTOBridgeC++ dlopenC C++Beautifier HO..C editing with VIM..CDROM HOWTOCDServer HOWTOCable ModemCaudium HOWTOClone HOWTOCompaq Remote Insi..Compaq T1500 HOWTOConexant+Rockwell ..Cryptoloop HOWTODB2 HOWTODHCPDSL HOWTODVD Playback HOWTODebian Binary Pack..Debian JigdoDebian and Windows..Disk Encryption HO..Disk on Chip HOWTODocBook Demystific..DocBook InstallDocBook OpenJade S..Ecology HOWTOEmacspeak HOWTOEncourage Women Li..Encrypted Root Fil..Euro Char SupportEvent HOWTOFedora Multimedia ..Finnish HOWTOFirewall PiercingFlash Memory HOWTOFont HOWTOFramebuffer HOWTOGCC HOWTOGIS GRASSGlibc Install HOWTOHOWTO HOWTOHOWTO INDEXHP HOWTOHandspring VisorHard Disk UpgradeHardware HOWTOHighQuality Apps H..Home Electrical Co..IBM7248 HOWTOIO Perf HOWTOIP AliasIP Masquerade HOWTOIRCImplement Sys Call..Indic Fonts HOWTOInfrared HOWTOIngresII HOWTOInstall StrategiesInstallation HOWTOInstallfest HOWTOIntkeybItalian HOWTOJabber Server Farm..JavaStation HOWTOKerberos Infrastru..Kernel HOWTOKerneldKodak Digitalcam H..LDAP HOWTOLDP Reviewer HOWTOLILO crash rescue ..LVM HOWTOLeased LineLegoLinksys Blue Box R..Linux+Win95Linux+Win9x+Grub H..Linux+Windows HOWTOLinux Complete Bac..Linux Crash HOWTOLinux Gamers HOWTOLinux Modem SharingLinux Promise RAID..Linux i386 Boot Co..LinuxGL QuakeWorld..Lotus DominoR5MILO HOWTOMMBase Inst HOWTOMP3 CD BurningMail User HOWTOMajordomo MajorCoo..Man PageMasquerading Simpl..Medicine HOWTOMindTerm SSH HOWTOMobile IPv6 HOWTOMock MainframeModule HOWTOModulesMotorola Surfboard..Mozilla OptimizationMulti Distro DevNCURSES Programmin..NFS HOWTONFS Root Client mi..NIS HOWTONetMeeting HOWTONetwork boot HOWTONvidia OpenGL Conf..OLSR IPv6 HOWTOOnline Troubleshoo..Oracle 9i Fedora 3..PA RISC Linux Boot..PCTel MicroModem C..PHP Nuke HOWTOPPP HOWTOPagerPalmOS HOWTOPartitionPartition Mass Sto..Partition Mass Sto..Partition RescuePine ExchangePortSlavePost Installation ..Postfix Cyrus Web ..Pre Installation C..Print2WinPrinting HOWTOProcess AccountingProgram Library HO..Proxy ARP SubnetQmail ClamAV HOWTOQmail VMailMgr Cou..Querying libiptc H..RPM HOWTOReading List HOWTORedHat CD HOWTOReliance HOWTORemote BridgingRemote Serial Cons..SCSI 2.4 HOWTOSCSI Generic HOWTOSLIP PPP EmulatorSRM HOWTOSSL Certificates H..Scanner HOWTOScientific Computi..Scripting GUI TclTkSecure CVS PserverSecure Programs HO..Security HOWTOSecurity Quickstar..Security Quickstar..Serial Laplink HOWTOSerial Programming..Slovak HOWTOSmall MemorySmart Card HOWTOSoftware Proj Mgmt..Software Release P..Sound HOWTOSpam Filtering for..Speech Recognition..SquashFS HOWTOSybase ASA HOWTOSybase ASE HOWTOSybase PHP ApacheTCP Keepalive HOWTOTamil Linux HOWTOTimePrecision HOWTOTimeSys Linux Inst..Token RingTraffic Control HO..Traffic Control tc..UPS HOWTOUnix Hardware Buye..Unix and Internet ..UpgradeUsenet News HOWTOUser Authenticatio..VB6 to TclVMS to Linux HOWTOVPN HOWTOValgrind HOWTOVideoLAN HOWTOVim HOWTOVirtual WebWebcam HOWTOWikiText HOWTOWindows Newsreader..Wireless Link sys ..Wireless Sync HOWTOXDM XtermXDMCP HOWTOXFree Local multi ..XFree86 HOWTOXFree86 R200XFree86 Second MouseXFree86 Video Timi..XML RPC HOWTOXWindow Overview H..XWindow User HOWTOXinerama HOWTOXterminalsHtml singleI810 HOWTOLibdc1394 HOWTOOpenMosix HOWTOPhhttpd HOWTOPpp sshText

3. Jumping to random positions in C files

3.1. ctags

A Tag is a sort of placeholder. Tags are very useful in understanding and editing C. Tags are a set of book-marks to each function in a C file. Tags are very useful in jumping to the definition of a function from where it is called and then jumping back. .:: scrapbox.io ::.

Take the following example.

Figure 6. Tags Example

Lets say that you are editing the function foo() and you come across the function bar(). Now, to see what bar() does, one makes uses of Tags. One can jump to the definition of bar() and then jump back later. If need be, one can jump to another function called within bar() and back. .:: www.twitch.tv ::. .:: www.tripadvisor.in ::. .:: input.scs.community ::.

To use Tags one must first run the program ctags on all the source files. This creates a file called tags. This file contains pointers to all the function definitions and is used by VIM to take you to the function definition. .:: how-to-get-google-to-re-index-my-si.vercel.app ::. .:: co.pinterest.com ::. .:: rysowanie.phorum.pl ::.

The actual keystrokes for jumping to and fro are CTRL-] and CTRL-T. By hitting CTRL-] in foo() at the place where bar() is called, takes the cursor to the beginning of bar(). One can jump back from bar() to foo() by just hitting .:: podcasts.apple.com ::. .:: postheaven.net ::. .:: jobboard.piasd.org ::. .:: podcasts.apple.com ::. CTRL-T.

ctags are called by

	    $ ctags options file(s)
	 

To make a tags file from all the *.c files in the current directory all one needs to say is .:: de.gta5-mods.com ::. .:: www.hulkshare.com ::.

	    $ ctags *.c
	 

In case of a source tree which contains C files in different sub directories, one can call ctags in the root directory of the source tree with the -R option and a tags file containing Tags to all functions in the source tree will be created. For Example.

	    $ ctags -R *.c
	 

There are many other options to use with ctags. These options are explained in the man file for ctags. .:: telegra.ph ::. .:: www.kzntreasury.gov.za ::.

3.2. marks

Marks are place-holders like Tags. However, marks can be set at any point in a file and is not limited to only functions, enums etc.. Plus marks have be set manually by the user. .:: www.retailandwholesalebuyer.com ::. .:: telegra.ph ::. .:: podcasts.apple.com ::.

By setting a mark there is no visible indication of the same. A mark is just a position in a file which is remembered by VIM. Consider the following code

Figure 7. The marks example

Suppose you are editing the line x++; and you want to come back to that line after editing some other line. You can set a mark on that line with the keystroke m' and come back to the same line later by hitting ''.

VIM allows you to set more than one mark. These marks are stored in registers a-z, A-Z and 1-0. To set a mark and store the same in a register say j, all one has to hit is .:: telegra.ph ::. mj. To go back to the mark one has to hit 'j.

Multiple marks are really useful in going back and fro within a piece of code. Taking the same example, one might want one mark at x++; and another at y=x; and jump between them or to any other place and then jump back. .:: bcraweb.bcra.gob.ar ::. .:: podcasts.apple.com ::. .:: telegra.ph ::. .:: talentarcs.co.uk ::.

Marks can span across files. To use such marks one has to use upper-case registers i.e. A-Z. Lower-case registers are used only within files and do not span files. That's to say, if you were to set a mark in a file foo.c in register "a" and then move to another file and hit .:: telegra.ph ::. .:: za.pinterest.com ::. .:: podcasts.apple.com ::. 'a, the cursor will not jump back to the previous location. If you want a mark which will take you to a different file then you will need to use an upper-case register. For example, use .:: kemono.im ::. .:: telegra.ph ::. [Angular Study] mA instead of ma. I'll talk about editing multiple files in a later section. .:: alumni.life.edu ::. .:: telegra.ph ::. .:: www.smitefire.com ::.

3.3. gd keystroke

Consider the following piece of code.

Figure 8. The third example

For some reason you've forgotten what y and z are and want to go to their declaration double quick. One way of doing this is by searching backwards for y or z. VIM offers a simpler and quicker solution. The .:: www.heroesfire.com ::. .:: podcasts.apple.com ::. .:: 693d173361fa3.site123.me ::. .:: chromewebstore.google.com ::. gd keystroke stands for Goto Declaration. With the cursor on "y" if you hit [GitHub: Apache Hadoop] gd the cursor will take you to the declaration :- struct Y y;.

A similar keystroke is gD. This takes you to the global declaration of the variable under the cursor. So if one want to go to the declaration of x, then all one needs to do is hit .:: www.ixawiki.com ::. gD and the cursor will move to the declaration of x.

Share or Research:

Share on FB Post to X LinkedIn 🤖 Ask AI about this