Skip to content

Instantly share code, notes, and snippets.

function! Hoge() abort
let lines = []
for row in range(1, 999)
let line = ''
for col in range(1, &columns)
let c = screenchar(row, col)
if 0 < c
let line .= nr2char(c)
endif
set runtimepath+=~/Dropbox/vim-modules/dart-vim-plugin
set runtimepath+=~/Dropbox/vim-modules/vim-operator-user
set runtimepath+=~/Dropbox/vim-modules/vim-operator-replace
set runtimepath+=~/Dropbox/vim-modules/vim-csharp
set runtimepath+=~/Dropbox/vim-modules/vim-gitdiff
set runtimepath+=~/Dropbox/vim-modules/vim-next-reading-vimrc
set runtimepath+=~/Dropbox/vim-modules/vim-powershell
set runtimepath+=~/Dropbox/vim-modules/badwolf
set runtimepath+=~/Dropbox/vim-modules/vim-qfreplace
function! s:str2nr(str, base) abort
let xs = map(range(0x30, 0x39) + range(0x41, 0x5A), 'nr2char(v:val)')
let n = 0
let total = 0
if a:base == 1
return len(a:str) - 1
else
for c in reverse(split(a:str, '\zs'))
let total += index(xs, c) * pow(a:base, n)
let n += 1
@rbtnn
rbtnn / gist:739a2fabf3317a95c965
Created July 1, 2015 15:07
nyagos gitブランチ補完
nyagos.completion_hook = function (c)
local bs = {
"submodules",
"add",
};
if c.text:match('^git ') then
for b in nyagos.eval('git branch'):gmatch('[^ \n*>-/]+') do
table.insert(bs, b);
end
@rbtnn
rbtnn / gist:8025ea54d47298817bb2
Created May 3, 2015 10:19
brew install macvim
$brew install macvim
==> Downloading https://github.com/b4winckler/macvim/archive/snapshot-73.tar.gz
Already downloaded: /Library/Caches/Homebrew/macvim-7.4-73.tar.gz
==> ./configure --with-features=huge --enable-multibyte --with-macarchs=x86_64 -
==> make
==> Caveats
.app bundles were installed.
Run `brew linkapps` to symlink these to /Applications.
==> Summary
🍺 /usr/local/Cellar/macvim/7.4-73: 1810 files, 28M, built in 45 seconds
function! s:hoge(str, n) abort
let begin = len(a:str) % a:n
return (begin is 0 ? [] : [a:str[:begin-1]]) + split(a:str[(begin):], repeat('.', a:n) . '\zs')
endfunction
echo s:hoge('1234', 3)
function! s:RangePython() range
let selected_lines = getbufline('%', line("'<"), line("'>"))
let cmd = 'python hoge.py'
let lines = split(system(cmd, join(selected_lines, "\n")), "\n")
call append('.', lines)
endfunction
command! -range RangePython :call <sid>RangePython()
1) シェル内で
$ wget -O rails.zip "http://www.vim.org/scripts/download_script.php?src_id=13800"
$ unzip rails.zip -d ~/.vim/
2) ~/.vimrc内で
set runtimepath+=~/.vim/rails
を記載。
<!DOCTYPE html>
<html>
<head>
<!-- <script type="./jsPDF-0.9.0rc2/jspdf.js"> -->
</head>
<body>
<canvas width="400" height="200" id="sample" style="background-color: #eeffee;">
</canvas>