Compare commits

...

3 commits

Author SHA1 Message Date
cdabfe2db5 kak: Ordenar config y agregar varias cosas 2022-03-13 17:51:05 -03:00
c7c5f72d49 exportmd 2022-03-13 17:50:32 -03:00
eb8542f040 Usar Input Mono Condensed 2022-03-13 11:09:58 -03:00
4 changed files with 125 additions and 13 deletions

View file

@ -82,10 +82,10 @@
<!-- Set default monospace font -->
<alias>
<family>monospace</family>
<prefer><family>Input Mono Narrow</family></prefer>
<prefer><family>Input Mono Condensed</family></prefer>
</alias>
<alias>
<family>Input Mono Narrow</family>
<family>Input Mono Condensed</family>
<default><family>monospace</family></default>
</alias>

View file

@ -5,7 +5,11 @@ add-highlighter global/ show-matching
set global scrolloff 5,5
set-option global ui_options terminal_assistant=off
set global ui_options terminal_assistant=off
set -add global ui_options terminal_status_on_top=true
# case insensitive search
map global normal / /(?i)
eval %sh{
. ~/.config/river/colors
@ -16,6 +20,10 @@ eval %sh{
fi
}
# ------------
# Language Server Protocol
# ------------
eval %sh{kak-lsp --kakoune -s $kak_session}
set global lsp_cmd "kak-lsp -s %val{session} -vvv --log /tmp/kak-lsp.log"
set global lsp_diagnostic_line_error_sign '║'
@ -33,6 +41,10 @@ hook global WinSetOption filetype=(zig|go) %{
}
hook global KakEnd .* lsp-exit
# ------------
# Formateadores
# ------------
hook global WinSetOption filetype=(javascript|typescript|json|css) %{
set-option buffer formatcmd %sh{ echo prettier --stdin-filepath $kak_buffile }
hook buffer BufWritePre .* format-buffer
@ -48,10 +60,20 @@ hook global WinSetOption filetype=go %{
hook buffer BufWritePre .* format-buffer
}
source "%val{config}/plugins/zig.kak/rc/zig.kak"
#hook global WinSetOption filetype=zig %{ zig-auto-run buffer }
# ------------
# Usar Foot
# ------------
hook global KakBegin .* %{ set-option global termcmd "footclient sh -c" }
define-command fzf-terminal -params 1.. -shell-completion %{
set-option global termcmd "footclient --app-id=fzf sh -c"
wayland-terminal %arg{@}
set-option global termcmd "footclient sh -c"
}
# ------------
# Keybindings genericas
# ------------
map -docstring "yank the selection into the clipboard" global user y "<a-|> wl-copy<ret>"
map -docstring "paste the clipboard" global user p "<a-!> wl-paste --no-newline<ret>"
@ -63,6 +85,12 @@ map -docstring "hide whitespaces" global user S " :remove-highlighter global/sho
map global insert '<c-w>' '<esc>b<a-c>'
# https://github.com/Gigahawk/nixdots/blob/c98340cc56c998ac52f62d0df49c541bafcaaad7/dotfiles/kakrc
# - to select inner object
# = to select outer object
map global normal -- - <a-i>
map global normal -- = <a-a>
# ------------
# Indentación
# ------------
@ -72,6 +100,7 @@ hook global ModuleLoaded smarttab %{
set-option global softtabstop 4
}
# Sleuth es un "plugin" que detecta la identación del archivo y configura el editor para usarlo por defecto.
source "%val{config}/sleuth.kak"
hook -group sleuth global BufOpenFile .* %{ sleuth }
hook -group sleuth global BufWritePost .* %{ sleuth }
@ -79,6 +108,7 @@ hook -group sleuth global BufWritePost .* %{ sleuth }
# ------------
# FZF
# ------------
source "%val{config}/plugins/fzf.kak/rc/fzf.kak"
evaluate-commands %sh{
find -L "$kak_config/plugins/fzf.kak/rc/modules/" -type f -name '*.kak' -exec printf 'source "%s"\n' {} \;
@ -97,12 +127,6 @@ map -docstring 'search files' global user f ': fzf-mode<ret>f'
map -docstring 'search buffers' global user b ': fzf-mode<ret>b'
map -docstring 'grep files' global user g ': fzf-mode<ret>g'
define-command fzf-terminal -params 1.. -shell-completion %{
set-option global termcmd "footclient --app-id=fzf sh -c"
wayland-terminal %arg{@}
set-option global termcmd "footclient sh -c"
}
# ------------
# Buffer switching
# ------------
@ -121,3 +145,14 @@ map global normal b ':pick-buffers<ret>' -docstring 'pick buffers'
map global normal B ':enter-user-mode -lock buffers<ret>' -docstring 'buffers (lock)…'
map global normal '<c-p>' '<tab>' -docstring 'jump forward'
# ------------
# Exportar archivos Markdown a PDF
# ------------
define-command exportmd %{
nop %sh{
cd "$(dirname "$kak_buffile")"
exportmd pdf "$kak_buffile"
}
}

View file

@ -11,8 +11,8 @@ lines = 10000
hide-when-typing=yes
[main]
font=monospace:pixelsize=17
line-height=26px
font=monospace:pixelsize=18
line-height=27px
vertical-letter-offset=4px
pad=0x0

77
.local/bin/exportmd Executable file
View file

@ -0,0 +1,77 @@
#!/bin/sh -e
html() {
echo "<meta charset=utf8>"
if test -n "$style"; then
echo "
<style>
html, body {
margin: 0;
padding: 0;
font-family: 'Liberation Sans', sans-serif;
font-size: 16px;
line-height: 1.3;
}
h1, h2, h3, h4, h5, h6 {
text-align: center;
}
img {
max-width: 100%;
}
blockquote {
border-left: 3px solid;
margin-left: 1em;
padding-left: 1em;
}
</style>
"
fi
cmark --unsafe < "$1"
}
format="$1"
input="$2"
if test ! -f "$input"; then
echo "no existe el archivo \`$input\`."
exit 1
fi
output="$(dirname "$input")/$(basename "$input" .md).$format"
if grep "TODO|XXX" "$input" >/dev/null; then
echo "Ojo, ¡todavía tenés TODOs o XXXs!"
fi
if test "$format" = epub -o "$format" = rtf -o "$format" = docx; then
htmlfile="${input%.md}.html"
style=true html "$input" > "$htmlfile"
#if which pandoc >/dev/null; then
# pandoc --reference-doc=$HOME/template.docx -s -o "$output" "$htmlfile"
if which libreoffice >/dev/null; then
echo libreoffice --headless --writer --convert-to "$format" "$htmlfile"
libreoffice --headless --writer --convert-to "$format" "$htmlfile"
else
echo "No tengo libreoffice para convertir a $format."
rm "$htmlfile"
exit 1
fi
rm "$htmlfile"
elif test "$format" = html; then
style=true html "$input" > "$output"
elif test "$format" = standalone.html; then
html "$input" > "$output"
echo "<style>" >> "$output"
cat ~/proy/sitio/drip.css >> "$output"
echo "</style>" >> "$output"
elif test "$format" = pdf; then
style=true html "$input" | weasyprint -u "$(dirname "$input")" - "$output"
else
echo "no conozco el formato \`$format\`."
exit 1
fi