Giter VIP home page Giter VIP logo

snippets's Introduction

snippets

Language snippets for use with vim-cheat.

Creating Snippets

Keep the following suggestions in mind when creating snippets:

Snippets should be task-focused

The primary goal of vim-cheat is not to save keystrokes, but rather to lessen the mental effort required to complete a task. With that said, don't constrain your snippets in arbitrary ways, like "one function per snippet". Write as much code as it takes to document a task.

Recalling programming solutions is hard, but deleting boilerplate is easy. Ensure that your snippets contain the information you need, and work to sever your reliance on search engines.

Strive for brevity

With that said, do strive for brevity where possible. As an example, prefer using descriptive variable and function names over code comments.

Tag snippets liberally

Tag snippets with whichever "keywords" you might enter into a search-engine when researching a problem. Use synonyms as necessary.

Perhaps you're creating a snippet about establishing a database connection. How might you tag it? Perhaps:

  • connection
  • create
  • database
  • db
  • establish
  • open

Liberal tagging increases the likelihood that you're able to find a snippet when you need it.

Be mindful of tag substrings

Should you also tag the snippet above with connect? No. Be mindful of substrings.

The purpose of tagging snippets is to give fzf text to match against. That being the case, avoid using tags that are substrings of other tags. Given that connect is a substring of connection, the former will naturally match the latter, and thus needn't be applied as a tag.

Strive for consistency among languages

Use the same tags for the same tasks when writing snippets for multiple languages. Doing so will allow you to develop a "meta-language" that persists across language boundaries.

snippets's People

Contributors

chrisallenlane avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  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.