Compare commits

..

10 commits

9 changed files with 225 additions and 77 deletions

View file

@ -57,13 +57,13 @@ esac
if [ -n "$validate" ]; then
/bin/echo -e "\x1b[33mValidating commit\x1b[0m"
/bin/echo -e "\x1b[2mλ $validate\x1b[0m"
# if sh -c "$validate"
# then
# /bin/echo -e "\x1b[32mValidation Passed!\x1b[0m"
# else
# error=1
# /bin/echo -e "\x1b[1;31mValidation Failed!\x1b[0m"
# fi
if sh -c "$validate"
then
/bin/echo -e "\x1b[32mValidation Passed!\x1b[0m"
else
error=1
/bin/echo -e "\x1b[1;31mValidation Failed!\x1b[0m"
fi
fi
rm .git

61
vim/lua/matcha.lua Normal file
View file

@ -0,0 +1,61 @@
local function nextcol(state)
local from, to = state.str:find(state.pattern, state.last)
if from then
state.last = to+1
return from, to
end
end
local function colmatch(str, pattern)
return nextcol, {str=str,pattern=pattern,last=0}
end
local function findLocations(args)
local files = vim.fs.find(function(file)
if #args>1 then
for _, pattern in ipairs(args), args, 1 do
if vim.fs.basename(file):find(pattern) then
return true
end
end
else
return true
end
return false
end, {
limit=math.huge;
type="file";
})
local locations = {}
for _, file in ipairs(files) do
local lnum = 0
for line in io.lines(file) do
lnum = lnum + 1
for from, to in colmatch(line, args[1]) do
table.insert(locations, {
filename = file;
lnum = lnum;
col = from;
end_col = to;
text = line:sub(from, to)
})
end
end
end
return locations
end
vim.api.nvim_create_user_command("Matcha", function(params)
vim.fn.setqflist(findLocations(params.fargs))
vim.cmd("copen")
vim.cmd("crewind")
end, {nargs="+"})
vim.api.nvim_create_user_command("MatchaLocal", function(params)
vim.fn.setloclist(0, findLocations(params.farts))
vim.cmd("lopen")
vim.cmd("lrewind")
end, {nargs="+"})

View file

@ -28,18 +28,27 @@ use {
end
};
{
"hedyhli/outline.nvim",
config = function()
vim.keymap.set("n", "<leader>o", "<cmd>OutlineOpen<CR><cmd>OutlineFocus<CR>", { desc = "Toggle Outline" })
require("outline").setup()
end
"hedyhli/outline.nvim", config = require 'pack.setup.outline';
};
{ 'jinh0/eyeliner.nvim', config = function()
require('eyeliner').setup {
highlight_on_key = true;
dim = true;
}
end};
end
};
{
'chentoast/marks.nvim';
config = function()
require'marks'.setup {
sign_priority = { lower=10, upper=15, builtin=8, bookmark=20 },
excluded_filetypes = {},
excluded_buftypes = {},
mappings = {}
}
end
};
'folke/twilight.nvim';
'leafo/moonscript-vim';
'neovim/nvim-lspconfig';
'pigpigyyy/Yuescript-vim';
@ -49,11 +58,12 @@ use {
'AlessandroYorba/Alduin';
'AlessandroYorba/Sierra';
'DarkWiiPlayer/papercolor-theme';
'EdenEast/nightfox.nvim';
'axvr/photon.vim';
'ayu-theme/ayu-vim';
'dracula/vim';
'jaredgorski/fogbell.vim';
'kvrohit/mellow';
'kvrohit/mellow.nvim';
'optionalg/Arcadia';
'rakr/vim-two-firewatch';
'rebelot/kanagawa.nvim';

View file

@ -1,5 +1,8 @@
return function()
require('neo-tree').setup {
window = {
width = 25;
};
filesystem = {
use_libuv_file_watcher = true;
};

View file

@ -0,0 +1,9 @@
return function()
vim.keymap.set("n", "<leader>o", "<cmd>OutlineOpen<CR><cmd>OutlineFocus<CR>", { desc = "Toggle Outline" })
require("outline").setup {
outline_window = {
width = 20;
relative_width = false;
};
}
end

116
vim/lua/snip.lua Normal file
View file

@ -0,0 +1,116 @@
local snip = {
snippets = {};
ft = {};
}
function snip:new(name, filetype, snippet)
if snippet==nil then
return self:new(name, nil, filetype)
end
if type(snippet) ~= "table" then
snippet = { snippet }
end
if filetype then
if not self.ft[filetype] then
self.ft[filetype] = {snippets = {}}
end
self.ft[filetype].snippets[name] = snippet
else
self.snippets[name] = snippet
end
end
function snip:each(filetype)
return coroutine.wrap(function()
for name, snippet in pairs(snip.snippets) do
coroutine.yield(name, snippet)
end
if filetype and snip.ft[filetype] then
for name, snippet in pairs(snip.ft[filetype].snippets) do
coroutine.yield(name, snippet)
end
end
end)
end
function snip:get(name, filetype)
local snippet = snip.snippets[name]
if filetype and snip.ft[filetype] then
snippet = snip.ft[filetype].snippets[name] or snippet
end
if snippet then
return snippet
end
end
local function complete(lead)
local names = {}
local known = {}
for name, snippet in snip:each(vim.o.filetype) do
if (name:find("^"..lead)) then
if type(snippet)=="string"
or snippet.condition == nil
or snippet.condition() then
if not known[name] then
table.insert(names, name)
end
known[name] = true
end
end
end
table.sort(names)
return names
end
local function process_item(item, lines)
if type(item) == "string" then
for _, line in ipairs(vim.fn.split(item, "\n")) do
table.insert(lines, line)
end
elseif type(item) == "function" then
process_item(item(), lines)
else
error("Unable to handle snippet item of type "..type(item))
end
end
function snip:insert(name)
local snippet = self:get(name, vim.o.filetype)
if not snippet then
print "No snippet with that name"
return
end
local mode = snippet.mode or "l"
local lines = {}
for _, item in ipairs(snippet) do
process_item(item, lines)
end
vim.api.nvim_put(lines, mode, true, true)
end
vim.api.nvim_create_user_command("Snip", function(params)
snip:insert(params.args)
end, {nargs=1, complete=complete})
vim.api.nvim_create_user_command("Snips", function()
local list = {}
for name in snip:each(vim.o.filetype) do
table.insert(list, name)
end
table.sort(list)
print(table.concat(list, ", "))
end, {})
vim.api.nvim_create_user_command("SnipReload", function()
package.loaded.snip = nil
require "snip"
end, {})
return snip

1
vim/plugin/matcha.lua Normal file
View file

@ -0,0 +1 @@
require 'matcha'

View file

@ -118,14 +118,6 @@ abbrev eshrug ¯\_(ツ)_/¯
" === GENERAL UTILITIES ===
" --- TEXT SNIPPETS ---
" -- Global --
if !exists('s:snippets')
let s:snippets = {}
end
" Runs a sequence of commands asynchronously
function! Async(array, ...)
if len(a:array) > 0
@ -137,57 +129,6 @@ function! Async(array, ...)
end
endfun
function! s:make_snippet(name, lines)
let s:snippets[a:name] = a:lines
endfun
function! s:make_snippet_range(name, line_start, line_end)
call s:make_snippet(a:name, getline(a:line_start, a:line_end))
endfun
function! s:insert_snippet(name)
for line in get(s:snippets, a:name, [])
put =line
endfor
endfun
function! MkSnip(name, str)
call s:make_snippet(a:name, split(a:str, '\n'))
endfun
command! -nargs=1 Snippet call s:insert_snippet(<f-args>)
command! -range -nargs=1 MkSnippet call s:make_snippet_range(<f-args>, <line1>, <line2>)
" -- Filetype --
if !exists('s:ft_snippets')
let s:ft_snippets = {}
end
function! s:make_ft_snippet(ft, name, lines)
if !get(s:ft_snippets, a:ft, 0)
let s:ft_snippets[a:ft] = {}
end
let s:ft_snippets[a:ft][a:name] = a:lines
endfun
function! s:make_ft_snippet_range(ft, name, line_start, line_end)
call s:make_ft_snippet(a:ft, a:name, getline(a:line_start, a:line_end))
endfun
function! s:insert_ft_snippet(ft, name)
for line in get(get(s:ft_snippets, a:ft, {}), a:name, [])
put =line
endfor
endfun
function! MkFTSnip(ft, name, str)
call s:make_ft_snippet(a:ft, a:name, split(a:str, '\n'))
endfun
command! -nargs=1 FTSnippet call s:insert_ft_snippet(&filetype, <f-args>)
command! -range -nargs=1 FTMkSnippet call s:make_ft_snippet_range(&filetype, <f-args>, <line1>, <line2>)
function! RangeChooser()
let temp = tempname()

7
vim/plugin/snip.lua Normal file
View file

@ -0,0 +1,7 @@
require "snip"
for _, path in ipairs(vim.api.nvim__get_runtime({"snip/snippets.lua"}, true, {})) do
local code = io.open(path):read("*a")
if code then
dofile(path)
end
end