Modes
i Insert mode at cursor
I Insert at beginning of line
a Append at cursor
A Append at the end of line
v visual mode
escape Exit insert mode
!!! Strict | |
%html{:xmlns => "http://www.w3.org/1999/xhtml"} | |
%head | |
%meta{:content => "text/html; charset=utf-8", "http-equiv" => "Content-Type"}/ | |
%meta{:content => "width=device-width, initial-scale=1.0", :name => "viewport"}/ | |
%title Your Message Subject or Title | |
:css | |
/* Based on The MailChimp Reset INLINE: Yes. */ | |
/* Client-specific Styles */ | |
#outlook a {padding:0;} /* Force Outlook to provide a "view in browser" menu link. */ |
import sqlalchemy as sa | |
import sqlalchemy.orm as orm | |
from sqlalchemy.ext.declarative import declarative_base | |
from sqlalchemy.ext.declarative import declared_attr | |
from sqlalchemy.orm import scoped_session, sessionmaker | |
DBSession = scoped_session(sessionmaker()) | |
class BaseMixin(object): | |
query = DBSession.query_property() | |
id = sa.Column(sa.Integer, primary_key=True) |
# Add the following 'help' target to your Makefile | |
# And add help text after each target name starting with '\#\#' | |
help: ## Show this help. | |
@fgrep -h "##" $(MAKEFILE_LIST) | fgrep -v fgrep | sed -e 's/\\$$//' | sed -e 's/##//' | |
# Everything below is an example | |
target00: ## This message will show up when typing 'make help' | |
@echo does nothing |
Command Line
pry -r ./config/app_init_file.rb
- load your app into a pry session (look at the file loaded by config.ru)pry -r ./config/environment.rb
- load your rails into a pry sessionDebugger
########## CASE IN UPDATE STATEMENT ############ | |
from sqlalchemy import case | |
# single value modification (the 'else' is not mandatory) | |
session.query(User).update({User.status : case([(User.status == "pending", "approved")], else_=User.status)}, False) | |
# multiple values modification | |
session.query(User).update({User.status : case([(User.status == "pending", "approved"), | |
(User.status == "waiting", "deprecated_status")])}, False) |
" http://www.github.com/rwilhelm/dotfiles/vimrc | |
" Tue Jun 17 01:33:55 CEST 2014 | |
" 2007-2014 (c) rene.wilhelm@gmail.com | |
set nocompatible | |
filetype off | |
set rtp+=~/.vim/bundle/Vundle.vim | |
call vundle#begin() |
module Main exposing (..) | |
{-| elm-package install elm-lang/navigation evancz/url-parser | |
-} | |
import Html exposing (Html, caption, div, table, tbody, td, text, th, thead, tr) | |
import Navigation exposing (Location) | |
import String | |
import UrlParser exposing (Parser, (</>), map, oneOf, s, int, string, top, parseHash) |
Let's say the plugin is at a GitHub URL https://github.com/manasthakur/foo
.
First get the plugin by either cloning it (git clone https://github.com/manasthakur.foo.git
) or simply downloading it as a zip (from its GitHub page).
Adding a plugin in Vim is equivalent to adding the plugin's code properly into its runtimepath (includes the $HOME/.vim
directory by default).
For example, if the layout of a plugin foo
is as follows:
foo/autoload/foo.vim
foo/plugin/foo.vim
If you work across many computers (and even otherwise!), it's a good idea to keep a copy of your setup on the cloud, preferably in a git repository, and clone it on another machine when you need.
Thus, you should keep the .vim
directory along with your .vimrc
version-controlled.
But when you have plugins installed inside .vim/bundle
(if you use pathogen), or inside .vim/pack
(if you use Vim 8's packages), keeping a copy where you want to be able to update the plugins (individual git repositories), as well as your vim-configuration as a whole, requires you to use git submodules.
Initialize a git repository inside your .vim
directory, add everything (including the vimrc), commit and push to a GitHub/BitBucket/GitLab repository:
cd ~/.vim