Update scripts, Emacs, and Neovim config

This commit is contained in:
Gabriel Arazas 2021-10-14 17:46:19 +08:00
parent c4d4abc7a6
commit fb0a118741
5 changed files with 107 additions and 111 deletions

View File

@ -12,5 +12,5 @@
set -o pipefail set -o pipefail
notify-send "Select a region for the barcode (QR codes, ISBN, bar codes)" notify-send "Select a region for the barcode (QR codes, ISBN, bar codes)"
maim --select --hidecursor | zbarimg - --quiet | perl -pe 's|(.+?):||' maim --select --hidecursor --quiet | zbarimg - --quiet --oneshot --raw | xclip -selection clipboard

View File

@ -249,9 +249,9 @@ proc main {
# We'll also fill up the rest of the chapter-related data into the output data. # We'll also fill up the rest of the chapter-related data into the output data.
for index in @(seq $[chapter_len]) { for index in @(seq $[chapter_len]) {
var index = Int(index) var index = Int(index)
var chapter = output_data['chapters'][index - 1] setvar chapter = output_data['chapters'][index - 1]
var start = chapter['timestamp'] var start = chapter['timestamp']
var end = output_data['chapters'][index]['timestamp'] if index != chapter_len else null var end = output_data['chapters'][index]['timestamp'] if index !== chapter_len else null
var filename = $(printf "%.2d-%s.%s" $index $(kebab-case ${chapter['title']}) $EXTENSION) var filename = $(printf "%.2d-%s.%s" $index $(kebab-case ${chapter['title']}) $EXTENSION)
setvar output_data['chapters'][index - 1]['file'] = filename setvar output_data['chapters'][index - 1]['file'] = filename
@ -262,7 +262,7 @@ proc main {
setvar has_error = true setvar has_error = true
} }
append :job_queue ">&2 printf '[%d/%d] %s\\n' $[index] $[chapter_len] \"$[output_data['chapters'][index - 1]['title']]\"; ffmpeg -loglevel quiet -nostdin -i '${audio_file}' -ss ${start} $['-to ' + end if index != chapter_len else ''] ${title_slug}/${filename}" append :job_queue ">&2 printf '[%d/%d] %s\\n' $[index] $[chapter_len] \"$[output_data['chapters'][index - 1]['title']]\"; ffmpeg -loglevel quiet -nostdin -i '${audio_file}' -ss ${start} $['-to ' + end if index !== chapter_len else ''] ${title_slug}/${filename}"
} }
# Exit the process if an error detected. # Exit the process if an error detected.

View File

@ -1,6 +1,6 @@
#+title: tools/wiki #+title: tools/wiki
#+date: "2021-05-05 00:27:26 +08:00" #+date: 2021-05-05 00:27:26 +08:00
#+date_modified: "2021-05-21 11:12:10 +08:00" #+date_modified: 2021-05-21 11:12:10 +08:00
#+language: en #+language: en
@ -40,4 +40,3 @@ This module has a handful of requirements to work properly.
- SQLite v3 binary is installed in order for org-roam to work. - SQLite v3 binary is installed in order for org-roam to work.
- The ~+anki~ feature requires Anki and the setup described from the [[https://github.com/louietan/anki-editor][project README]]. - The ~+anki~ feature requires Anki and the setup described from the [[https://github.com/louietan/anki-editor][project README]].
- ~+graph~ feature needs [[https://github.com/briandowns/simple-httpd][simple-httpd]] for the server to work.

View File

@ -21,7 +21,7 @@
:hook (org-load . org-roam-mode) :hook (org-load . org-roam-mode)
:commands :commands
(org-roam-buffer (org-roam-buffer
org-roam-setup org-roam-db-autosync-mode
org-roam-capture org-roam-capture
org-roam-node-find) org-roam-node-find)
:preface :preface
@ -36,8 +36,6 @@
:desc "Go to a random node and split" "R" #'+org-roam-split-to-random-node :desc "Go to a random node and split" "R" #'+org-roam-split-to-random-node
:desc "Find node" "f" #'org-roam-node-find :desc "Find node" "f" #'org-roam-node-find
:desc "Org Roam capture" "c" #'org-roam-capture :desc "Org Roam capture" "c" #'org-roam-capture
:desc "Org Roam setup" "s" #'org-roam-setup
:desc "Org Roam teardown" "S" #'org-roam-teardown
:desc "Open backlinks buffer" "b" #'org-roam-buffer-toggle :desc "Open backlinks buffer" "b" #'org-roam-buffer-toggle
(:prefix ("d" . "dailies") (:prefix ("d" . "dailies")

View File

@ -22,8 +22,8 @@ end
cmd [[packadd packer.nvim]] cmd [[packadd packer.nvim]]
-- Plugins -- Plugins
require("packer").startup(function() require("packer").startup(function()
-- Let the package manager manage itself. -- Let the package manager manage itself.
use { "wbthomason/packer.nvim", opt = true } use { "wbthomason/packer.nvim", opt = true }
-- THEMES! -- THEMES!
use { "chriskempson/base16-vim" } use { "chriskempson/base16-vim" }
@ -31,11 +31,11 @@ require("packer").startup(function()
-- Custom color themes! -- Custom color themes!
use { "rktjmp/lush.nvim" } use { "rktjmp/lush.nvim" }
-- EditorConfig plugin -- EditorConfig plugin
use { "editorconfig/editorconfig-vim" } use { "editorconfig/editorconfig-vim" }
-- Colorize common color strings -- Colorize common color strings
use { use {
"norcalli/nvim-colorizer.lua", "norcalli/nvim-colorizer.lua",
config = function() config = function()
require"colorizer".setup() require"colorizer".setup()
@ -46,21 +46,21 @@ require("packer").startup(function()
-- Our custom theme -- Our custom theme
use { "~/.config/nvim/lua/lush_theme/fds-theme.lua" } use { "~/.config/nvim/lua/lush_theme/fds-theme.lua" }
-- A snippets engine. -- A snippets engine.
-- One of the must-haves for me. -- One of the must-haves for me.
use { use {
"sirver/ultisnips", "sirver/ultisnips",
config = function() config = function()
vim.g.UltiSnipsEditSplit = "context" vim.g.UltiSnipsEditSplit = "context"
vim.g.UltiSnipsSnippetDirectories = {vim.env.HOME .. "/.config/nvim/own-snippets", ".snippets"} vim.g.UltiSnipsSnippetDirectories = {vim.env.HOME .. "/.config/nvim/own-snippets", ".snippets"}
end, end,
-- Contains various snippets for UltiSnips. -- Contains various snippets for UltiSnips.
requires = "honza/vim-snippets" requires = "honza/vim-snippets"
} }
-- Text editor integration for the browser -- Text editor integration for the browser
use {"subnut/nvim-ghost.nvim", run = ":call nvim_ghost#installer#install()"} use {"subnut/nvim-ghost.nvim", run = ":call nvim_ghost#installer#install()"}
-- Fuzzy finder of lists -- Fuzzy finder of lists
use { use {
@ -68,7 +68,7 @@ require("packer").startup(function()
requires = { {"nvim-lua/popup.nvim"}, {"nvim-lua/plenary.nvim"} } requires = { {"nvim-lua/popup.nvim"}, {"nvim-lua/plenary.nvim"} }
} }
-- A completion engine. -- A completion engine.
-- nvim-cmp is mostly explicit by making the configuration process manual unlike bigger plugins like CoC -- nvim-cmp is mostly explicit by making the configuration process manual unlike bigger plugins like CoC
use { use {
"hrsh7th/nvim-cmp", "hrsh7th/nvim-cmp",
@ -107,109 +107,108 @@ require("packer").startup(function()
mapping = { mapping = {
["<C-Space>"] = cmp.mapping(function(fallback) ["<C-Space>"] = cmp.mapping(function(fallback)
if fn.pumvisible() == 1 then if cmp.visible() then
if fn["UltiSnips#CanExpandSnippet"]() == 1 then if fn["UltiSnips#CanExpandSnippet"]() == 1 then
return fn.feedkeys(t("<C-R>=UltiSnips#ExpandSnippet()<CR>")) return fn.feedkeys(t("<C-R>=UltiSnips#ExpandSnippet()<CR>"))
end end
fn.feedkeys(t("<C-n>"), "n") cmp.select_next_item()
elseif check_back_space() then elseif check_back_space() then
fn.feedkeys(t("<cr>"), "n") fn.feedkeys(t("<cr>"), "n")
else else
fallback() fallback()
end end
end, {
"i",
"s",
}),
["<Tab>"] = cmp.mapping(function(fallback)
if fn.complete_info()["selected"] == -1 and fn["UltiSnips#CanExpandSnippet"]() == 1 then
fn.feedkeys(t("<C-R>=UltiSnips#ExpandSnippet()<CR>"))
elseif fn["UltiSnips#CanJumpForwards"]() == 1 then
fn.feedkeys(t("<ESC>:call UltiSnips#JumpForwards()<CR>"))
elseif fn.pumvisible() == 1 then
fn.feedkeys(t("<C-n>"), "n")
elseif check_back_space() then
fn.feedkeys(t("<tab>"), "n")
else
fallback()
end
end, { end, {
"i", "i",
"s", "s",
}), }),
["<S-Tab>"] = cmp.mapping(function(fallback) ["<Tab>"] = cmp.mapping(function(fallback)
if fn["UltiSnips#CanJumpBackwards"]() == 1 then if fn.complete_info()["selected"] == -1 and fn["UltiSnips#CanExpandSnippet"]() == 1 then
return fn.feedkeys(t("<C-R>=UltiSnips#JumpBackwards()<CR>")) fn.feedkeys(t("<C-R>=UltiSnips#ExpandSnippet()<CR>"))
elseif fn.pumvisible() == 1 then elseif fn["UltiSnips#CanJumpForwards"]() == 1 then
fn.feedkeys(t("<C-p>"), "n") fn.feedkeys(t("<ESC>:call UltiSnips#JumpForwards()<CR>"))
else elseif cmp.visible() then
fallback() cmp.select_next_item()
end elseif check_back_space() then
end, { fn.feedkeys(t("<tab>"), "n")
"i", else
"s", fallback()
}), end
} end, {
}) "i",
end "s",
}),
["<S-Tab>"] = cmp.mapping(function(fallback)
if fn["UltiSnips#CanJumpBackwards"]() == 1 then
return fn.feedkeys(t("<C-R>=UltiSnips#JumpBackwards()<CR>"))
elseif cmp.visible() then
cmp.select_previous_item()
else
fallback()
end
end, {
"i",
"s",
}),
}})
end
} }
-- A linting engine, a DAP client, and an LSP client entered into a bar. -- A linting engine, a DAP client, and an LSP client entered into a bar.
use { "dense-analysis/ale" } use { "dense-analysis/ale" }
use { "neovim/nvim-lspconfig" } use { "neovim/nvim-lspconfig" }
use { "mfussenegger/nvim-dap" } use { "mfussenegger/nvim-dap" }
-- One of the most popular plugins. -- One of the most popular plugins.
-- Allows to create more substantial status bars. -- Allows to create more substantial status bars.
use { "vim-airline/vim-airline" } use { "vim-airline/vim-airline" }
-- Fuzzy finder for finding files freely and fastly. -- Fuzzy finder for finding files freely and fastly.
use { use {
"junegunn/fzf", "junegunn/fzf",
requires = "junegunn/fzf.vim" requires = "junegunn/fzf.vim"
} }
-- A full LaTeX toolchain plugin for Vim. -- A full LaTeX toolchain plugin for Vim.
-- Also a must-have for me since writing LaTeX can be a PITA. -- Also a must-have for me since writing LaTeX can be a PITA.
-- Most of the snippets and workflow is inspired from Gilles Castel's posts (at https://castel.dev/). -- Most of the snippets and workflow is inspired from Gilles Castel's posts (at https://castel.dev/).
use { use {
"lervag/vimtex", "lervag/vimtex",
cmd = "ALEEnable", cmd = "ALEEnable",
config = function() config = function()
-- Vimtex configuration -- Vimtex configuration
g["tex_flavor"] = "latex" g["tex_flavor"] = "latex"
g["vimtex_view_method"] = "zathura" g["vimtex_view_method"] = "zathura"
g["vimtex_quickfix_mode"] = 0 g["vimtex_quickfix_mode"] = 0
g["tex_conceal"] = "abdmg" g["tex_conceal"] = "abdmg"
g["vimtex_compiler_latexmk"] = { g["vimtex_compiler_latexmk"] = {
options = { options = {
"-bibtex", "-bibtex",
"-shell-escape", "-shell-escape",
"-verbose", "-verbose",
"-file-line-error", "-file-line-error",
} }
} }
-- I use LuaLaTeX for my documents so let me have it as the default, please? -- I use LuaLaTeX for my documents so let me have it as the default, please?
g["vimtex_compiler_latexmk_engines"] = { g["vimtex_compiler_latexmk_engines"] = {
_ = "-lualatex", _ = "-lualatex",
pdflatex = "-pdf", pdflatex = "-pdf",
dvipdfex = "-pdfdvi", dvipdfex = "-pdfdvi",
lualatex = "-lualatex", lualatex = "-lualatex",
xelatex = "-xelatex", xelatex = "-xelatex",
} }
end end
} }
-- Enable visuals for addition/deletion of lines in the gutter (side) similar to Visual Studio Code. -- Enable visuals for addition/deletion of lines in the gutter (side) similar to Visual Studio Code.
use { "airblade/vim-gitgutter" } use { "airblade/vim-gitgutter" }
-- Language plugins. -- Language plugins.
use { "LnL7/vim-nix" } use { "LnL7/vim-nix" }
use { "vmchale/dhall-vim" } use { "vmchale/dhall-vim" }
end) end)
-- g['UltiSnipsExpandTrigger'] = "<c-j>" -- g['UltiSnipsExpandTrigger'] = "<c-j>"
@ -219,12 +218,12 @@ local t = function(str)
end end
local check_back_space = function() local check_back_space = function()
local col = fn.col('.') - 1 local col = fn.col('.') - 1
if col == 0 or fn.getline('.'):sub(col, col):match('%s') then if col == 0 or fn.getline('.'):sub(col, col):match('%s') then
return true return true
else else
return false return false
end end
end end
-- Editor configuration -- Editor configuration