Skip to content

Instantly share code, notes, and snippets.

@nelstrom
nelstrom / controllers.application.js
Last active September 24, 2018 13:07
New Twiddle
import Ember from 'ember';
export default Ember.Controller.extend({
appName: 'Ember Twiddle'
});
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 December 12, 2017 14:48
Simple rake script to automate building a PDF from markdown (via .tex)
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 October 17, 2017 17:20
Specifying project-local indentation settings via Projectionist
{
"*.js": {
"indent": "tabs:3"
}
}
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")
{
"app/routes/*.js": {
"type": "route",
"alternate": "app/templates/{}.hbs"
},
"app/templates/*.hbs": {
"type": "controllerTemplate",
"alternate": "app/controllers/{}.js"
},
"app/controllers/*.js": {
if [ -n "$NVIM_LISTEN_ADDRESS" ]; then
alias nvim='echo "No nesting!"'
fi
%s/}\ \\label/}\\label/ge
%s/\ \\ref/\~\\ref/ge
%s/\ "/\ ``/ge
%s/"\ /''\ /ge
%s/",/'',/ge
%s/"\./''\./ge
%s/")/'')/ge
%s/i\.e\.\ /i\.e\.\\\ /ge
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
if has('nvim')
tnoremap <expr> <C-R> '<C-\><C-N>"'.nr2char(getchar()).'pi'
tnoremap <C-v><C-r> <C-r>
endif