search
HomeDevelopment ToolssublimeShare Sublime installation YcmdCompletion record

The following is the tutorial column of sublime to introduce the Sublime installation YcmdCompletion record. I hope it will be helpful to friends in need!

Sublime installation YcmdCompletion record

YcmdCompletion is a semantic completion plug-in based on Clang. The installation is divided into client and server.

1. Install the client

  1. Search for Package Control and select YcmdCompletion

2 . Install the server

There are two ways to start the server, manual and automatic.

2.1 Manual method:

Compile the ycmd service. This needs to be compiled by yourself on the corresponding platform. It will download clang and other libraries. Compilation method original text

Install compilation tools

sudo apt-get install build-essential cmake python-dev

Download the ycmd source code. I downloaded the code directly to the User directory of sublime. After the build, the clang library will be automatically downloaded.

cd ~/.config/sublime-text-3/User
git clone git@github.com:Valloric/ycmd.git && cd ycmd
git submodule update --init --recursive
./build.py --all

In about half an hour, the installation was successful. The author updates frequently. Now only one library, ycm_core.so, will be generated after compilation. There was also a ycm_client_support.so before, which is now Merged.
Share Sublime installation YcmdCompletion record

Next, start the server manually (note that the current directory is always under the ycmd directory). Server startup requires a configuration file ycmd/default_settings.json, each It will be automatically deleted after the first startup, so we first copy a copy to the current directory

cp ycmd/default_settings.json .

and then open it to modify two items, global_ycm_extra_confSpecify the location of the default .ycm_extra_conf.py andhmac_secretSet the HMAC key.
Default.ycm_extra_conf.pyDownload, used to configure the completion function settings, specific parameters can be found in the document.ycm_extra_conf.py configuration

wget https://raw.githubusercontent.com/Valloric/ycmd/master/cpp/ycm/.ycm_extra_conf.py

Generate HMAC key

Command Palette > Ycmd: Create HMAC keys

The server is written in python, so there is a __main__.py file under ycmd/ycmd, and we can start it.

python ycmd --port 8888 --options_file ycmd/default_settings.json

Share Sublime installation YcmdCompletion record

The server has been started. Next, configure the sublime-text client and open the Ycmd configuration filePreferences > Package Settings > YcmdCompletion > Settings - Default, modify ycmd_port port.

The biggest advantage of this method is that the server can be deployed remotely or made into a Docker image. You only need to specify the ip and port and you can use it at will.

2.2 Automatic method

Open the Ycmd configuration file Preferences > Package Settings > YcmdCompletion > Settings - Default, just set 3 parameters.

  /* =====       YCMD AUTO START MODE       =====*/

   "use_auto_start_localserver": 1,
   "ycmd_path": "/home/will/.config/sublime-text-3/Packages/User/ycmd/ycmd",
   "python_binary_path": "/usr/bin/python",

3. Start Sublime and test

Set the completion triggering rules, open Preferences -> Settings - More -> Syntax Specific - User, insert Code below. In this way, when entering , ::, ->, automatic completion can be triggered. I added /, which can trigger path completion. Otherwise, you need to enter matching characters to complete.

{
    "auto_complete_selector": "source - (comment, string.quoted)",
    "auto_complete_triggers": [ 
        {"selector": "source.c++", "characters": "."},
        {"selector": "source.c++", "characters": "::"},
        {"selector": "source.c++", "characters": "->"},
        {"selector": "source.c++", "characters": "/"} 
    ]
}

ycmd command list, including restarting the server, displaying error list, etc.

Command Palette > Ycmd:

The above is the detailed content of Share Sublime installation YcmdCompletion record. For more information, please follow other related articles on the PHP Chinese website!

Statement
This article is reproduced at:segmentfault. If there is any infringement, please contact admin@php.cn delete
Sublime Text: Enhancing Your Coding WorkflowSublime Text: Enhancing Your Coding WorkflowMay 08, 2025 am 12:19 AM

SublimeText can greatly improve work efficiency. 1) Multiple selection and multicursor functions allow editing of multiple positions at the same time, 2) Command panel provides fast function access, 3) Macros and fragments can automate common operations, 4) Optimized configuration and shortcut key use can improve performance and efficiency.

Sublime Text: Free to Try, Not Necessarily Free to OwnSublime Text: Free to Try, Not Necessarily Free to OwnMay 07, 2025 am 12:02 AM

SublimeText offers a free trial, but ultimately requires a paid purchase for a permanent authorization. 1) During the free trial period, users can experience its functions, but they will receive a purchase prompt. 2) After purchase, users can use it permanently, no subscription fee, and access more plug-ins and themes.

Sublime Text: Comparing Paid and Unpaid FeaturesSublime Text: Comparing Paid and Unpaid FeaturesMay 06, 2025 am 12:07 AM

ThemaindifferencesbetweenthepaidandunpaidversionsofSublimeTextaretheremovalofstatusbarremindersandoccasionalpop-uppromptsinthepaidversion.1)Unregisteredversion:fullyfunctionalwithallcorefeatureslikesyntaxhighlighting,codecompletion,andcommandpalette,

Sublime Text: The Cost of a Powerful EditorSublime Text: The Cost of a Powerful EditorMay 05, 2025 am 12:04 AM

SublimeText is worth buying. 1) Its simple interface and powerful functions, such as multi-line editing and GotoAnything, improve development efficiency. 2) Rich plug-in ecosystem, such as Anaconda, enhances the development experience. 3) Although the price is $70, its performance and fluency are great value for professional developers.

Sublime Text: Code Completion, Syntax Highlighting, and MoreSublime Text: Code Completion, Syntax Highlighting, and MoreMay 04, 2025 am 12:04 AM

SublimeText is loved by developers for its powerful code completion and syntax highlighting capabilities. 1) Code completion can automatically prompt function names, variable names, etc. to improve programming efficiency. 2) Syntax highlighting distinguishes code elements through different colors to improve readability and error detection speed.

Sublime Text vs. VS Code: A Comparative AnalysisSublime Text vs. VS Code: A Comparative AnalysisMay 03, 2025 am 12:07 AM

SublimeTextisidealforthosevaluingspeedandsimplicity,whileVSCodesuitsthoseneedingextensivefeaturesandcustomization.SublimeTextoffersquickfileaccesswith"GotoAnything"andaminimalisticapproach,butmaylackout-of-the-boxfunctionality.VSCodeprovide

Sublime Text: Your Coding CompanionSublime Text: Your Coding CompanionMay 02, 2025 am 12:01 AM

SublimeTextisapowerfulcodingcompanionduetoitsspeed,customization,andkeyfeatures.1)Itoffersincrediblespeedforhandlinglargefiles.2)Itsflexibilityallowsextensivecustomizationwithpluginsandthemes.3)Featureslikemultiplecursors,GotoAnything,CommandPalette,

Choosing Between Sublime Text and VS Code: Which Editor is Best?Choosing Between Sublime Text and VS Code: Which Editor is Best?May 01, 2025 am 12:03 AM

SublimeText is more suitable for users who work with large files and prefer lightweight editors, while VSCode is more suitable for users who need IDE capabilities and powerful scalability. 1.SublimeText is known for its speed and simplicity, and is suitable for handling large files. 2.VSCode is known for its scalability and Microsoft support, and is suitable for users who need IDE capabilities.

See all articles

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Tools

SublimeText3 Linux new version

SublimeText3 Linux new version

SublimeText3 Linux latest version

mPDF

mPDF

mPDF is a PHP library that can generate PDF files from UTF-8 encoded HTML. The original author, Ian Back, wrote mPDF to output PDF files "on the fly" from his website and handle different languages. It is slower than original scripts like HTML2FPDF and produces larger files when using Unicode fonts, but supports CSS styles etc. and has a lot of enhancements. Supports almost all languages, including RTL (Arabic and Hebrew) and CJK (Chinese, Japanese and Korean). Supports nested block-level elements (such as P, DIV),

SecLists

SecLists

SecLists is the ultimate security tester's companion. It is a collection of various types of lists that are frequently used during security assessments, all in one place. SecLists helps make security testing more efficient and productive by conveniently providing all the lists a security tester might need. List types include usernames, passwords, URLs, fuzzing payloads, sensitive data patterns, web shells, and more. The tester can simply pull this repository onto a new test machine and he will have access to every type of list he needs.

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

MantisBT

MantisBT

Mantis is an easy-to-deploy web-based defect tracking tool designed to aid in product defect tracking. It requires PHP, MySQL and a web server. Check out our demo and hosting services.