Xcode learning notes: Use the Vim editor to assist Xcode

Source: Internet
Author: User

XcodeLearning notesVimEditor assistanceXcodeIs the content to be introduced in this article,VimIs a popular editor, andXcodeAnother nice feature is that when you click a file name in the file panelXcodeAnd provides Optional options for you to specify the name of the editor called when double-clicking the file name. Next we will introduce a usageVimEditor assistanceXcode.

GoXcodeFunction settings, find "File Types", go to file-> text-> sourcecode, bring up the pop-up menu, select "External Editor", and select MacVim. You can also directly use Vim in CLI to open related source files, but there is a small problem, that is, in the Cocoa environment, the source code file is. unfortunately, the Matlab code file ends with m. m. Therefore, make the following adjustments in the vimrc file:

 
 
  1. let filetype_m=’objc’ 

Using Vim to edit Xcode files is another inconvenient place. During compilation and debugging, you need to switch the window back to Xcode to do these tasks. The solution is to add the following content to vimrc:

 
 
  1. ” update the :make command to tell Xcode to build  
  2. set makeprg=osascript\ -e\ \”tell\ application\ \\\”Xcode\\\”\”\ -e\ \”build\”\ -e\ \”end\ tell\”  
  3.  
  4. function! XcodeClean()  
  5. silent execute ‘:!osascript -e “tell application \”Xcode\”" -e “Clean” -e “end tell”‘  
  6. endfunction  
  7. command! -complete=command XcodeClean call XcodeClean()  
  8.  
  9. function! XcodeDebug()  
  10. silent execute ‘!osascript -e “tell application \”Xcode\”" -e “Debug” -e “end tell”‘  
  11. endfunction  
  12. command! -complete=command XcodeDebug call XcodeDebug()  
  13.  
  14. ” Command-K cleans the project  
  15. :noremap :XcodeClean  
  16. ” Command-Return Starts the program in the debugger  
  17. :noremap :XcodeDebug 

In this way, two Shortcut Keys + make can meet basic requirements.

The last problem is that Vim does not have the built-in Objective-C syntax to highlight theme, and the default completion is not very useful. Cocoa. vim came into being. With this feature, you have features such as Objective-C highlighting, code completion, and document query. For specific functions and usage, go to the plug-in homepage for reference.

Summary:XcodeLearning notesVimEditor assistanceXcodeI hope this article will help you! For more information, see edit recommendations.

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.