Skip to content

Instantly share code, notes, and snippets.

Drew Neil nelstrom

Block or report user

Report or block nelstrom

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View controllers.application.js
import Ember from 'ember';
export default Ember.Controller.extend({
appName: 'Ember Twiddle'
});
View init.vim
augroup startup
autocmd!
autocmd VimEnter * call PreventNestedNeovim()
augroup END
function! PreventNestedNeovim()
if !empty($NVIM_LISTEN_ADDRESS) && $NVIM_LISTEN_ADDRESS !=# v:servername
let g:r=sockconnect('pipe', $NVIM_LISTEN_ADDRESS, {'rpc':v:true})
let g:f=fnameescape(expand('%:p'))
noautocmd bwipe
@nelstrom
nelstrom / Rakefile
Created Dec 12, 2017
Simple rake script to automate building a PDF from markdown (via .tex)
View Rakefile
require 'rake'
require 'rake/clean'
task :default => :pdf
task :pdf => "book-draft1.pdf"
file "book-draft1.tex" => "book-draft1.md" do
sh "pandoc book-draft1.md -s -o book-draft1.tex"
end
@nelstrom
nelstrom / .projections.json
Created Oct 17, 2017
Specifying project-local indentation settings via Projectionist
View .projections.json
{
"*.js": {
"indent": "tabs:3"
}
}
View navcmd-abbrev.vim
function! SetupCommandAlias(input, output)
exec 'cabbrev <expr> '.a:input
\ .' ((getcmdtype() is# ":" && getcmdline() is# "'.a:input.'")'
\ .'? ("'.a:output.'") : ("'.a:input.'"))'
endfunction
call SetupCommandAlias("Em", "Emodel")
call SetupCommandAlias("Etm", "EmodelTest")
View ember-templates-projections.json
{
"app/routes/*.js": {
"type": "route",
"alternate": "app/templates/{}.hbs"
},
"app/templates/*.hbs": {
"type": "controllerTemplate",
"alternate": "app/controllers/{}.js"
},
"app/controllers/*.js": {
View gist:679c819db27b1f38ee549b480471c0bc
if [ -n "$NVIM_LISTEN_ADDRESS" ]; then
alias nvim='echo "No nesting!"'
fi
View fix-stuff-up.vim
%s/}\ \\label/}\\label/ge
%s/\ \\ref/\~\\ref/ge
%s/\ "/\ ``/ge
%s/"\ /''\ /ge
%s/",/'',/ge
%s/"\./''\./ge
%s/")/'')/ge
%s/i\.e\.\ /i\.e\.\\\ /ge
View user-funcs.vim
function! MyFunction()
%s/ch/cx/ge
endfunction
" You can call the function as:
" :call MyFunction()
command! MyCommand call MyFunction()
" You can call the command as:
" :MyCommand
View control-r-in-terminal-mode.vim
if has('nvim')
tnoremap <expr> <C-R> '<C-\><C-N>"'.nr2char(getchar()).'pi'
tnoremap <C-v><C-r> <C-r>
endif
You can’t perform that action at this time.