Skip to content

Instantly share code, notes, and snippets.

View valencik's full-sized avatar
🍍

Andrew Valencik valencik

🍍
View GitHub Profile
@valencik
valencik / vimdeck-presentation
Created September 7, 2014 18:12
Vimdeck multiple lists issue.
$ls -l presentation/
total 16
-rw-r--r-- 1 andrew admin 153 7 Sep 14:58 script.vim
-rw-r--r-- 1 andrew admin 360 7 Sep 14:58 slide001.md
-----
$cat script.vim
set nonumber
set hidden
noremap <PageUp> :bp<CR>
#include <stdbool.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
static char * append (char *field, size_t *size, size_t *len, char c);
static size_t get_field (char **field, size_t *size, FILE *file);
static char const * strip_field (char *field, size_t len);
static bool end_of_file = false;

Your problem with Vim is that you don't grok vi.

Answer by Jim Dennis on Stack Overflow question: what is your most productive shortcut?

You mention cutting with yy and complain that you almost never want to cut whole lines. In fact programmers, editing source code, very often want to work on whole lines, ranges of lines and blocks of code. However, yy is only one of many way to yank text into the anonymous copy buffer (or "register" as it's called in vi).

@valencik
valencik / thorium.rb
Created April 4, 2014 01:55
Dishonourable Ruby Warrior Code
class Player
@health = 20
@wall_reached = false
def play_turn(warrior)
@if_pivot = true
if (!@if_pivot)
warrior.pivot!