This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ nvim -u NORC | |
:cd | |
:edit ~/.config/somefile.txt | |
" absolute path | |
:echo @% | |
:cd .config | |
:cd - | |
" relative path | |
:echo @% |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
autocmd VimEnter * nested | |
\ if argc() == 0 | |
\| let last = filter(filter(copy(v:oldfiles), 'match(v:val, getcwd()) == 0'), 'filereadable(v:val)') | |
\| if !empty(last) | |
\| execute 'edit' fnameescape(last[0]) | |
\| endif | |
\| endif |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
set scrolloff=0 | |
function! s:foo() | |
echomsg line('w$') | |
normal! L | |
+ | |
echomsg line('w$') | |
endfunction | |
call s:foo() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
augroup grepper-side | |
autocmd! | |
autocmd FileType GrepperSide silent! keeppatterns %s/^\ze[^\>]/ / | 1 | |
augroup END | |
function! s:context_jump(close_window) | |
let fileline = search('\v^\>\>\> [[:alnum:]\/\-_.~]+:\d+', 'bcn') | |
if empty(fileline) | |
return | |
endif |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
" | |
" usage: :Vimgrep /foo/ ** | |
" | |
function! s:exit_handler(id) dict abort | |
execute 'cfile' self.tempfile | |
copen | |
endfunction | |
function! s:vimgrep(args) abort |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let data1 = [] | |
let data2 = [] | |
let cmd1 = ['sh', '-c', 'ag --vimgrep foo'] | |
let cmd2 = ['sh', '-c', 'rg --no-heading --vimgrep -i foo'] | |
function! s:stdout1(channel, data) | |
let g:data1 += [a:data] | |
endfunction | |
function! s:stdout2(channel, data) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python3 | |
import sys | |
import os | |
from neovim import attach | |
# WORKING: | |
def make_func(num): | |
def func(): |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let s:buf = [] | |
function! s:error(msgs) | |
redraw | |
echohl ErrorMsg | |
for line in a:msgs | |
echomsg line | |
endfor | |
echohl NONE | |
endfunction |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- assert_exception({cmd}, [, {error}]) | |
describe('assert_exception()', function() | |
it('should assert thrown exceptions properly', function() | |
source([[ | |
try | |
nocommand | |
catch | |
call assert_exception('E492') | |
endtry | |
]]) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function! s:dump_api() | |
let api = msgpackparse(systemlist('nvim --api-info'))[0] | |
for v in api.functions | |
echohl Function | |
echomsg v.name._VAL[0] | |
echohl NONE | |
echohl Title | |
echon '('. join(map(v.parameters, 'v:val[1]._VAL[0] .":". v:val[0]._VAL[0]'), ', ') .')' |