.
This commit is contained in:
parent
dc6995c0e1
commit
4055fbfe86
16 changed files with 35 additions and 675 deletions
1
files/.config/nix/nix.conf
Normal file
1
files/.config/nix/nix.conf
Normal file
|
|
@ -0,0 +1 @@
|
||||||
|
experimental-features = nix-command flakes
|
||||||
|
|
@ -1,15 +0,0 @@
|
||||||
name: default
|
|
||||||
|
|
||||||
on: [push, pull_request]
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
format:
|
|
||||||
name: Run StyLua
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@v3
|
|
||||||
- uses: JohnnyMorganz/stylua-action@v2
|
|
||||||
with:
|
|
||||||
token: ${{ secrets.GITHUB_TOKEN }}
|
|
||||||
version: 0.17.0
|
|
||||||
args: --check .
|
|
||||||
|
|
@ -1,21 +0,0 @@
|
||||||
MIT License
|
|
||||||
|
|
||||||
Copyright (c) 2017 Konstantin Pospelov
|
|
||||||
|
|
||||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
||||||
of this software and associated documentation files (the "Software"), to deal
|
|
||||||
in the Software without restriction, including without limitation the rights
|
|
||||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
||||||
copies of the Software, and to permit persons to whom the Software is
|
|
||||||
furnished to do so, subject to the following conditions:
|
|
||||||
|
|
||||||
The above copyright notice and this permission notice shall be included in all
|
|
||||||
copies or substantial portions of the Software.
|
|
||||||
|
|
||||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
||||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
||||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
||||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
||||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
||||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
||||||
SOFTWARE.
|
|
||||||
|
|
@ -1,18 +0,0 @@
|
||||||
# vis-ctags
|
|
||||||
|
|
||||||
Basic ctags support for the [vis editor](https://github.com/martanne/vis).
|
|
||||||
|
|
||||||
## Usage
|
|
||||||
|
|
||||||
The plugin should first of all be
|
|
||||||
[enabled](https://github.com/martanne/vis/wiki/Plugins).
|
|
||||||
|
|
||||||
| Action | Shortcut | Command | Exports |
|
|
||||||
| ---------------- | ---------- | ---------------- | ------------------ |
|
|
||||||
| Jump to tag | `Ctrl+]` | `tag <word>` | `actions.tag` |
|
|
||||||
| List tag matches | `g+Ctrl+]` | `tselect <word>` | `actions.tselect` |
|
|
||||||
| Jump back | `Ctrl+T` | `pop` | `actions.pop` |
|
|
||||||
|
|
||||||
There may be some generic or language-specific issues. If you find
|
|
||||||
one, or you have an idea of how to improve something, feel free to
|
|
||||||
send a patch or create a pull request.
|
|
||||||
|
|
@ -1,339 +0,0 @@
|
||||||
require('vis')
|
|
||||||
|
|
||||||
local positions = {}
|
|
||||||
local tags = { 'tags' }
|
|
||||||
local ctags = { actions = {} }
|
|
||||||
|
|
||||||
local function abs_path(prefix, path)
|
|
||||||
if string.find(path, '^/') ~= nil then
|
|
||||||
return path, path
|
|
||||||
end
|
|
||||||
|
|
||||||
if string.find(path, '^./') ~= nil then
|
|
||||||
path = path:sub(3)
|
|
||||||
end
|
|
||||||
|
|
||||||
return prefix .. path, path
|
|
||||||
end
|
|
||||||
|
|
||||||
local function is_directory(path)
|
|
||||||
local dir = io.open(path .. '/', 'r')
|
|
||||||
if dir then
|
|
||||||
dir:close()
|
|
||||||
return true
|
|
||||||
else
|
|
||||||
return false
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
local function find_tags(path)
|
|
||||||
for i = #path, 1, -1 do
|
|
||||||
if path:sub(i, i) == '/' then
|
|
||||||
local prefix = path:sub(1, i)
|
|
||||||
for j = 1, #tags do
|
|
||||||
local tagfile = tags[j]
|
|
||||||
local filename
|
|
||||||
if tagfile:sub(1, 1) == '/' then
|
|
||||||
filename = tagfile
|
|
||||||
else
|
|
||||||
filename = prefix .. tagfile
|
|
||||||
end
|
|
||||||
if not is_directory(filename) then
|
|
||||||
local file = io.open(filename, 'r')
|
|
||||||
|
|
||||||
if file ~= nil then
|
|
||||||
return file, prefix
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
local function bsearch(file, word)
|
|
||||||
local buffer_size = 8096
|
|
||||||
local format = '\n(.-)\t(.-)\t(.-);"\t'
|
|
||||||
|
|
||||||
local from = 0
|
|
||||||
local to = file:seek('end')
|
|
||||||
local startpos = nil
|
|
||||||
|
|
||||||
while from <= to do
|
|
||||||
local mid = from + math.floor((to - from) / 2)
|
|
||||||
file:seek('set', mid)
|
|
||||||
|
|
||||||
local content = file:read(buffer_size, '*line')
|
|
||||||
if content ~= nil then
|
|
||||||
local key, _, _ = string.match(content, format)
|
|
||||||
if key == nil then
|
|
||||||
break
|
|
||||||
end
|
|
||||||
|
|
||||||
if key == word then
|
|
||||||
startpos = mid
|
|
||||||
end
|
|
||||||
|
|
||||||
if key >= word then
|
|
||||||
to = mid - 1
|
|
||||||
else
|
|
||||||
from = mid + 1
|
|
||||||
end
|
|
||||||
else
|
|
||||||
to = mid - 1
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
if startpos ~= nil then
|
|
||||||
file:seek('set', startpos)
|
|
||||||
|
|
||||||
local result = {}
|
|
||||||
while true do
|
|
||||||
local content = file:read(buffer_size, '*line')
|
|
||||||
if content == nil then
|
|
||||||
break
|
|
||||||
end
|
|
||||||
|
|
||||||
for key, filename, excmd in string.gmatch(content, format) do
|
|
||||||
if key == word then
|
|
||||||
result[#result + 1] = { name = filename, excmd = excmd }
|
|
||||||
else
|
|
||||||
return result
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
return result
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
local function get_query()
|
|
||||||
local line = vis.win.selection.line
|
|
||||||
local pos = vis.win.selection.col
|
|
||||||
local str = vis.win.file.lines[line]
|
|
||||||
|
|
||||||
local from, to = 0, 0
|
|
||||||
while pos > to do
|
|
||||||
from, to = str:find('[%a_]+[%a%d_]*', to + 1)
|
|
||||||
if from == nil or from > pos then
|
|
||||||
return nil
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
return string.sub(str, from, to)
|
|
||||||
end
|
|
||||||
|
|
||||||
local function get_matches(word, path)
|
|
||||||
local file, prefix = find_tags(path)
|
|
||||||
|
|
||||||
if file ~= nil then
|
|
||||||
local results = bsearch(file, word)
|
|
||||||
file:close()
|
|
||||||
|
|
||||||
if results ~= nil then
|
|
||||||
local matches = {}
|
|
||||||
for i = 1, #results do
|
|
||||||
local result = results[i]
|
|
||||||
local abspath, name = abs_path(prefix, result.name)
|
|
||||||
local desc = string.format('%s%s', name, tonumber(result.excmd) and ':' .. result.excmd or '')
|
|
||||||
|
|
||||||
matches[#matches + 1] = { desc = desc, path = abspath, excmd = result.excmd }
|
|
||||||
end
|
|
||||||
|
|
||||||
return matches
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
local function get_match(word, path)
|
|
||||||
local matches = get_matches(word, path)
|
|
||||||
if matches ~= nil then
|
|
||||||
for i = 1, #matches do
|
|
||||||
if matches[i].path == path then
|
|
||||||
return matches[i]
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
return matches[1]
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
local function escape(text)
|
|
||||||
return text:gsub('[][)(}{|+?*.]', '\\%0')
|
|
||||||
:gsub('%^', '\\^')
|
|
||||||
:gsub('^/\\%^', '/^')
|
|
||||||
:gsub('%$', '\\$')
|
|
||||||
:gsub('\\%$/$', '$/')
|
|
||||||
:gsub('\\\\%$%$/$', '\\$$')
|
|
||||||
end
|
|
||||||
|
|
||||||
--[[
|
|
||||||
- Can't test vis:command() as it will still return true if the edit command fails.
|
|
||||||
- Can't test File.modified as the edit command can succeed if the current file is
|
|
||||||
modified but open in another window and this behavior is useful.
|
|
||||||
- Instead just check the path again after trying the edit command.
|
|
||||||
]]
|
|
||||||
local function goto_pos(pos, force)
|
|
||||||
if pos.path ~= vis.win.file.path then
|
|
||||||
vis:command(string.format(force and 'e! "%s"' or 'e "%s"', pos.path))
|
|
||||||
if pos.path ~= vis.win.file.path then
|
|
||||||
return false
|
|
||||||
end
|
|
||||||
end
|
|
||||||
if tonumber(pos.excmd) then
|
|
||||||
vis.win.selection:to(pos.excmd, pos.col)
|
|
||||||
else
|
|
||||||
vis.win.selection:to(1, 1)
|
|
||||||
vis:command(escape(pos.excmd))
|
|
||||||
vis.win.selection.pos = vis.win.selection.range.start
|
|
||||||
vis.mode = vis.modes.NORMAL
|
|
||||||
end
|
|
||||||
return true
|
|
||||||
end
|
|
||||||
|
|
||||||
local function goto_tag(path, excmd, force)
|
|
||||||
local old = {
|
|
||||||
path = vis.win.file.path,
|
|
||||||
excmd = vis.win.selection.line,
|
|
||||||
col = vis.win.selection.col,
|
|
||||||
}
|
|
||||||
|
|
||||||
local last_search = vis.registers['/']
|
|
||||||
if goto_pos({ path = path, excmd = excmd, col = 1 }, force) then
|
|
||||||
positions[#positions + 1] = old
|
|
||||||
vis.registers['/'] = last_search
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
local function pop_pos(force)
|
|
||||||
if #positions < 1 then
|
|
||||||
return
|
|
||||||
end
|
|
||||||
if goto_pos(positions[#positions], force) then
|
|
||||||
table.remove(positions, #positions)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
local function win_path()
|
|
||||||
if vis.win.file.path == nil then
|
|
||||||
return os.getenv('PWD') .. '/'
|
|
||||||
end
|
|
||||||
return vis.win.file.path
|
|
||||||
end
|
|
||||||
|
|
||||||
local function tag_cmd(tag, force)
|
|
||||||
local match = get_match(tag, win_path())
|
|
||||||
if match == nil then
|
|
||||||
vis:info(string.format('Tag not found: %s', tag))
|
|
||||||
else
|
|
||||||
goto_tag(match.path, match.excmd, force)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
local function gen_vis_menu(matches)
|
|
||||||
local width = 0
|
|
||||||
for _, match in ipairs(matches) do
|
|
||||||
width = math.max(width, match.desc:len())
|
|
||||||
end
|
|
||||||
-- limit max width of desc field (filename) in menu
|
|
||||||
width = math.min(width, 40)
|
|
||||||
local fmt = '%' .. #tostring(#matches) .. 'd %-' .. width .. 's %s'
|
|
||||||
|
|
||||||
local lines = {}
|
|
||||||
for i, match in ipairs(matches) do
|
|
||||||
local desc = match.desc
|
|
||||||
if desc:len() > width then
|
|
||||||
desc = '...' .. desc:sub(desc:len() - width + 4)
|
|
||||||
end
|
|
||||||
|
|
||||||
-- work around bug displaying tabs in vis-menu and
|
|
||||||
-- provide a clearer context
|
|
||||||
local excmd = match.excmd:gsub('%s+', ' ')
|
|
||||||
excmd = excmd:gsub('^/^', '')
|
|
||||||
excmd = excmd:gsub('$/$', '')
|
|
||||||
table.insert(lines, fmt:format(i, desc, excmd))
|
|
||||||
end
|
|
||||||
|
|
||||||
-- limit vis-menu height to ~1/4 the window height
|
|
||||||
-- +1 gives an empty line at bottom to signify
|
|
||||||
-- that there are no more lines to scroll through
|
|
||||||
local nlines = math.min(math.floor(vis.win.height / 4), #lines)
|
|
||||||
if nlines == #lines then
|
|
||||||
nlines = nlines + 1
|
|
||||||
end
|
|
||||||
return 'vis-menu -l ' .. nlines .. " -p 'Choose tag:' << 'EOF'\n" .. table.concat(lines, '\n') .. '\n' .. 'EOF'
|
|
||||||
end
|
|
||||||
|
|
||||||
local function tselect_cmd(tag, force)
|
|
||||||
local matches = get_matches(tag, win_path())
|
|
||||||
if matches == nil then
|
|
||||||
vis:info(string.format('Tag not found: %s', tag))
|
|
||||||
else
|
|
||||||
local status, output = vis:pipe(vis.win.file, { start = 0, finish = 0 }, gen_vis_menu(matches))
|
|
||||||
|
|
||||||
if status ~= 0 then
|
|
||||||
vis:info('Command failed')
|
|
||||||
return
|
|
||||||
end
|
|
||||||
|
|
||||||
local choice = tonumber(string.match(output, '%d+'))
|
|
||||||
if choice == nil or choice < 1 or choice > #matches then
|
|
||||||
vis:info('Invalid choice')
|
|
||||||
return
|
|
||||||
end
|
|
||||||
goto_tag(matches[choice].path, matches[choice].excmd, force)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
vis:command_register('tag', function(argv, force, win, selection, range)
|
|
||||||
if #argv == 1 then
|
|
||||||
tag_cmd(argv[1], force)
|
|
||||||
end
|
|
||||||
end)
|
|
||||||
|
|
||||||
vis:command_register('tselect', function(argv, force, win, selection, range)
|
|
||||||
if #argv == 1 then
|
|
||||||
tselect_cmd(argv[1], force)
|
|
||||||
end
|
|
||||||
end)
|
|
||||||
|
|
||||||
vis:command_register('pop', function(argv, force, win, selection, range)
|
|
||||||
pop_pos(force)
|
|
||||||
end)
|
|
||||||
|
|
||||||
vis:option_register('tags', 'string', function(value)
|
|
||||||
tags = {}
|
|
||||||
for str in value:gmatch('([^%s]+)') do
|
|
||||||
table.insert(tags, str)
|
|
||||||
end
|
|
||||||
end, 'Paths to search for tags (separated by spaces)')
|
|
||||||
|
|
||||||
ctags.actions.tag = function(keys)
|
|
||||||
local query = get_query()
|
|
||||||
local force = false
|
|
||||||
if query ~= nil then
|
|
||||||
tag_cmd(query, force)
|
|
||||||
end
|
|
||||||
return 0
|
|
||||||
end
|
|
||||||
|
|
||||||
ctags.actions.tselect = function(keys)
|
|
||||||
local query = get_query()
|
|
||||||
local force = false
|
|
||||||
if query ~= nil then
|
|
||||||
tselect_cmd(query, force)
|
|
||||||
end
|
|
||||||
return 0
|
|
||||||
end
|
|
||||||
|
|
||||||
ctags.actions.pop = function(keys)
|
|
||||||
pop_pos()
|
|
||||||
return 0
|
|
||||||
end
|
|
||||||
|
|
||||||
vis:map(vis.modes.NORMAL, '<C-]>', ctags.actions.tag)
|
|
||||||
|
|
||||||
vis:map(vis.modes.NORMAL, 'g<C-]>', ctags.actions.tselect)
|
|
||||||
|
|
||||||
vis:map(vis.modes.NORMAL, '<C-t>', ctags.actions.pop)
|
|
||||||
|
|
||||||
return ctags
|
|
||||||
|
|
@ -1 +0,0 @@
|
||||||
quote_style = "AutoPreferSingle"
|
|
||||||
|
|
@ -1 +0,0 @@
|
||||||
.vscode
|
|
||||||
|
|
@ -1,7 +0,0 @@
|
||||||
{
|
|
||||||
"Lua": {
|
|
||||||
"diagnostics": {
|
|
||||||
"globals": ["vis"]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,21 +0,0 @@
|
||||||
MIT License
|
|
||||||
|
|
||||||
Copyright (c) 2020 Erlend Lind Madsen
|
|
||||||
|
|
||||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
||||||
of this software and associated documentation files (the "Software"), to deal
|
|
||||||
in the Software without restriction, including without limitation the rights
|
|
||||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
||||||
copies of the Software, and to permit persons to whom the Software is
|
|
||||||
furnished to do so, subject to the following conditions:
|
|
||||||
|
|
||||||
The above copyright notice and this permission notice shall be included in all
|
|
||||||
copies or substantial portions of the Software.
|
|
||||||
|
|
||||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
||||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
||||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
||||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
||||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
||||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
||||||
SOFTWARE.
|
|
||||||
|
|
@ -1,20 +0,0 @@
|
||||||
# vis-sneak
|
|
||||||
|
|
||||||
Jump to a location specified by two characters.
|
|
||||||
|
|
||||||
A minimal motion [plugin](https://github.com/martanne/vis/wiki/Plugins) for [vis](https://github.com/martanne/vis) inspired by [vim-sneak](https://github.com/justinmk/vim-sneak).
|
|
||||||
|
|
||||||
## Usage
|
|
||||||
|
|
||||||
Type `s{char}{char}` to move to the next char combo.
|
|
||||||
|
|
||||||
Type `S{char}{char}` to move back.
|
|
||||||
|
|
||||||
Matches are highlighted until you move outside the matches.
|
|
||||||
|
|
||||||
Type `n` or `N` to find the next or prev match, or append a number to the motion.
|
|
||||||
|
|
||||||
|
|
||||||
## Install
|
|
||||||
|
|
||||||
Download and require manually, or add `erf/vis-sneak` using [vis-plug](https://github.com/erf/vis-plug).
|
|
||||||
|
|
@ -1,83 +0,0 @@
|
||||||
local pattern = nil
|
|
||||||
local matches = {}
|
|
||||||
|
|
||||||
-- iterater for doing find in pattern until nil
|
|
||||||
local pattern_iterator = function(content, pattern)
|
|
||||||
local offset = 1
|
|
||||||
return function()
|
|
||||||
local starts, ends = string.find(content, pattern, offset)
|
|
||||||
if starts == nil then return nil end
|
|
||||||
offset = ends + 1
|
|
||||||
return starts, ends
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
-- is cursor pos is in one of the matches?
|
|
||||||
local cursor_on_match = function(win)
|
|
||||||
local pos = win.selection.pos
|
|
||||||
for _, range in ipairs(matches) do
|
|
||||||
if pos >= range.start and pos <= range.finish then
|
|
||||||
return true
|
|
||||||
end
|
|
||||||
end
|
|
||||||
return false
|
|
||||||
end
|
|
||||||
|
|
||||||
-- check if range is in viewport range
|
|
||||||
local range_in_viewport = function(viewport, range)
|
|
||||||
return range.start >= viewport.bytes.start and range.finish <= viewport.bytes.finish
|
|
||||||
end
|
|
||||||
|
|
||||||
-- highlihght current matches
|
|
||||||
local highlight = function(win)
|
|
||||||
|
|
||||||
-- clear matches if cursor is not on a match
|
|
||||||
if not cursor_on_match(win) then
|
|
||||||
matches = {}
|
|
||||||
return
|
|
||||||
end
|
|
||||||
|
|
||||||
-- style matches in viewport
|
|
||||||
for _, range in ipairs(matches) do
|
|
||||||
if range_in_viewport(win.viewport, range) then
|
|
||||||
win:style(win.STYLE_CURSOR, range.start, range.finish)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
-- collect matches (ranges) for pattern in file
|
|
||||||
local collect_matches = function()
|
|
||||||
local file = vis.win.file
|
|
||||||
local content = file:content(0, file.size)
|
|
||||||
matches = {}
|
|
||||||
for starts, ends in pattern_iterator(content, pattern) do
|
|
||||||
table.insert(matches, { start = starts - 1, finish = ends - 1 })
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
-- highlight matches on WIN_HIGHLIGHT
|
|
||||||
vis.events.subscribe(vis.events.WIN_HIGHLIGHT, function(win)
|
|
||||||
highlight(win)
|
|
||||||
end)
|
|
||||||
|
|
||||||
-- create search for two chars and collect matches for highlighting
|
|
||||||
local sneak = function(keys, search_char)
|
|
||||||
if #keys < 2 then
|
|
||||||
pattern = nil
|
|
||||||
return -1
|
|
||||||
end
|
|
||||||
vis:feedkeys(search_char .. keys .. '<Enter>')
|
|
||||||
pattern = keys
|
|
||||||
collect_matches()
|
|
||||||
return 2
|
|
||||||
end
|
|
||||||
|
|
||||||
-- sneak forward on 's'
|
|
||||||
vis:map(vis.modes.NORMAL, 's', function(keys)
|
|
||||||
return sneak(keys, '/')
|
|
||||||
end)
|
|
||||||
|
|
||||||
-- sneak backwards on 'S'
|
|
||||||
vis:map(vis.modes.NORMAL, 'S', function(keys)
|
|
||||||
return sneak(keys, '?')
|
|
||||||
end)
|
|
||||||
|
|
@ -1,49 +0,0 @@
|
||||||
-- vis-minimal-theme (https://github.com/erf/vis-minimal-theme)
|
|
||||||
-- light by Erlend Lind Madsen
|
|
||||||
-- uses a black background and a white foreground
|
|
||||||
|
|
||||||
local black0 = '#000000'
|
|
||||||
local black1 = '#383838'
|
|
||||||
local black2 = '#686868'
|
|
||||||
|
|
||||||
local white0 = '#ffffff'
|
|
||||||
local white1 = '#c8c8c8'
|
|
||||||
local white2 = '#989898'
|
|
||||||
|
|
||||||
local lexers = vis.lexers
|
|
||||||
|
|
||||||
lexers.STYLE_DEFAULT ='back:'..white0..',fore:'..black0
|
|
||||||
lexers.STYLE_NOTHING = 'back:'..white0
|
|
||||||
lexers.STYLE_CLASS = 'fore:'..black0
|
|
||||||
lexers.STYLE_COMMENT = 'fore:'..white2
|
|
||||||
lexers.STYLE_CONSTANT = 'fore:'..black0
|
|
||||||
lexers.STYLE_DEFINITION = 'fore:'..black0
|
|
||||||
lexers.STYLE_ERROR = 'fore:'..black0
|
|
||||||
lexers.STYLE_FUNCTION = 'fore:'..black0
|
|
||||||
lexers.STYLE_KEYWORD = 'fore:'..black2
|
|
||||||
lexers.STYLE_LABEL = 'fore:'..black0
|
|
||||||
lexers.STYLE_NUMBER = 'fore:'..black1
|
|
||||||
lexers.STYLE_OPERATOR = 'fore:'..black0
|
|
||||||
lexers.STYLE_REGEX = 'fore:'..black1
|
|
||||||
lexers.STYLE_STRING = 'fore:'..black1
|
|
||||||
lexers.STYLE_PREPROCESSOR = 'fore:'..black0
|
|
||||||
lexers.STYLE_TAG = 'fore:'..black0
|
|
||||||
lexers.STYLE_TYPE = 'fore:'..black0
|
|
||||||
lexers.STYLE_VARIABLE = 'fore:'..black0
|
|
||||||
lexers.STYLE_WHITESPACE = ''
|
|
||||||
lexers.STYLE_EMBEDDED = 'back:'..white1
|
|
||||||
lexers.STYLE_IDENTIFIER = 'fore:'..black0
|
|
||||||
|
|
||||||
lexers.STYLE_LINENUMBER = 'fore:'..black1
|
|
||||||
lexers.STYLE_LINENUMBER_CURSOR = lexers.STYLE_LINENUMBER
|
|
||||||
lexers.STYLE_CURSOR = 'back:'..white2
|
|
||||||
lexers.STYLE_CURSOR_PRIMARY = lexers.STYLE_CURSOR..',fore:'..black1
|
|
||||||
lexers.STYLE_CURSOR_LINE = 'underlined'
|
|
||||||
lexers.STYLE_COLOR_COLUMN = 'back:'..white1
|
|
||||||
lexers.STYLE_SELECTION = 'back:'..white1
|
|
||||||
lexers.STYLE_STATUS = 'reverse'
|
|
||||||
lexers.STYLE_STATUS_FOCUSED = 'back:'..white1..',fore:'..black1
|
|
||||||
lexers.STYLE_SEPARATOR = lexers.STYLE_DEFAULT
|
|
||||||
lexers.STYLE_INFO = 'fore:default,back:default'
|
|
||||||
lexers.STYLE_EOF = ''
|
|
||||||
|
|
||||||
|
|
@ -1,80 +0,0 @@
|
||||||
-- wryan.lua
|
|
||||||
|
|
||||||
local lexers = vis.lexers
|
|
||||||
local colors = {
|
|
||||||
['bg'] = '#111111',
|
|
||||||
['fg'] = '#999993',
|
|
||||||
['blk'] = '#333333',
|
|
||||||
['bblk'] = '#3d3d3d',
|
|
||||||
['red'] = '#8c4665',
|
|
||||||
['bred'] = '#bf4d80',
|
|
||||||
['grn'] = '#287373',
|
|
||||||
['bgrn'] = '#53a6a6',
|
|
||||||
['ylw'] = '#7c7c99',
|
|
||||||
['bylw'] = '#9e9ecb',
|
|
||||||
['blu'] = '#395573',
|
|
||||||
['bblu'] = '#477ab3',
|
|
||||||
['mag'] = '#5e468c',
|
|
||||||
['bmag'] = '#7e62b3',
|
|
||||||
['cyn'] = '#31658c',
|
|
||||||
['bcyn'] = '#6096bf',
|
|
||||||
['wht'] = '#899ca1',
|
|
||||||
['bwht'] = '#c0c0c0',
|
|
||||||
|
|
||||||
-- special colors
|
|
||||||
['dim1'] = '#191919',
|
|
||||||
['dim2'] = '#262626'
|
|
||||||
}
|
|
||||||
|
|
||||||
-- general styles
|
|
||||||
lexers.STYLE_DEFAULT = 'fore:'..colors.fg..',back:'..colors.bg -- default fg / bg
|
|
||||||
lexers.STYLE_NOTHING = lexers.STYLE_DEFAULT
|
|
||||||
lexers.STYLE_ATTRIBUTE = 'fore:'..colors.bmag -- attribute names, `<img _src_="foo">`
|
|
||||||
lexers.STYLE_CLASS = 'fore:'..colors.mag -- classes, `class _MyClass_`
|
|
||||||
lexers.STYLE_COMMENT = 'fore:'..colors.bblk -- comments, `_/* foo */_`
|
|
||||||
lexers.STYLE_CONSTANT = lexers.STYLE_DEFAULT -- compiler constants &c, `#define _FOO_ 5`
|
|
||||||
lexers.STYLE_DEFINITION = 'fore:'..colors.bblu -- definitions, overlaps with other tokens
|
|
||||||
lexers.STYLE_ERROR = 'fore:'..colors.bg..',back:'..colors.red -- syntax errors
|
|
||||||
lexers.STYLE_FUNCTION = 'fore:'..colors.bblu -- functions, `void _doBar_()`
|
|
||||||
lexers.STYLE_HEADING = 'fore:'..colors.bmag..',bold' -- headings, like in markdown
|
|
||||||
lexers.STYLE_KEYWORD = 'fore:'..colors.bred -- keywords, `_for_ (;;)`
|
|
||||||
lexers.STYLE_LABEL = 'fore:'..colors.red -- goto &c, `_target_:`
|
|
||||||
lexers.STYLE_NUMBER = 'fore:'..colors.bcyn -- number constants
|
|
||||||
lexers.STYLE_OPERATOR = lexers.STYLE_DEFAULT -- operators, `int foo _=_ 0`
|
|
||||||
lexers.STYLE_REGEX = 'fore:'..colors.red -- regular expressions, `"_^\w*$_"`
|
|
||||||
lexers.STYLE_STRING = 'fore:'..colors.bgrn -- strings, `char* baz = _"hello!"_`
|
|
||||||
lexers.STYLE_PREPROCESSOR = 'fore:'..colors.cyn -- preprocessor rules, `_#define_ FOO 5`
|
|
||||||
lexers.STYLE_TAG = 'fore:'..colors.bblk -- tag names, `<_div_ class="foo">`
|
|
||||||
lexers.STYLE_TYPE = 'fore:'..colors.bgrn -- types, `_int_ foo = 0`
|
|
||||||
lexers.STYLE_VARIABLE = lexers.STYLE_DEFAULT -- variable names, `int _foo_ = 0`
|
|
||||||
lexers.STYLE_WHITESPACE = 'fore:'..colors.blk -- whitespaces
|
|
||||||
lexers.STYLE_EMBEDDED = 'back:'..colors.dim1 -- embedded code
|
|
||||||
lexers.STYLE_IDENTIFIER = lexers.STYLE_DEFAULT -- unclassified names
|
|
||||||
|
|
||||||
-- UI styles
|
|
||||||
lexers.STYLE_LINENUMBER = 'fore:'..colors.blk -- inactive line numbers
|
|
||||||
lexers.STYLE_LINENUMBER_CURSOR = 'fore:'..colors.bcyn -- active line numbers
|
|
||||||
lexers.STYLE_CURSOR = 'fore:'..colors.fg..',reverse' -- cursor color
|
|
||||||
lexers.STYLE_CURSOR_PRIMARY = lexers.STYLE_CURSOR
|
|
||||||
lexers.STYLE_CURSOR_LINE = 'back:'..colors.dim1 -- cursor line
|
|
||||||
lexers.STYLE_COLOR_COLUMN = lexers.STYLE_CURSOR_LINE -- color column
|
|
||||||
lexers.STYLE_SELECTION = lexers.STYLE_CURSOR_LINE -- visual selection
|
|
||||||
lexers.STYLE_STATUS = 'fore:'..colors.bblk..',back:'..colors.dim2 -- inactive statusline
|
|
||||||
lexers.STYLE_STATUS_FOCUSED = 'fore:'..colors.fg..',back:'..colors.dim2 -- active statusline
|
|
||||||
lexers.STYLE_SEPARATOR = lexers.STYLE_COMMENT -- vertical split color
|
|
||||||
lexers.STYLE_BRACKETS = 'fore:'..colors.red..',bold' -- matched brackets, e.g [__]__
|
|
||||||
lexers.STYLE_INFO = 'bold' -- messages from `vis:info()`
|
|
||||||
lexers.STYLE_EOF = 'fore:'..colors.dim2 -- the tildes at the end of the buffer
|
|
||||||
|
|
||||||
-- lexer-specific
|
|
||||||
-- TODO add more...
|
|
||||||
|
|
||||||
-- markdown
|
|
||||||
lexers.STYLE_HR = lexers.STYLE_COMMENT
|
|
||||||
for i = 1,6 do lexers['STYLE_HEADING_H'..i] = lexers.STYLE_HEADING end
|
|
||||||
lexers.STYLE_BOLD = 'bold'
|
|
||||||
lexers.STYLE_ITALIC = 'italics'
|
|
||||||
lexers.STYLE_LIST = lexers.STYLE_KEYWORD
|
|
||||||
lexers.STYLE_LINK = lexers.STYLE_KEYWORD
|
|
||||||
lexers.STYLE_REFERENCE = lexers.STYLE_KEYWORD
|
|
||||||
lexers.STYLE_CODE = lexers.STYLE_EMBEDDED
|
|
||||||
|
|
@ -1,6 +1,16 @@
|
||||||
require("vis")
|
require("vis")
|
||||||
require("plugins/vis-ctags")
|
|
||||||
require("plugins/vis-sneak")
|
local plug = (function() if not pcall(require, 'plugins/vis-plug') then
|
||||||
|
os.execute('git clone --quiet https://github.com/erf/vis-plug ' ..
|
||||||
|
(os.getenv('XDG_CONFIG_HOME') or os.getenv('HOME') .. '/.config')
|
||||||
|
.. '/vis/plugins/vis-plug')
|
||||||
|
end return require('plugins/vis-plug') end)()
|
||||||
|
|
||||||
|
local plugins = {
|
||||||
|
{ 'erf/vis-sneak' },
|
||||||
|
{ 'kupospelov/vis-ctags' },
|
||||||
|
}
|
||||||
|
plug.init(plugins, true)
|
||||||
|
|
||||||
vis.events.subscribe(vis.events.INIT, function()
|
vis.events.subscribe(vis.events.INIT, function()
|
||||||
vis:command("set theme kento2")
|
vis:command("set theme kento2")
|
||||||
|
|
|
||||||
11
files/.cwmrc
11
files/.cwmrc
|
|
@ -8,8 +8,8 @@ focusfollowsmouse no
|
||||||
fontname "Iosevka:pixelsize=14:bold"
|
fontname "Iosevka:pixelsize=14:bold"
|
||||||
|
|
||||||
# Appearance
|
# Appearance
|
||||||
borderwidth 3
|
borderwidth 5
|
||||||
color activeborder "#45282c"
|
color activeborder "#845c68"
|
||||||
color inactiveborder "#343335"
|
color inactiveborder "#343335"
|
||||||
color urgencyborder "#cc241d"
|
color urgencyborder "#cc241d"
|
||||||
|
|
||||||
|
|
@ -25,7 +25,7 @@ gap 8 8 8 8
|
||||||
|
|
||||||
# Size of manually tiled Windows in %
|
# Size of manually tiled Windows in %
|
||||||
htile 55
|
htile 55
|
||||||
vtile 0
|
vtile 55
|
||||||
|
|
||||||
# How many pixels a window gets moved by
|
# How many pixels a window gets moved by
|
||||||
moveamount 75
|
moveamount 75
|
||||||
|
|
@ -95,8 +95,8 @@ bind-key 4C-t window-htile
|
||||||
bind-key 4-t window-vtile
|
bind-key 4-t window-vtile
|
||||||
|
|
||||||
# Cycle/reverse cycle through windows
|
# Cycle/reverse cycle through windows
|
||||||
bind-key 4-j window-cycle
|
bind-key M-Tab window-cycle
|
||||||
bind-key 4-k window-rcycle
|
bind-key MS-Tab window-rcycle
|
||||||
|
|
||||||
# Move windows
|
# Move windows
|
||||||
bind-key 4C-h window-move-left
|
bind-key 4C-h window-move-left
|
||||||
|
|
@ -123,6 +123,7 @@ bind-key 4-s screenshot
|
||||||
# Open menus
|
# Open menus
|
||||||
bind-key 4-f menu-window
|
bind-key 4-f menu-window
|
||||||
bind-key 4-d "dmenu_run -nb '#000000' -sb '#353047' -sf '#ffffff'"
|
bind-key 4-d "dmenu_run -nb '#000000' -sb '#353047' -sf '#ffffff'"
|
||||||
|
bind-key 4-s "kfavmenu"
|
||||||
|
|
||||||
# Volume control
|
# Volume control
|
||||||
|
|
||||||
|
|
|
||||||
25
files/.zshrc
25
files/.zshrc
|
|
@ -13,21 +13,10 @@ g() { LC_ALL=C grep --exclude "*~" -r -P ${@:?regexp missing} }
|
||||||
sprunge() { cat $@ | curl -sF 'sprunge=<-' http://sprunge.us }
|
sprunge() { cat $@ | curl -sF 'sprunge=<-' http://sprunge.us }
|
||||||
# minimal functions, 02mar
|
# minimal functions, 02mar
|
||||||
mkcd() { mkdir -p "$1"; cd "$1" }
|
mkcd() { mkdir -p "$1"; cd "$1" }
|
||||||
ops() { a="$(lr -t 'type=f' -t '!mode|1' -A | fzy)" && "$EDITOR" "$a" }
|
|
||||||
|
|
||||||
set -o emacs
|
set -o emacs
|
||||||
|
|
||||||
alias xi='xi -y'
|
|
||||||
alias vi='vis'
|
|
||||||
alias nvi='vis'
|
|
||||||
alias xr='doas xbps-remove -y'
|
|
||||||
alias pc='pass -c'
|
|
||||||
alias pe='pass edit'
|
|
||||||
alias l='ls -l --color'
|
|
||||||
cdpath="$HOME"
|
cdpath="$HOME"
|
||||||
alias nman='man -M /usr/local/netbsd-man'
|
|
||||||
|
|
||||||
mktags() { ctags `lr -t 'name=~".c$"'` }
|
|
||||||
|
|
||||||
# date +hostname+ [battery]
|
# date +hostname+ [battery]
|
||||||
printf '%s +%s+ %s\n' \
|
printf '%s +%s+ %s\n' \
|
||||||
|
|
@ -35,3 +24,17 @@ printf '%s +%s+ %s\n' \
|
||||||
"$((cat /sys/class/power_supply/BAT0/capacity 2>/dev/null && echo %) | tr -d '\n')"
|
"$((cat /sys/class/power_supply/BAT0/capacity 2>/dev/null && echo %) | tr -d '\n')"
|
||||||
|
|
||||||
test -d ~/Downloads && rmdir ~/Downloads
|
test -d ~/Downloads && rmdir ~/Downloads
|
||||||
|
|
||||||
|
kcdp() {
|
||||||
|
name="`lr -A -t 'depth > 3 ? prune : print' -t 'type=d' "$HOME/src" -s | fzy`"
|
||||||
|
cd "$HOME/src/$name"
|
||||||
|
}
|
||||||
|
|
||||||
|
kmktags() { ctags `lr -A -t 'name=~".(ch)$"'` }
|
||||||
|
alias xi='doas xi -y'
|
||||||
|
alias vi='vis'
|
||||||
|
alias xr='doas xbps-remove -y'
|
||||||
|
alias kpc='pass -c'
|
||||||
|
alias kp='pass'
|
||||||
|
alias nman='man -M /usr/local/netbsd-man'
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue