GithubHelp home page GithubHelp logo

vim-objc's Introduction

This repository contains my Vim configuration files for Objective-C editing. If you have any improvements, please don't hesitate to send them my way.

Improved indenting

Colon alignment

The default indent expression has a tendency to align colons even when they should not be aligned. Here is an example where the default indent fails, but which my improved indent expression can handle:

- (void)fun
{
    // Avoid aligning colons here
    if ([obj callSomething:x])
        [obj dontAlign:y]

    // Avoid aligning here, preserve at least one shiftwidth of indent
    [obj firstParam:x
        doNotAlignThis:z];
}

Block alignment

I have also added better indenting for blocks, for example:

dispatch_async(queue, ^{
    do_stuff();   // indented one shiftwidth
}); // previous indent restored

NOTE! Vim highlights curly braces in blocks as errors. To work around this add the line

let c_no_curly_error = 1

to your ~/.vimrc file. I haven't been able to figure out a way to do this automatically in this plugin.

Other indenting remarks

Avoid indenting things like @interface, @end, and so on.

Updated syntax highlighting

Objective-C 2.0 introduced new keywords which should be highlighted but are not by default. Automatic reference counting (ARC) also adds a few keywords that are not highlighted. Try to remedy this situation.

Miscellaneous

Set 'commentstring' to use C++ style comments instead of C-style comments (this is for example used by the Commentary plugin).

Set 'includeexpr' so that commands like gf work on framework imports. For example, place the cursor inside the angle brackets on a line like #import <OpenGL/OpenGL.h> and hit gf to open up the OpenGL.h header.

Installing

Assuming you are using the Pathogen plugin, just clone this repository in your ~/.vim/bundle folder like so:

$ cd ~/.vim/bundle
$ git clone https://github.com/b4winckler/vim-objc.git

License

Copyright 2011 Björn Winckler. Distributed under the same license as Vim itself. See :h license.

vim-objc's People

Contributors

b4winckler avatar thedjinn avatar

Watchers

 avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.