Skip to content

Instantly share code, notes, and snippets.

@Osse
Osse / ftplugin_help.vim
Created April 15, 2012 21:36
Mappings to make :help perusal easier for lazy people
if &readonly
nnoremap <CR> <C-]>
nnoremap <BS> <C-O>
nnoremap <Down> /\('\<bar><bar>\)[^, <bar>]\{-1,}\1<CR>:nohl<cr>
nnoremap <Up> ?\('\<bar><bar>\)[^, <bar>]\{-1,}\1<CR>:nohl<cr>
endif
@Osse
Osse / .vimrc
Created April 19, 2012 05:03
Hex toggling function
fun ToggleHex()
if (!exists("b:is_hex"))
let b:is_hex = 1
endif
if b:is_hex
exe '%!xxd -r'
let b:is_hex = 0
else
exe '%!xxd'
let b:is_hex = 1
@Osse
Osse / .zshrc
Created May 24, 2012 21:39
Vi mode indicator for ZSH
# Mode indication {{{
function zle-line-init zle-keymap-select {
RPS1="%B${${KEYMAP/vicmd/n}/(main|viins)/i}%b"
RPS2=$RPS1
zle reset-prompt
}
zle -N zle-line-init
zle -N zle-keymap-select
setopt transient_rprompt
@Osse
Osse / .vimrc
Created June 5, 2012 18:16
NERDTree toggler that disables 'list' in it.
nnoremap <F2> :call MyNerdTreeToggle()<CR>
function! MyNerdTreeToggle()
NERDTreeToggle
if bufname('NERD_tree') != ""
call setwinvar(bufwinnr('NERD_tree'), '&list', 0)
endif
endfunction
@Osse
Osse / .zshrc
Created June 7, 2012 15:41
TMUX detection
if [ -z $TMUX ]; then
export TERM="xterm-256color"
else
export TERM="screen-256color"
fi
@Osse
Osse / shortpath.pl
Created June 10, 2012 14:42
Path shortener
#!/usr/bin/env perl
use strict;
use warnings;
my $cwd = $ENV{'PWD'};
my $home = $ENV{'HOME'};
if ($cwd eq $home) {
print '~'; exit;
}
@Osse
Osse / replace.diff
Created July 2, 2012 15:04
Patch to add replacement of linebreaks with spaces
diff --git a/src/gui/curses/gui-curses-key.c b/src/gui/curses/gui-curses-key.c
index 92393ac..db1fe59 100644
--- a/src/gui/curses/gui-curses-key.c
+++ b/src/gui/curses/gui-curses-key.c
@@ -487,7 +487,7 @@ gui_key_flush (int paste)
int
gui_key_read_cb (void *data, int fd)
{
- int ret, i, accept_paste, cancel_paste, text_added_to_buffer, pos;
+ int ret, i, accept_paste, cancel_paste, replace_paste, text_added_to_buffer, pos;
@Osse
Osse / vimrc
Created July 3, 2012 04:58
Easier to read than the original
if neocomplcache#sources#snippets_complete#jumpable()
imap <expr><C-j> "\<Plug>(neocomplcache_snippets_jump)"
imap <expr><C-k> "\<Plug>(neocomplcache_snippets_jump)"
endif
@Osse
Osse / autohotkey.ahk
Created July 4, 2012 21:33
Autohotkey stuff
; IMPORTANT INFO ABOUT GETTING STARTED: Lines that start with a
; semicolon, such as this one, are comments. They are not executed.
; This script has a special filename and path because it is automatically
; launched when you run the program directly. Also, any text file whose
; name ends in .ahk is associated with the program, which means that it
; can be launched simply by double-clicking it. You can have as many .ahk
; files as you want, located in any folder. You can also run more than
; one .ahk file simultaneously and each will get its own tray icon.
@Osse
Osse / vimrc
Created July 29, 2012 10:05
Function that hackly tries to determine whether syntax folding is supported
function! HasSyntaxFolding()
redir => foo
silent syntax
redir END
return match(foo, '\<fold\>') == -1 ? 0 : 1
endfunction