Skip to content

Instantly share code, notes, and snippets.

View tjdevries's full-sized avatar
🏠
Open Open Source: https://www.twitch.tv/teej_dv

TJ DeVries tjdevries

🏠
Open Open Source: https://www.twitch.tv/teej_dv
View GitHub Profile
-- Output to stderr:
busted: error: Cannot load helper script: /home/tj_chromebook/Git/neovim/test/functional/preload.lua
./test/functional/helpers.lua:5: module 'nvim.child_process_stream' not found:No LuaRocks module found for nvim.child_process_stream
no field package.preload['nvim.child_process_stream']
no file '/home/tj_chromebook/Git/neovim/build/nvim/child_process_stream.lua'
no file '/home/tj_chromebook/Git/neovim/.deps/usr/share/lua/5.1/nvim/child_process_stream.lua'
no file '/home/tj_chromebook/Git/neovim/.deps/usr/share/lua/5.1/nvim/child_process_stream/init.lua'
no file './nvim/child_process_stream.lua'
no file '/home/tj_chromebook/Git/neovim/.deps/usr/share/luajit-2.0.4/nvim/child_process_stream.lua'
no file '/usr/local/share/lua/5.1/nvim/child_process_stream.lua'
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
function! TestReturnHighlight()
if &spell
return '%#PreProc#%l%0'
else
return 'Not spelling and no colors'
endif
endfunction
function! SetStatuslineSnippet()
let l:str_stl = ''
@tjdevries
tjdevries / map_info.vim
Created February 17, 2017 16:58
Get some information about the mappings you currently have active in Vim
function! s:get_maps() abort
return split(execute('map'), "\n")
endfunction
function! s:get_dict(mapping) abort
let map_split = split(a:mapping, ' ')
let l:mode = map_split[0]
let l:map = map_split[2]
return maparg(l:map, l:mode, v:false, v:true)
endfunction
@tjdevries
tjdevries / uneven_paste.vim
Created March 30, 2017 18:05
Do some pasting things easily?
" Test text
" hello world
" some text
" here's more text
" 1
" 2
" 3
""
@tjdevries
tjdevries / search_syntax.vim
Created May 31, 2017 22:57
searching syntax
function! TestStuff() abort
normal! gg
let g:res = []
while search('^\S', 'W')
call insert(g:res, {
\ 'name': expand('<cword>'),
\ 'line': line('.'),
\ },
@tjdevries
tjdevries / overlength_highlight.vim
Last active June 28, 2017 21:51
Highlight overlength
let g:highlight_overlength = v:true
let g:highlight_overlength_length = 72
let g:load_overlength = v:true
" Use :call ToggleOverlength()
" to toggle whether or not you show highlights
function! ToggleOverlength() abort
let g:highlight_overlength = !g:highlight_overlength
if g:highlight_overlength
function x()
return 1, 2
end
function y()
local foo = {{x()}, {x()}}
return vim.tbl_flatten(foo)
end
@tjdevries
tjdevries / aligned_virt_text.lua
Created November 6, 2020 16:16
Aligned Virt Text Example (not guaranteed to work forever)
vim.lsp.diagnostic.get_virtual_text_chunks_for_line = function(bufnr, line, line_diagnostics)
if #line_diagnostics == 0 then
return nil
end
local line_length = #(vim.api.nvim_buf_get_lines(bufnr, line, line + 1, false)[1] or '')
local get_highlight = vim.lsp.diagnostic._get_severity_highlight_name
-- Create a little more space between virtual text and contents
local virt_texts = {{string.rep(" ", 80 - line_length)}}
(
(plain_value) @string
(#eq? @string "background-color")
) @matched