Skip to content

Instantly share code, notes, and snippets.

View davidmh's full-sized avatar
🐧

David Mejorado davidmh

🐧
View GitHub Profile
@davidmh
davidmh / fzf+ag.vim
Created April 28, 2017 23:55
fzf.vim + ag
" Ag / git grep
function! s:ag_to_qf(line)
let parts = split(a:line, ':')
return { 'filename': parts[0]
\,'lnum': parts[1]
\,'col': parts[2]
\,'text': join(parts[3:], ':')
\ }
endfunction
@davidmh
davidmh / nvim-term-maps.vim
Last active June 22, 2016 16:48
Mappings and basic REPL for Neovim's :term
" Term bindings
"
" Spawns
" open shell on the current window
nnoremap <c-t><c-e> :e term://$SHELL<CR>A
" open vertical shell
nnoremap <c-t><c-v> <c-w><c-v><c-w><c-l>:e term://$SHELL<CR>A
" open horizontal shell
nnoremap <c-t><c-s> <c-w><c-s><c-w><c-j>:e term://$SHELL<CR>A
"
@davidmh
davidmh / init.vim
Last active February 18, 2018 22:54
neovim config
let g:mapleader = "\<SPACE>"
" Show white spaces at the end of a line
set list listchars=tab:▸\ ,eol:¬,trail:·
" edit this nvim config
nnoremap <silent> <leader>ev :vs $HOME/.config/nvim/init.vim<CR>
" auto-reload
augroup VimConfig
au!
@davidmh
davidmh / fugitive-swoop.vim
Last active May 23, 2016 17:11
vim-fugitive + vim-swoop
function! Cmd2QuickFix(command, prompt, use_swoop)
" use the current word as the default value
let default = expand("<cword>")
call inputsave()
let pattern = input(a:prompt, default)
call inputrestore()
if empty(pattern)
echo a:command . ' needs a pattern, see :h ' . a:command
else
exe 'silent ' . a:command . ' ' . pattern . ' | redraw!'
@davidmh
davidmh / fzf-reverse-i-search.vim
Created September 16, 2015 18:11
reverse-i-search for vim with fzf
" reverse-i-search
function! s:get_history()
redir => history
silent! history
redir END
return map(split(history, '\n'), "strpart(v:val, 9)")
endfunction
function! s:run_cmd(cmd)
execute a:cmd
endfunction
let mapleader = "<Space>"
unmap b
map <Leader>b :buffer
map #n nextSearchResult
map n :execute #nzz<CR>
site '*://*.reddit.com/*' {
unmap j
unmap k
set numerichints
@davidmh
davidmh / config.fish
Last active August 29, 2015 14:20
Fish prompt based on the minimal theme from oh-my-zsh. Put following code at the end of ~/.config/fish/config.fish. http://i.imgur.com/o7rOlRv.png
set fish_git_dirty_color red
set fish_git_not_dirty_color white
function parse_git_branch
set -l branch (git branch 2> /dev/null | grep -e '\* ' | sed 's/^..\(.*\)/\1/')
set -l git_status (git status -s)
if test -n "$git_status"
echo (set_color normal)$branch(set_color $fish_git_dirty_color)●(set_color normal)
else
@davidmh
davidmh / config.fish
Last active November 28, 2020 13:37
Showing git branch in fish shell prompt. Put following code at the end of ~/.config/fish/config.fish. It will also highlight in red if branch is dirty. Based on http://zogovic.com/post/37906589287/showing-git-branch-in-fish-shell-prompt
set fish_git_dirty_color red
set fish_git_not_dirty_color green
function parse_git_branch
set -l branch (git branch 2> /dev/null | grep -e '\* ' | sed 's/^..\(.*\)/\1/')
set -l git_status (git status -s)
if test -n "$git_status"
echo (set_color $fish_git_dirty_color)$branch(set_color normal)
else

Keybase proof

I hereby claim:

  • I am davidmh on github.
  • I am chaac (https://keybase.io/chaac) on keybase.
  • I have a public key whose fingerprint is 91DC 6839 9375 4082 600D 9318 9D55 8125 A705 A525

To claim this, I am signing this object:

@davidmh
davidmh / CtrlP_acceleration
Last active July 12, 2023 16:33 — forked from av-ast/CtrlP_acceleration
Accelerate CtrlP by ignoring certain files and paths. Including node modules and grunt's .tmp
" Ignore some folders and files for CtrlP indexing
let g:ctrlp_custom_ignore = {
\ 'dir': '\.git$\|\.yardoc\|node_modules\|log\|tmp$',
\ 'file': '\.so$\|\.dat$|\.DS_Store$'
\ }