feat: archive electricity

This commit is contained in:
max_richter 2022-04-15 14:52:17 +02:00
parent b5aab4aadb
commit bbdb55ffa4
20 changed files with 376 additions and 302 deletions

View File

@ -10,7 +10,7 @@ _fx(){
case $state in
(action) _arguments '1:profiles:(s i o)' ;;
(*) compadd "$@" $(echo $(ls ~/SYNC) | tr \\n ' ')
(*) compadd "$@" $(echo $(ls ~/Projects) | tr \\n ' ')
esac

View File

@ -7,4 +7,3 @@ fi
compdef _fx fx;
autoload -U compinit
compinit

View File

@ -43,6 +43,11 @@ export EDITOR="nvim"
# Automatically load direnv if found
[[ -s $(which direnv) ]] && eval "$(direnv hook zsh)"
if [ type open &> /dev/null ]; then
else
alias open=xdg-open
fi
# set PATH so it includes user's private bin if it exists
if [ -d "$HOME/bin" ] ; then
PATH="$HOME/bin:$PATH"

View File

@ -68,11 +68,15 @@ if u.has_plugin("cmp") then
g.ale_fixers = {"prettier", "eslint"}
vim.notify = require("notify")
require("command-center-conf")
require("notify").setup(
local notify = require("notify")
vim.notify = notify;
notify.setup(
{
stages = "fade_in_slide_out",
max_width = 50,
render = "minimal",
background_colour = "#000000",
icons = {
@ -91,53 +95,7 @@ if u.has_plugin("cmp") then
set foldlevel=99
]]
require("telescope").setup {
defaults = {
vimgrep_arguments = {
"rg",
"--color=never",
"--no-heading",
"--with-filename",
"--line-number",
"--column",
"--smart-case"
},
prompt_prefix = "",
selection_caret = " ",
entry_prefix = " ",
initial_mode = "insert",
selection_strategy = "reset",
sorting_strategy = "ascending",
layout_strategy = "horizontal",
layout_config = {
horizontal = {
prompt_position = "top",
preview_width = 0.55,
results_width = 0.8
},
vertical = {
mirror = false
},
width = 0.87,
height = 0.80,
preview_cutoff = 120
},
file_sorter = require("telescope.sorters").get_fuzzy_file,
file_ignore_patterns = {"node_modules"},
generic_sorter = require("telescope.sorters").get_generic_fuzzy_sorter,
path_display = {"truncate"},
winblend = 0,
border = {},
borderchars = {"", "", "", "", "", "", "", ""},
color_devicons = true,
use_less = true,
set_env = {["COLORTERM"] = "truecolor"}, -- default = nil,
file_previewer = require("telescope.previewers").vim_buffer_cat.new,
grep_previewer = require("telescope.previewers").vim_buffer_vimgrep.new,
qflist_previewer = require("telescope.previewers").vim_buffer_qflist.new
-- Developer configurations: Not meant for general override
}
}
require("telescope-conf").setup()
-- Enable Theming / Syntax
o.syntax = "enable"
@ -169,40 +127,8 @@ if u.has_plugin("cmp") then
-- Configure nvim-tree
g.nvim_tree_special_files = {}
g.nvim_tree_icons = {
default = "",
symlink = "",
git = {
unstaged = "*",
staged = "",
unmerged = "",
renamed = "",
untracked = "",
deleted = "",
ignored = ""
},
folder = {
arrow_open = ">",
arrow_closed = "<",
default = "",
open = "",
empty = "",
empty_open = "",
symlink = "",
symlink_open = ""
},
lsp = {
hint = "",
info = "",
warning = "",
error = ""
}
}
g.nvim_tree_highlight_opened_files = 1
g.nvim_tree_group_empty = 1
g.nvim_tree_indent_markers = 0
g.nvim_tree_show_icons = {
folder_arrows = 0,
folders = 1,
@ -218,6 +144,11 @@ if u.has_plugin("cmp") then
update_focused_file = {
enable = false
},
renderer = {
indent_markers = {
enable = 0
}
},
diagnostics = {
enable = true,
icons = {

View File

@ -29,6 +29,6 @@ augroup END
vim.api.nvim_create_autocmd("BufWritePre",{
callback = function()
vim.lsp.buf.formatting_sync();
vim.lsp.buf.formatting_sync();
end
})

View File

@ -0,0 +1,31 @@
local command_center = require("command_center")
local noremap = {noremap = true}
command_center.add({
{
description = "Search inside current buffer",
command = "Telescope current_buffer_fuzzy_find",
keybindings = { "n", "<leader>fl", noremap },
}, {
-- If no descirption is specified, command is used to replace descirption by default
-- You can change this behavior in settigns
command = "Telescope find_files",
},
{
-- If no keybindings specified, no keybindings will be displayed or registered
description = "Find hidden files",
command = "Telescope find_files hidden=true",
},
{
-- You can specify multiple keybindings for the same command ...
description = "Show document symbols",
command = "Telescope lsp_document_symbols",
},
{
description = "Show function signaure (hover)",
command = "lua vim.lsp.buf.hover()",
},{
description="(TS) Organize Imports",
command = "OrganizeImports"
}
})

View File

@ -9,6 +9,7 @@ g.mapleader = " "
map("n", "<C-o>", ":Telescope find_files<CR>", options)
map("n", "<C-f>", ":Telescope live_grep<CR>", options)
map("n","<C-p>",":Telescope command_center<CR>",options)
map("n", "<Shift>", "za", options)
-- LSP Functionality
@ -30,6 +31,7 @@ map("n", "<C-h>", "<C-w>h", options)
map("n", "<C-j>", "<C-w>j", options)
map("n", "<C-k>", "<C-w>k", options)
map("n", "<C-l>", "<C-w>l", options)
-- Browser like next/previous
map("n", "<A-Left>", ":bprevious<CR>",options);
map("n", "<A-Right>", ":bnext<CR>",options);

View File

@ -0,0 +1,85 @@
local lorem = {}
local WORDS_IN_SENTENCE = {min = 5, max = 15}
local SENTENCES_IN_PARAGRAPH = {min = 2, max = 7 }
local PARAGRAPHS_IN_TEXT = {min = 2, max = 7 }
local function random_int(min, max)
return math.random(min, max)
end
local BASE_PHRASE = [[
Lorem ipsum dolor sit amet, consectetur adipiscing elit.
Suspendisse rutrum accumsan elit vel auctor.
Praesent sit amet aliquam turpis.
Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae.
Maecenas non erat ut elit sodales commodo.
Nam gravida ipsum quis nulla tempus, quis pulvinar augue tristique.
Nulla massa odio, imperdiet non ultricies tincidunt, viverra sed lorem.
Nulla elementum sapien ut commodo aliquet.
Pellentesque iaculis turpis tellus, eget laoreet augue condimentum vel.
Quisque at risus rhoncus, facilisis tellus nec, tristique dolor.
Maecenas cursus magna eget imperdiet laoreet.
]]
local function get_words(phrase)
local list = {}
for word in phrase:gmatch('%a+') do
table.insert(list, word:lower())
end
return list
end
lorem.__index = lorem
lorem._dict = get_words(BASE_PHRASE)
function lorem:generator(phrase)
if type(phrase) ~= 'string' then
error('First argument of lorem.generator should be a string', 2)
end
local g = {_dict = {}}
for word in phrase:gmatch('%a+') do
table.insert(g._dict, word:lower())
end
if #(g._dict) == 0 then
error('String argument of lorem.generator should contain words', 2)
end
setmetatable(g, self)
return g
end
function lorem:word()
return self._dict[random_int(1, #(self._dict))]
end
function lorem:sentence()
local n = random_int(WORDS_IN_SENTENCE.min, WORDS_IN_SENTENCE.max)
local words = {}
for i = 1, n do
words[i] = self:word()
end
local s = table.concat(words, ' ')
s = s .. "."
s = s:sub(1, 1):upper() .. s:sub(2)
return s
end
function lorem:paragraph()
local n = random_int(SENTENCES_IN_PARAGRAPH.min, SENTENCES_IN_PARAGRAPH.max)
local sentences = {}
for i = 1, n do
sentences[i] = self:sentence()
end
return table.concat(sentences, ' ')
end
function lorem:text()
local n = random_int(PARAGRAPHS_IN_TEXT.min, PARAGRAPHS_IN_TEXT.max)
local paragraphs = {}
for i = 1, n do
paragraphs[i] = self:paragraph()
end
return table.concat(paragraphs, '\n')
end
return lorem

View File

@ -2,6 +2,52 @@ local lsp = require "lspconfig"
local lsp_status = require("lsp-status")
local ts_utils = require("nvim-lsp-ts-utils")
require'nvim-lightbulb'.setup {
-- LSP client names to ignore
-- Example: {"sumneko_lua", "null-ls"}
ignore = {},
sign = {
enabled = true,
-- Priority of the gutter sign
priority = 10,
},
float = {
enabled = false,
-- Text to show in the popup float
text = "💡",
-- Available keys for window options:
-- - height of floating window
-- - width of floating window
-- - wrap_at character to wrap at for computing height
-- - max_width maximal width of floating window
-- - max_height maximal height of floating window
-- - pad_left number of columns to pad contents at left
-- - pad_right number of columns to pad contents at right
-- - pad_top number of lines to pad contents at top
-- - pad_bottom number of lines to pad contents at bottom
-- - offset_x x-axis offset of the floating window
-- - offset_y y-axis offset of the floating window
-- - anchor corner of float to place at the cursor (NW, NE, SW, SE)
-- - winblend transparency of the window (0-100)
win_opts = {},
},
virtual_text = {
enabled = false,
-- Text to show at virtual text
text = "💡",
-- highlight mode to use for virtual text (replace, combine, blend), see :help nvim_buf_set_extmark() for reference
hl_mode = "replace",
},
status_text = {
enabled = false,
-- Text to provide when code actions are available
text = "💡",
-- Text to provide when no actions are available
text_unavailable = ""
}
}
local runtime_path = vim.split(package.path, ";")
table.insert(runtime_path, "lua/?.lua")
table.insert(runtime_path, "lua/?/init.lua")
@ -34,167 +80,3 @@ lsp.sumneko_lua.setup {
-- Ltex Language Server
require("grammar-guard").init()
-- setup LSP config
lsp.grammar_guard.setup(
{
cmd = {vim.fn.expand("~/.local/share/nvim/lsp_servers/ltex/ltex-ls/bin/ltex-ls")},
settings = {
ltex = {
enabled = {"latex", "tex", "bib", "markdown"},
language = "de",
diagnosticSeverity = "information",
additionalRules = {
enablePickyRules = true,
motherTongue = "de"
},
dictionary = {},
disabledRules = {},
hiddenFalsePositives = {}
}
}
}
)
-- Typescript Language Server
lsp.tsserver.setup(
{
-- Needed for inlayHints. Merge this table with your settings or copy
-- it from the source if you want to add your own init_options.
init_options = require("nvim-lsp-ts-utils").init_options,
--
on_attach = function(client, bufnr)
-- defaults
ts_utils.setup(
{
debug = true,
disable_commands = false,
enable_import_on_completion = false,
-- import all
import_all_timeout = 5000, -- ms
-- lower numbers = higher priority
import_all_priorities = {
same_file = 1, -- add to existing import statement
local_files = 2, -- git files or files with relative path markers
buffer_content = 3, -- loaded buffer content
buffers = 4 -- loaded buffer names
},
import_all_scan_buffers = 100,
import_all_select_source = false,
-- if false will avoid organizing imports
always_organize_imports = true,
-- filter diagnostics
filter_out_diagnostics_by_severity = {},
filter_out_diagnostics_by_code = {},
-- inlay hints
auto_inlay_hints = true,
inlay_hints_highlight = "Comment",
inlay_hints_priority = 200, -- priority of the hint extmarks
inlay_hints_throttle = 150, -- throttle the inlay hint request
inlay_hints_format = {
-- format options for individual hint kind
Type = {},
Parameter = {},
Enum = {}
-- Example format customization for `Type` kind:
-- Type = {
-- highlight = "Comment",
-- text = function(text)
-- return "->" .. text:sub(2)
-- end,
-- },
},
-- update imports on file move
update_imports_on_move = false,
require_confirmation_on_move = false,
watch_dir = nil
}
)
-- required to fix code action ranges and filter diagnostics
ts_utils.setup_client(client)
-- no default maps, so you may want to define some here
local opts = {silent = true}
vim.api.nvim_buf_set_keymap(bufnr, "n", "gs", ":TSLspOrganize<CR>", opts)
vim.api.nvim_buf_set_keymap(bufnr, "n", "gr", ":TSLspRenameFile<CR>", opts)
vim.api.nvim_buf_set_keymap(bufnr, "n", "gi", ":TSLspImportAll<CR>", opts)
end
}
)
-- Setup diagnostics formaters and linters for non LSP provided files
lsp.diagnosticls.setup {
capabilities = lsp_status.capabilities,
cmd = {"diagnostic-languageserver", "--stdio"},
filetypes = {
"sh",
"markdown",
"yaml",
"toml"
},
init_options = {
linters = {
shellcheck = {
command = "shellcheck",
debounce = 100,
args = {"--format", "json", "-"},
sourceName = "shellcheck",
parseJson = {
line = "line",
column = "column",
endLine = "endLine",
endColumn = "endColumn",
message = "${message} [${code}]",
security = "level"
},
securities = {
error = "error",
warning = "warning",
info = "info",
style = "hint"
}
},
markdownlint = {
command = "markdownlint",
isStderr = true,
debounce = 100,
args = {"--stdin"},
offsetLine = 0,
offsetColumn = 0,
sourceName = "markdownlint",
formatLines = 1,
formatPattern = {
"^.*?:\\s?(\\d+)(:(\\d+)?)?\\s(MD\\d{3}\\/[A-Za-z0-9-/]+)\\s(.*)$",
{
line = 1,
column = 3,
message = {4}
}
}
}
},
filetypes = {
sh = "shellcheck",
markdown = "markdownlint"
},
formatters = {
shfmt = {
command = "shfmt",
args = {"-i", "2", "-bn", "-ci", "-sr"}
},
prettier = {
command = "prettier",
args = {"--stdin-filepath", "%filepath"}
}
},
formatFiletypes = {
sh = "shfmt",
json = "prettier",
yaml = "prettier",
toml = "prettier",
markdown = "prettier",
lua = "prettier"
}
}
}

View File

@ -1,13 +1,32 @@
local lsp_installer = require("nvim-lsp-installer")
require("lsp-format").setup {}
local lsp_format = require("lsp-format");
lsp_format.setup {}
local function organize_imports()
local params = {
command = "_typescript.organizeImports",
arguments = {vim.api.nvim_buf_get_name(0)},
title = ""
}
vim.lsp.buf.execute_command(params)
end
lsp_installer.on_server_ready(
function(server)
local opts = {
on_attach = require "lsp-format".on_attach
on_attach = lsp_format.on_attach
}
if server.name == "tsserver" then
opts.commands = {
OrganizeImports = {
organize_imports,
description = "Organize Imports"
}
}
end
-- This setup() function is exactly the same as lspconfig's setup function (:help lspconfig-quickstart)
server:setup(opts)

View File

@ -1,5 +1,5 @@
return require("packer").startup(
function()
function(use)
-- Let packer manage itself
use "wbthomason/packer.nvim"
@ -31,6 +31,7 @@ return require("packer").startup(
use "nathanmsmith/nvim-ale-diagnostic"
use "junegunn/fzf"
use "nvim-telescope/telescope.nvim"
use "gfeiyou/command-center.nvim"
-- Postman like features
use "NTBBloodbath/rest.nvim"
@ -42,6 +43,7 @@ return require("packer").startup(
-- Lsp Errors
use "folke/lsp-colors.nvim"
use "kosayoda/nvim-lightbulb"
use "onsails/lspkind-nvim"
use {
"folke/trouble.nvim",

View File

@ -11,7 +11,7 @@ local d = ls.dynamic_node
local types = require("luasnip.util.types")
require("luasnip.loaders.from_vscode").load({include = {"typescript", "javascript", "html"}}) -- Load only python snippets
require("luasnip.loaders.from_vscode").load({include = {"typescript", "javascript", "html"}})
-- Every unspecified option will be set to the default.
ls.config.set_config(
@ -34,16 +34,32 @@ ls.config.set_config(
}
)
ls.snippets = {
all = {},
svelte = {
s(
"slt",
{
t('<script lang="ts">'),
i(0),
t("</script>")
}
)
}
}
ls.add_snippets("all", {
s({trig = "b(%d)", regTrig = true, wordTrig = true}, {
f(function(args) return {"Captured Text: " .. args[1].captures[1] .. "."} end, {}),
i(0)
})
})
ls.add_snippets("svelte",{
s("slt",{
t('<script lang="ts">','\t'),
i(0),
t("</script>")
}),
s("sc",{
t('<script context="module" lang="ts">','\t'),
i(0),
t("</script>")
})
})
ls.add_snippets("typescript",{
s("sget",{
t('export async function get({'),
i(1,"params"),
t("}) {"),
i(2),
t("}"),
})
})

View File

@ -1,8 +1,4 @@
local present, telescope = pcall(require, "telescope")
if not present then
return
end
local telescope = require("telescope")
local default = {
defaults = {
@ -56,16 +52,8 @@ local default = {
local M = {}
M.setup = function()
telescope.setup(default)
local extensions = {"themes", "terms"}
pcall(
function()
for _, ext in ipairs(extensions) do
-- telescope.load_extension(ext)
end
end
)
-- telescope.load_extension("themes");
telescope.load_extension("command_center");
end
return M

View File

@ -26,16 +26,16 @@ set $quickmenu wofi --show drun
# Screenshot section
set $screenshot_dir ~/Pictures/Screenshots/
set $grimshot ~/.config/sway/grimshot.sh
set $screenclip wl-copy < "$($grimshot --notify save area $screenshot_dir/scrn-$(date +"%Y-%m-%d-%H-%M-%S").png)"
set $screenclip wl-copy < "$($grimshot --notify save area $screenshot_dir/scrn-$(date +"%Y-%m-%d-%H-%M-%S").png)"
set $screenshot wl-copy < "$($grimshot --notify save screen $screenshot_dir/scrn-$(date +"%Y-%m-%d-%H-%M-%S").png)"
set $windowshot wl-copy < "$($grimshot --notify save window $screenshot_dir/scrn-$(date +"%Y-%m-%d-%H-%M-%S").png)"
# Default Programs
set $term kitty -e "tmux"
set $explorer nautilus
set $mail geary
set $browser firefox-developer-edition
set $mail org.gnome.Geary
set $browser google-chrome-beta --enable-features=UseOzonePlatform --ozone-platform=wayland
set $browser firefox-developer-edition
set $password_mngr rofi-rbw --selector wofi --typer wtype --clipboarder wl-copy
set $bluetooth_mngr blueman-manager
set $calculator flatpak run io.github.Qalculate

View File

@ -4,25 +4,24 @@ $@ &
pid=$!
# ALL_NODES='recurse(.nodes[]?, .floating_nodes[]?) | select(.pid and .visible)'
ALL_NODES='recurse(.nodes[]?, .floating_nodes[]?) | select(.pid and .visible)'
# echo "pid: $pid"
# all_nodes="$(swaymsg -t get_tree | jq -r "$ALL_NODES")"
# window_id="$(swaymsg -t get_tree | jq -r "$ALL_NODES" | jq -c ". | select(.pid==$pid) | .id")"
sleep 0.3
# echo "al: $all_nodes"
# echo "window_id: $window_id"
all_nodes="$(swaymsg -t get_tree | jq -r "$ALL_NODES" | jq -c '.pid')"
window_id="$(swaymsg -t get_tree | jq -r "$ALL_NODES" | jq --argjson pid $pid -c 'select(.pid==$pid).id')"
swaymsg "[ con_id=$window_id ] floating enable, resize set 800 400, move position 1115 670, sticky enable"
swaymsg -t subscribe -m '[ "window" ]' \
| jq --unbuffered --argjson pid "$pid" '.container | select(.pid == $pid) | .id' \
| xargs -I '@' -- swaymsg '[ con_id=@ ] floating enable' &
# swaymsg -t subscribe -m '[ "window" ]' \
# | jq --unbuffered --argjson pid "$pid" '.container | select(.pid == $pid) | .id' \
# | xargs -I '@' -- swaymsg '[ con_id=@ ] floating enable' &
subscription=$!
# subscription=$!
echo Going into wait state
# echo Going into wait state
# Wait for our process to close
tail --pid=$pid -f /dev/null
# # Wait for our process to close
# tail --pid=$pid -f /dev/null
echo Killing subscription
kill $subscription
# echo Killing subscription
# kill $subscription

114
configs/sway/test.json Normal file
View File

@ -0,0 +1,114 @@
{
"id": 65,
"type": "con",
"orientation": "none",
"percent": 0.3422431865828092,
"urgent": false,
"marks": [],
"focused": false,
"layout": "none",
"border": "none",
"current_border_width": 2,
"rect": {
"x": 6,
"y": 46,
"width": 653,
"height": 1028
},
"deco_rect": {
"x": 0,
"y": 0,
"width": 0,
"height": 0
},
"window_rect": {
"x": 0,
"y": 0,
"width": 653,
"height": 1028
},
"geometry": {
"x": 0,
"y": 0,
"width": 960,
"height": 810
},
"name": "Notes - Obsidian v0.14.5",
"window": 4194307,
"nodes": [],
"floating_nodes": [],
"focus": [],
"fullscreen_mode": 0,
"sticky": false,
"pid": 602930,
"app_id": null,
"visible": true,
"max_render_time": 0,
"shell": "xwayland",
"inhibit_idle": false,
"idle_inhibitors": {
"user": "none",
"application": "none"
},
"window_properties": {
"class": "obsidian",
"instance": "obsidian",
"title": "Notes - Obsidian v0.14.5",
"transient_for": null,
"window_role": "browser-window",
"window_type": "normal"
}
}
{
"id": 67,
"type": "con",
"orientation": "none",
"percent": 0.6561844863731656,
"urgent": false,
"marks": [],
"focused": true,
"layout": "none",
"border": "none",
"current_border_width": 2,
"rect": {
"x": 662,
"y": 46,
"width": 1252,
"height": 1028
},
"deco_rect": {
"x": 0,
"y": 0,
"width": 0,
"height": 0
},
"window_rect": {
"x": 0,
"y": 0,
"width": 1252,
"height": 1028
},
"geometry": {
"x": 0,
"y": 0,
"width": 612,
"height": 439
},
"name": "tmux",
"window": null,
"nodes": [],
"floating_nodes": [],
"focus": [],
"fullscreen_mode": 0,
"sticky": false,
"pid": 603417,
"app_id": "kitty",
"visible": true,
"max_render_time": 0,
"shell": "xdg_shell",
"inhibit_idle": false,
"idle_inhibitors": {
"user": "none",
"application": "none"
}
}

0
configs/sway/wl-copy Normal file
View File

View File

@ -1,5 +1,5 @@
#!/bin/bash
open "http://localhost:$(sed '1,/^### DATA ###$/d' $0 | wofi --show dmenu -i | cut -d ' ' -f 1 | tr -d '\n')"
xdg-open "http://localhost:$(sed '1,/^### DATA ###$/d' $0 | wofi --show dmenu -i | cut -d ' ' -f 1 | tr -d '\n')"
exit
### DATA ###
8000

View File

@ -18,13 +18,13 @@
# Script:
searx="https://searx.tiekoetter.com/search?language=en&time_range=None&safesearch=0&categories=general&q="
searx="https://xzx.ro/search?q="
startpage="https://www.startpage.com/sp/search?q="
query=$( wofi -d -p "Search: " -W 600 -H 100 -k ~/.cache/wofi-web)
if [[ -n "$query" ]]; then
url="$startpage$query"
url="$searx$query"
xdg-open "$url"
else
exit

View File

@ -1 +1,2 @@
set selection-clipboard clipboard
set guioptions hcsv