Skip to content

Instantly share code, notes, and snippets.

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
を記載。
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()
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)
@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
@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
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
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! 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
@rbtnn
rbtnn / gist:ab8a69bc9389e8c410e310dc6351e123
Created June 18, 2016 14:32
c:\MinGW\bin\windres.exe: vim.rc:1: syntax error
mingw32-make.exe: Entering directory 'C:/Users/naru1/vim/src'
windres --preprocessor="gcc -E -xc" -DRC_INVOKED -DWIN32 -DWINVER=0x0501 -D_WIN32_WINNT=0x0501 -DHAVE_PATHDEF -DFEAT_HUGE -DHAVE_GETTEXT -DHAVE_LOCALE_H -DDYNAMIC_GETTEXT -DFEAT_CSCOPE -DFEAT_JOB_CHANNEL -DFEAT_MBYTE -DFEAT_MBYTE_IME -DDYNAMIC_IME -DDYNAMIC_ICONV \
--input-format=rc --output-format=coff -i vim.rc -o obji386/vimrc.o
c:\MinGW\bin\windres.exe: vim.rc:1: syntax error
プロセスが、存在しないパイプに書き込もうとしました。
vim.rc:17:0: fatal error: when writing output to : Invalid argument
// #else
^
compilation terminated.
c:\MinGW\bin\windres.exe: preprocessing failed.