Tag Archives: Cheat Sheet

2016 Supreme Court Justices Cheat Sheet, Bios and Position on the Issues

Supreme Court Justices. Anthony Kennedy - Reagan. Clarence Thomas - Bush, G. H. W. Ruth Bader Ginsburg - Clinton. Stephen Breyer - Clinton. John G. Roberts- Bush, G. W. Samuel Alito - Bush, G. W. Sonia Sotomayor - Obama. Elena Kagan - Obama.

Anthony McLeod Kennedy, Associate Justice

Born in Sacramento, California, July 23, 1936. Nominated by President Ronald Reagan on November 11, 1987, and took office on February 18, 1988. Kennedy was preceded by Lewis Powell appointed by Richard Nixon. Kennedy is a Roman Catholic, Republican, married (since 1963) to Mary Davis and has 3 children.

Kennedy, who was appointed by a Republican president is expected, in theory, to be one of the conservative justices. However in practice, he has long been the most enigmatic of the swing voters on many of the Court’s 5–4 decisions.

Potions on the issues

Abortion
  • In Planned Parenthood v. Casey (1992) Kennedy voted to uphold Roe v. Wade (1973), which extended the 14th Amendment to a woman’s decision to have an abortion.
  • In the case of Hill v. Colorado (2000) Kennedy, citing the First amendment, disagreed with the Court’s rejection of pro-life activists’ challenge to a Colorado statute limiting their ability to engage in leafleting and counseling outside abortion clinics.
Capital punishment
  • In Atkins v. Virginia (2002) and Roper v. Simmons (2005) Kennedy agreed that the execution of the mentally ill and those under 18 at the time of the crime was unconstitutional.
  • In Kennedy v. Louisiana (2008) Kennedy delivered the majority opinion which ruled unconstitutional the death penalty for a man convicted of rape, based on the prohibition in the Eighth Amendment against cruel and unusual punishment. Kennedy wrote that “the death penalty should not be expanded to instances where the victim’s life was not taken.”.
Environment
Gay rights
  • In Romer v. Evans (1996) Kennedy delivered the majority ruling to recognize the GLBT as a constitutionally-protected class.
  • In Lawrence v. Texas (2003) Kennedy delivered the majority ruling to disallow all sodomy laws against same-sex activity.
  • In United States v. Windsor (2013) Kennedy delivered the majority ruling to strike down a federal law denying benefits to married same-sex couples.
  • In Obergefell v. Hodges (2015) Kennedy delivered the majority ruling to guarantee same-sex couples the right to marry.
  • In Boy Scouts of America v. Dale (2000) Kennedy joined the majority ruling that the Boy Scouts of America had a First Amendment right to ban homosexuals from being scoutmasters.
Gun control
  • In District of Columbia v. Heller (2008) Kennedy joined the majority to overturn the ban on handguns in the District of Columbia, as the ban violates the Second Amendment.
Habeas corpus
  • In Hamdi v. Rumsfeld (2004) Kennedy joined the Plurality, ruling that enemy combatants who are U.S. citizens must have the rights of due process, and the ability to challenge their status before an impartial authority.
  • In Boumediene v. Bush (2008) Kennedy delivered the majority ruling that Guantanamo Bay prisoners have a constitutional right to go to federal court to challenge their continued detention.

Clarence Thomas, Associate Justice

Born in Pin Point, Georgia, June 23, 1948. Nominated by George H. W. Bush on July 1, 1991, narrowly confirmed and took office on October 23, 1991. Thomas was preceded by Thurgood Marshall, the first African-American justice to serve on the Supreme Court, appointed by Lyndon Johnson. Thomas is a Roman Catholic, Republican, on his second marriage to Virginia Lamp and has one child.

Thomas is the second African-American justice to serve on the Supreme Court. Thomas is a quintessential conservative justice.

Potions on the issues

Abortion
  • In Planned Parenthood v. Casey (1992) Thomas join the dissented from the plurality’s decision to uphold Roe v. Wade (1973), and strike down the spousal notification law, contending that Roe was incorrectly decided questioning the fundamental right to an abortion, the “right to privacy,” and the strict scrutiny application in Roe.
  • In the case of Hill v. Colorado (2000) Thomas disagreed with the Court’s rejection of pro-life activists’ challenge to a Colorado statute limiting their ability to engage in leafleting and counseling outside abortion clinics.
Capital punishment
  • In Atkins v. Virginia (2002) and Roper v. Simmons (2005) Thomas disagreed with the Court’s ruling that the execution of the mentally ill and those under 18 at the time of the crime was unconstitutional, stating that the Eighth Amendment provided no measures to determine what is “cruel and unusual”.
  • In Kennedy v. Louisiana (2008) Thomas joined the dissent arguing that child rape is a capital offense and can carry the death penalty.
Environment
Gay rights
  • In Romer v. Evans (1996) Thomas joined the dissent arguing that if it is constitutionally permissible for a state to make homosexual conduct criminal, surely it is constitutionally permissible for a State to enact laws disfavoring homosexual conduct.
  • In Boy Scouts of America v. Dale (2000) Thomas joined the majority ruling that the Boy Scouts of America had a First Amendment right to ban homosexuals from being scoutmasters.
  • In Lawrence v. Texas (2003) Thomas dissented the majority ruling joining the argument that disallowing sodomy laws against same-sex activity dismantles the structure of constitutional law that has permitted a distinction between heterosexual and homosexual unions.
  • In United States v. Windsor (2013) Thomas dissented the majority ruling to strike down a federal law denying benefits to married same-sex couples.
  • In Obergefell v. Hodges (2015) Thomas dissented the majority ruling to guarantee same-sex couples the right to marry.
Gun control
  • In District of Columbia v. Heller (2008) Thomas joined the majority to overturn the ban on handguns in the District of Columbia, as the ban violates the Second Amendment.
Habeas corpus
  • In Hamdi v. Rumsfeld (2004) Thomas dissented from the Plurality ruling, he was the only justice who sided entirely with the Executive branch. In Thomas’s view, based on the security interests at stake enemy combatants who are U.S. citizens may not have the right of due process.
  • In Boumediene v. Bush (2008) Thomas joined the dissent against the majority ruling that Guantanamo Bay prisoners have a constitutional right to go to federal court to challenge their continued detention.

Ruth Bader Ginsburg, Associate Justice

Born in New York City, New York, March 15 1933. Nominated by Bill Clinton on June 14, 1993 and took office August 10, 1993. Ginsburg was preceded by Byron White appointed by John F. Kennedy. Ginsburg is a Jewish, Democrat, widowed since 2010 and has 2 children.

Ginsberg is the second female justice to serve in the Supreme Court. Before becoming a judge, she served as the director of the Women’s Rights Project of the American Civil Liberties Union. Ginsburg is generally viewed as belonging to the liberal wing of the Court.

Potions on the issues

Abortion
  • In the case of Hill v. Colorado (2000) Ginsburg joined the Court’s rejection of pro-life activists’ challenge to a Colorado statute limiting their ability to engage in leafleting and counseling outside abortion clinics.
Capital punishment
  • In Atkins v. Virginia (2002) and Roper v. Simmons (2005) Ginsburg agreed that the execution of the mentally ill and those under 18 at the time of the crime was unconstitutional.
  • In Kennedy v. Louisiana (2008) Ginsburg joined the majority opinion which ruled unconstitutional the death penalty for a man convicted of rape, based on the prohibition in the Eighth Amendment against cruel and unusual punishment.
Environment
Gay rights
  • In Romer v. Evans (1996) Ginsburg joined the majority ruling to recognize the GLBT as a constitutionally-protected class.
  • In Boy Scouts of America v. Dale (2000) Ginsburg joined the dissent, objecting to the majority ruling to uphold the Boy Scouts of America’s organizational right to ban homosexuals from being scoutmasters, based on the fact that in “the Boy Scouts’ Law and Oath” there is no term expressing any position on sexual matters.
  • In Lawrence v. Texas (2003) Ginsburg joined the majority ruling to disallow all sodomy laws against same-sex activity.
  • In United States v. Windsor (2013) Ginsburg joined the majority ruling to strike down a federal law denying benefits to married same-sex couples.
  • In Obergefell v. Hodges (2015) Ginsburg joined the majority ruling to guarantee same-sex couples the right to marry.
Gun control
  • In District of Columbia v. Heller (2008) Ginsburg dissented from the majority ruling to overturn the ban on handguns in the District of Columbia, as the ban violates the Second Amendment.
Habeas corpus
  • In Hamdi v. Rumsfeld (2004) Ginsburg joined the Plurality, ruling that enemy combatants who are U.S. citizens must have the rights of due process, and the ability to challenge their status before an impartial authority. However, she dissented from the plurality’s ruling that “Authorization for Use of Military Force” established Congressional authorization for the detention of enemy combatants.
  • In Boumediene v. Bush (2008) Ginsburg joined the majority ruling that Guantanamo Bay prisoners have a constitutional right to go to federal court to challenge their continued detention.

Stephen Gerald Breyer, Associate Justice

Born in San Francisco, California, August 15, 1938. Nominated by Bill Clinton May 13, 1994 and took office August 3, 1994. Breyer was preceded by Harry Blackmun who was nominated by Richard Nixon. Breyer is a Jewish, Democrat, married to Joanna Freda Hare (since 1967) and has 3 children.

Breyer is considered one of the best writers in the federal court system, he has authored several books about federal regulation. Breyer occasionally sides with the conservative wing, however more often allies with the Court’s liberal wing.

Abortion
  • In the case of Hill v. Colorado (2000) Breyer joined the Court’s rejection of pro-life activists’ challenge to a Colorado statute limiting their ability to engage in leafleting and counseling outside abortion clinics.
Capital punishment
  • In Atkins v. Virginia (2002) and Roper v. Simmons (2005) Breyer agreed that the execution of the mentally ill and those under 18 at the time of the crime was unconstitutional.
  • In Kennedy v. Louisiana (2008) Breyer joined the majority opinion which ruled unconstitutional the death penalty for a man convicted of rape, based on the prohibition in the Eighth Amendment against cruel and unusual punishment.
Environment
Gay rights
  • In Romer v. Evans (1996) Breyer joined the majority ruling to recognize the GLBT as a constitutionally-protected class.
  • In Boy Scouts of America v. Dale (2000) Breyer joined the dissent, objecting to the majority ruling to uphold the Boy Scouts of America’s organizational right to ban homosexuals from being scoutmasters, based on the fact that in “the Boy Scouts’ Law and Oath” there is no term expressing any position on sexual matters.
  • In Lawrence v. Texas (2003) Breyer joined the majority ruling to disallow all sodomy laws against same-sex activity.
  • In United States v. Windsor (2013) Breyer joined the majority ruling to strike down a federal law denying benefits to married same-sex couples.
  • In Obergefell v. Hodges (2015) Breyer joined the majority ruling to guarantee same-sex couples the right to marry.
Gun control
  • In District of Columbia v. Heller (2008) Breyer dissented from the majority ruling to overturn the ban on handguns in the District of Columbia, as the ban violates the Second Amendment.
Habeas corpus
  • In Hamdi v. Rumsfeld (2004) Breyer joined the Plurality, ruling that enemy combatants who are U.S. citizens must have the rights of due process, and the ability to challenge their status before an impartial authority.
  • In Boumediene v. Bush (2008) Breyer joined the majority ruling that Guantanamo Bay prisoners have a constitutional right to go to federal court to challenge their continued detention.

John G. Roberts, Jr., Chief Justice of the United States

Born in Buffalo, New York, January 27, 1955. Nominated by George W. Bush July 19, 2005 and took office September 29, 2005. Roberts was preceded by James Buckley who was appointed by Ronald Reagan. Roberts is Roman Catholic, Republican, married to Jane Sullivan (since 1996) and has 2 children.

Roberts belongs to the conservative wing of the Court, though he did side with the liberal wing when reaffirming the legality of Obamacare.

Capital punishment
  • In Kennedy v. Louisiana (2008) Roberts joined the dissent arguing that child rape is a capital offense and can carry the death penalty.
Environment
  • In Rapanos v. United States (2006) Roberts concurred with the Court’s ruling to prevent federal jurisdiction to regulate isolated wetlands under the Clean Water Act.
  • In Massachusetts v. Environmental Protection Agency (2007) Roberts went against the majority ruling to force the EPA to regulate carbon dioxide and other greenhouse gases as pollutants, arguing that Massachusetts’ alleged injury was too speculative due to insufficient scientific evidence that greenhouse gases contribute to global warming, and that there is no traceable causal connection between the EPA’s refusal to enforce emission standards and petitioners’ injuries.
  • In Entergy Corp. v. Riverkeeper Inc. (2009) Roberts joined the majority to uphold the EPA’s decision to allow cost–benefit analysis when determining best technology available to maintain national environmental standards.
  • In Coeur Alaska, Inc. v. Southeast Alaska Conservation Council (2009) Roberts joined the majority, voting in favor of an Alaskan mining company, to uphold a USACE permit to dump waste into a lake.
Gay rights
  • In United States v. Windsor (2013) Roberts dissented the majority ruling to strike down a federal law denying benefits to married same-sex couples, arguing the “Defense of Marriage Act” was unconstitutional because the federal government was interfering with state control of marriage.
  • In Obergefell v. Hodges (2015) Roberts dissented the majority ruling to guarantee same-sex couples the right to marry, criticizing the Court for expanding fundamental rights without caution or regard for history – namely the historic definition of marriage the “the union of a man and a woman”.
Gun control
  • In District of Columbia v. Heller (2008) Roberts joined the majority to overturn the ban on handguns in the District of Columbia, as the ban violates the Second Amendment.
Habeas corpus
  • In Boumediene v. Bush (2008) Roberts dissented from the majority ruling and argued against Guantanamo Bay prisoners having a constitutional right to go to federal court to challenge their continued detention.

Samuel Anthony Alito, Jr., Associate Justice

Born in Trenton, New Jersey, April 1, 1950. Nominated by George W. Bush on November 10, 2005 and took office January 31, 2006. Alito was preceded by Sandra Day O’Connor who was appointed by Ronald Reagan. Alito is a Roman Catholic, Republican, married to Martha Bomgardner and has 2 children.
Alito belongs to the conservative wing of the Court.

Capital punishment
  • In Kennedy v. Louisiana (2008) Alito led the dissent arguing that child rape is a capital offense and can carry the death penalty.
Environment
  • In Rapanos v. United States (2006) Alito joined the plurality ruling to prevent federal jurisdiction to regulate isolated wetlands under the Clean Water Act.
  • In Massachusetts v. Environmental Protection Agency (2007) Alito joined Roberts in the dissent, voting against forcing the EPA to regulate carbon dioxide and other greenhouse gases as pollutants, arguing that Massachusetts’ alleged injury was too speculative due to insufficient scientific evidence that greenhouse gases contribute to global warming, and that there is no traceable causal connection between the EPA’s refusal to enforce emission standards and petitioners’ injuries.
  • In Entergy Corp. v. Riverkeeper Inc. (2009) Alito joined the majority to uphold the EPA’s decision to allow cost–benefit analysis when determining best technology available to maintain national environmental standards.
  • In Coeur Alaska, Inc. v. Southeast Alaska Conservation Council (2009) Alito joined the majority, voting in favor of an Alaskan mining company, to uphold a USACE permit to dump waste into a lake.
Gay rights
  • In United States v. Windsor (2013) Alito dissented the majority ruling to strike down a federal law denying benefits to married same-sex couples, arguing the “Defense of Marriage Act” was unconstitutional because the federal government was interfering with state control of marriage.
  • In Obergefell v. Hodges (2015) Alito dissented the majority ruling to guarantee same-sex couples the right to marry.
Gun control
  • In District of Columbia v. Heller (2008) Alito joined the majority to overturn the ban on handguns in the District of Columbia, as the ban violates the Second Amendment.
Habeas corpus
  • In Boumediene v. Bush (2008) Alito joined the dissent against the majority ruling that Guantanamo Bay prisoners have a constitutional right to go to federal court to challenge their continued detention.

Sonia Sotomayor, Associate Justice

Born in New York City, New York, June 25, 1954. Nomintaed in May 2009 by Barack Obama and took office on August 8, 2009. Sotomayor was preceded by David Souter who was nominated by George H. W. Bush. Sotomayor is a Roman catholic, Democrat, married to Kevin Noonan (since 1976) and has no children.

Sotomayor’s desire to become a judge was inspired by the TV show Perry Mason. She is the third woman chosen to serve in the Supreme Court and the first Latina Supreme Court Justice in U.S. history.

Gay rights
  • In United States v. Windsor (2013) Sotomayor joined the majority ruling to strike down a federal law denying benefits to married same-sex couples.
  • In Obergefell v. Hodges (2015) Sotomayor joined the majority ruling to guarantee same-sex couples the right to marry.

Elena Kagan, Associate Justice

Born in New York City, New York, April 28 ,1960. Nominated by Barack Obama May 10, 2010 and took office August 7, 2010. Kagan was preceded by John Paul Stevens who was nominated by Gerald Ford. Kagan is a Jewish, Democrat, unmarried and has no children.
Kagen is the forth woman chosen to serve in the Supreme Court.

Gay rights
  • In United States v. Windsor (2013) Kagan joined the majority ruling to strike down a federal law denying benefits to married same-sex couples.
  • In Obergefell v. Hodges (2015) Kagan joined the majority ruling to guarantee same-sex couples the right to marry.

Anthony Kennedy John G. Roberts Clarence Thomas Samuel Alito Ruth Bader Ginsburg Sonia Sotomayor Stephen Breyer Elena Kagan

Additional reading:

 

Facebooktwitterredditpinterestlinkedinmail

SQL (Structured Query Language) Cheat Sheet

Operators

=
Equal

 

<>
Not equal

 

>
Greater than

 

<
Less than.

 

>=
Greater than or equal.

 

<=
Less than or equal.

 

BETWEEN
Between an inclusive range.

 

IN
Search for exact value in a list.

 

LIKE
Search for a pattern.

 

%
Wildcard/s in a pattern.

 

AND
Used between arguments in WHERE statement.

 

OR
Used between arguments in WHERE statement

 

ASC
Alphabetical and numerical order – default for ORDER BY statement

 

DESC
Reverse alphabetical and numerical order

 

Data Types

integer(size)
Integers only. Maximum number of digits specified in parenthesis.

 

int(size)
Integers only. Maximum number of digits specified in parenthesis.

 

smallint(size)
Integers only. Maximum number of digits specified in parenthesis.

 

tinyint(size)
Integers only. Maximum number of digits specified in parenthesis.

 

decimal(size,d)
Hold numbers with fractions. Maximum number of digits specified in “size”. Maximum number of digits to the right of the decimal is specified in “d”.

 

numeric(size,d)
Hold numbers with fractions. Maximum number of digits specified in “size”. Maximum number of digits to the right of the decimal is specified in “d”.

 

char(size)
Holds a fixed length string (can contain letters, numbers, and special characters). The fixed size is specified in parenthesis.

 

varchar(size)
Holds a variable length string (can contain letters, numbers, and special characters). The maximum size is specified in parenthesis.

 

date(yyyymmdd)
Holds a date

 

Functions

SUM(column)
Return the total sum of columns’ values

 

AVG(column)
Return the average value of a column

 

COUNT(column)
Return the number of rows (excluding NULL) of a column

 

MAX(column)
Return the highest value of a column

 

MIN(column)
Return the lowest value of a column

 

Database Manipulation

Create database
CREATE DATABASE database_name

 

Delete database
DROP DATABASE database_name

 

Table Manipulation

Create table
CREATE TABLE “table_name”
(“column_1” “data_type_for_column_1”,
“column_2” “data_type_for_column_2”,
… )

 

Add column to a table
ALTER TABLE table_name
ADD column_name datatype

 

Delete column from a table
ALTER TABLE table_name
DROP column_name datatype

 

Delete table
DROP TABLE table_name

 

Index Manipulation

Create index
CREATE INDEX index_name
ON table_name (column_name_1, column_name_2, …)

 

Create a unique index
CREATE UNIQUE INDEX index_name
ON table_name (column_name_1, column_name_2, …)

 

Delete index
DROP INDEX table_name.index_name

 

Data Manipulation

Insert new rows into a table
INSERT INTO table_name VALUES (value_1, value_2,….)
or
INSERT INTO table_name (column1, column2,…)
VALUES (value_1, value_2,….)

 

Update column/s
UPDATE table_name
SET column_name_1 = new_value_1, column_name_2 = new_value_2
WHERE column_name = some_value

 

Delete row/s
DELETE FROM table_name
WHERE column_name = some_value

 

Delete the data from a table
TRUNCATE TABLE table_name

 

Select

Select all data from a table
SELECT *
FROM table_name

 

Select all data from specified columns
SELECT column_name(s)
FROM table_name

 

Select using alias
SELECT table_alias.column_name AS column_alias
FROM table_name AS table_alias

 

Select only distinct (different) data from a table.
SELECT DISTINCT column_name(s)
FROM table_name

 

Limit selection
Select data using WHERE, AND, OR
SELECT column_name(s) FROM table_name
WHERE column operator value
AND column operator value
OR column operator value

 

Select data using IN.
SELECT column_name(s) FROM table_name
WHERE column_name IN (value1, value2, …)

 

Order selection
Order results buy column value ascending or descending.
SELECT column_name(s) FROM table_name
ORDER BY column_1 DESC/ASC

 

Join selection
Select all matching rows from 2 tables.
SELECT column_1_name, column_2_name, …
FROM first_table_name
INNER JOIN second_table_name

 

Select all rows from the first table, even if there are no matches in the second table.
SELECT column_1_name, column_2_name, …
FROM first_table_name
LEFT JOIN second_table_name
ON first_table_name.key = second_table_name.foreign_key

 

Select all rows from the second table, even if there are no matches in the first table.
SELECT column_1_name, column_2_name, …
FROM first_table_name
RIGHT JOIN second_table_name
ON first_table_name.key = second_table_name.foreign_key

 

Add up selections
Select all the values from multiple SQL statements.
SQL_Statement_1
UNION ALL
SQL_Statement_2

 

Select all the different values from multiple SQL statements.
SQL_Statement_1
UNION
SQL_Statement_2 Select

 

Populate with selection
Select and insert into another table.
SELECT column_name(s)
INTO new_table_name
FROM source_table_name
WHERE …

 

Select and insert into another database.
SELECT column_name(s)
IN external_database_name
FROM source_table_name
WHERE …

 

Populate a virtual table with the result-set of a SELECT statement.
CREATE VIEW view_name AS
SELECT column_name(s)
FROM table_name
WHERE …

 

Facebooktwitterredditpinterestlinkedinmail

How to Use Vim – Vim Cheat Sheet

Cursor movement

  • h – move cursor left
  • j – move cursor down
  • k – move cursor up
  • l – move cursor right
  • w – jump forwards to the start of a word
  • W – jump forwards to the start of a word (words can contain punctuation)
  • e – jump forwards to the end of a word
  • E – jump forwards to the end of a word (words can contain punctuation)
  • b – jump backwards to the start of a word
  • B – jump backwards to the start of a word (words can contain punctuation)
  • 0 – jump to the start of the line
  • ^ – jump to the first non-blank character of the line
  • $ – jump to the end of the line
  • G – go to the last line of the document
  • 5G – go to line 5
  • fx – jump to next occurrence of character x
  • tx – jump to before next occurrence of character x
  • } – Jump to next paragraph (or function/block, when editing code)
  • { – Jump to previous paragraph (or function/block, when editing code)

Insert mode – inserting/appending text

  • i – insert before the cursor
  • I – insert at the beginning of the line
  • a – insert (append) after the cursor
  • A – insert (append) at the end of the line
  • o – append (open) a new line below the current line
  • O – append (open) a new line above the current line
  • ea – insert (append) at the end of the word
  • Esc – exit insert mode

Editing

  • r – replace a single character
  • J – join line below to the current one
  • cc – change (replace) entire line
  • cw – change (replace) to the end of the word
  • c$ – change (replace) to the end of the line
  • s – delete character and substitute text
  • S – delete line and substitute text (same as cc)
  • xp – transpose two letters (delete and paste)
  • u – undo
  • Ctrl + r – redo
  • . – repeat last command

Marking text (visual mode)

  • v – start visual mode, mark lines, then do a command (like y-yank)
  • V – start linewise visual mode
  • o – move to other end of marked area
  • Ctrl + v – start visual block mode
  • O – move to other corner of block
  • aw – mark a word
  • ab – a block with ()
  • aB – a block with {}
  • ib – inner block with ()
  • iB – inner block with {}
  • Esc – exit visual mode

Visual commands

  • > – shift text right
  • < – shift text left
  • y – yank (copy) marked text
  • d – delete marked text
  • ~ – switch case

Cut and paste

  • yy – yank (copy) a line
  • 2yy – yank (copy) 2 lines
  • yw – yank (copy) word
  • y$ – yank (copy) to end of line
  • p – put (paste) the clipboard after cursor
  • P – put (paste) before cursor
  • dd – delete (cut) a line
  • 2dd – delete (cut) 2 lines
  • dw – delete (cut) word
  • D – delete (cut) to the end of the line
  • d$ – delete (cut) to the end of the line
  • x – delete (cut) character

Exiting

  • :w – write (save) the file, but don’t exit
  • :wq or :x or ZZ – write (save) and quit
  • :q – quit (fails if there are unsaved changes)
  • :q! or ZQ – quit and throw away unsaved changes

Search and replace

  • /pattern – search for pattern
  • ?pattern – search backward for pattern
  • \vpattern – ‘very magic’ pattern: non-alphanumeric characters are interpreted as special regex symbols (no escaping needed)
  • n – repeat search in same direction
  • N – repeat search in opposite direction
  • :%s/old/new/g – replace all old with new throughout file
  • :%s/old/new/gc – replace all old with new throughout file with confirmations

Working with multiple files

  • :e filename – edit a file in a new buffer
  • :bnext or :bn – go to the next buffer
  • :bprev or :bp – go to the previous buffer
  • :bd – delete a buffer (close a file)
  • :sp filename – open a file in a new buffer and split window
  • :vsp filename – open a file in a new buffer and vertically split window
  • Ctrl + ws – split window
  • Ctrl + ww – switch windows
  • Ctrl + wq – quit a window
  • Ctrl + wv – split window vertically
  • Ctrl + wh – move cursor to the left window (vertical split)
  • Ctrl + wl – move cursor to the right window (vertical split)
  • Ctrl + wj – move cursor to the window below (horizontal split)
  • Ctrl + wk – move cursor to the window above (horizontal split)

Tabs

  • :tabnew filename or :tabn filename – open a file in a new tab
  • Ctrl + wT – move the current split window into its own tab
  • gt or :tabnext or :tabn – move to the next tab
  • gT or :tabprev or :tabp – move to the previous tab
  • #gt – move to tab number #
  • :tabmove # – move current tab to the #th position (indexed from 0)
  • :tabclose or :tabc – close the current tab and all its windows
  • :tabonly or :tabo – close all tabs except for the current one

 

Facebooktwitterredditpinterestlinkedinmail