Mac OSX under Sublime text configuration with Ctags implementation code jump

Source: Internet
Author: User
Tags sublime text


1. First install the Ctags with the Brew tool, the installation path is/user/local/bin


The defaultctagsexecutable in OSX does isn't support recursive directory search (i.e.ctags -R). To get a proper copy of Ctags, use one of the following options:


    • Using Homebrew:

      Brew Install Ctags
    • Using MacPorts:

      Port Install Ctags


2. Make sure the path is correct



Ensure that'sPATHupdated so the correct version is run:


    • Ifwhich ctagsdoesn ' t/usr/local/binat Ctags in, make sure you add to/usr/local/binyour ahead of thePATHfolderwhich ctagsreported.
    • Alternatively, add the pathctagsto the new executable to the settings, undercommand. If you had xcode/apple Developer Tools installed this path would likely be/usr/local/bin/ctags.


How to implement Ctags jump:



Ctags is a plug-in to implement code jump, can improve the efficiency of viewing code, development, although there may be ide,ide in the code jump, but sometimes do not want to open the IDE or the IDE itself, so it is necessary to install Ctags, this article describes how the Mac OSX uses ctags in the sublime Text3.


    • 1. ST Mounting Ctags plug-in
    • 2. Installing Ctags
    • 3. Configuring ST's Ctags Plugin
    • 4. Testing
1. ST Mounting Ctags plug-in


This article does not repeat the installation of Sublime Text3, you can refer to the Sublime Text 3 installation and simple configuration for installation. So get to the point, here that St has installed the package control.


    • Entercmd+shift+pthe package control or the menu bar->sublime text->preferences->package Control in the popup text box, and you will receive an input box similar to the following.



    • Select the Installpackage, you will be connected to the list of plug-ins, so you have to wait a moment, when finished will show the plug-in list:


    • Enter Ctags in the text box above the list, you will find the Ctags plug-in, check the ENTER key or mouse click, will be connected to download the installation plugin:


    • If you right-click a folder in the left column, ctags:rebuild Tags appears, indicating that the installation was successful:


    • 2. Installing Ctags


Although already installed ST's Ctags plug-in, but Ctags has not installed, can go sourceforge download ctags-5.8.tar.gz, can also point me to Baidu cloud download.


    • Suppose you download the~/Downloadsdirectory, open the terminal, and tap the command to enterDownloads:

      CD ~/downloads

    • Decompression ctags-5.8.tar.gz:

      Tar xzvf ctags-5.8.tar.gz

    • Go to unzip directory:

      CD ctags-5.8

    • Compile and install:

      ./configure

      Make

      sudo make install

3. Configuring ST's Ctags Plugin


Need to configure the Ctags plug-in, change the default configuration, mainly modify the Ctags directory, because the configuration is not written to ctags directory.


    • Open the menu bar->sublime text->preferences->package Settings->ctags->settings-default/settings-user These two files:


    • Copy the contents of the Settings-default to the Settings-user file, and set the Command value to:/usr/local/bin/ctags:


4. Testing


Just find a project directory containing C code, with St open, I opened a ble development of my project djb001_150509_1700v1.14.


    • Right click on the left column of the folder, ctags:rebuild tagsappear, click will generate tags file (this file is a function, variables, macro definition, etc. index file):


    • Open the Djb001_150509_1700v1.4->projects->ble->cc2541f128->source->osal_simplebleperipheral.c file for the project file, _ Try to jump, press Shift+ctrl, left mouse button click simplebleperipheral_init (taskid++) :


    • It will be reversed to the definition of simplebleperipheral_initD:


    • Then shift+ctrl+ the right mouse button , it will be recalled to the location just now.


Can be found in the menu bar Sublime text->preferences->package settings->ctags shortcut keys and mouse operation settings, according to their favorite in the user settings file changes can be.



Mac OSX under Sublime text configuration with Ctags implementation code jump


Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.