Compare commits

..

4 commits

Author SHA1 Message Date
9b0261fec0 sway-rename-workspace 2022-06-13 12:49:25 -03:00
4237e7954d kakoune.desktop: text/markdown 2022-06-05 11:48:35 -03:00
7717d0c456 kakoune.desktop 2022-06-05 11:47:43 -03:00
e383b5fb5b Revert "Borrar config de kak y nvim"
This reverts commit 693415e3a9.
2022-06-03 20:41:46 -03:00
20 changed files with 513 additions and 0 deletions

View file

@ -0,0 +1,72 @@
evaluate-commands %sh{
black="rgb:000000"
dark_gray="rgb:333333"
gray="rgb:474747"
white="rgb:FFFFFF"
whiteish="rgb:DDDDDD"
pale_blue="rgb:BBCCEE"
pale_cyan="rgb:CCEEFF"
dark_blue="rgb:222255"
dark_cyan="rgb:225555"
dark_grey="rgb:555555"
vibrant_grey="rgb:BBBBBB"
cat <<EOF
# For Code
set-face global keyword Default
set-face global attribute Default
set-face global type Default
set-face global string ${gray}
set-face global value Default
set-face global meta Default
set-face global builtin Default
set-face global module Default
set-face global comment ${gray}+i
set-face global documentation comment
set-face global function Default
set-face global operator Default
set-face global variable Default
# For markup
set-face global title +b
set-face global header +b
set-face global block Default
set-face global mono Default
set-face global link +u
set-face global list Default
set-face global bullet +b
# Built-in faces
set-face global Default ${black},${white}
set-face global PrimarySelection ${black},${pale_blue}+fg
set-face global SecondarySelection ${black},${pale_cyan}+fg
set-face global PrimaryCursor ${white},${dark_blue}+fg
set-face global SecondaryCursor ${white},${dark_cyan}+fg
set-face global PrimaryCursorEol ${white},${dark_grey}+fg
set-face global SecondaryCursorEol ${white},${vibrant_grey}+fg
set-face global StatusLine ${black},${whiteish}
set-face global StatusLineMode ${black},${whiteish}
set-face global StatusLineInfo ${black},${whiteish}
set-face global StatusLineValue ${black},${whiteish}+b
set-face global StatusCursor PrimaryCursor
set-face global Prompt ${black},${whiteish}
set-face global MenuForeground ${whiteish},${black}
set-face global MenuBackground ${black},${whiteish}
set-face global MenuInfo +i
set-face global LineNumbers ${black},${whiteish}
set-face global LineNumbersWrapped ${black},${whiteish}+i
set-face global LineNumberCursor ${black},rgb:CCCCCC+b
set-face global MatchingChar ${black},${whiteish}+b
set-face global Whitespace Default
set-face global WrapMarker ${black},${whiteish}
set-face global Information ${black},${whiteish}
set-face global Error rgb:DD0000,${whiteish}
set-face global BufferPadding Default
EOF
}

163
.config/kak/kakrc Normal file
View file

@ -0,0 +1,163 @@
add-highlighter global/number number-lines -relative -hlcursor
add-highlighter global/ wrap -word
add-highlighter global/search dynregex '%reg{/}' 0:MatchingChar
add-highlighter global/ show-matching
set global scrolloff 5,5
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
if test "$dark" = true; then
echo "colorscheme selenized-black"
else
echo "colorscheme grayscale-superiority"
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 '║'
set global lsp_diagnostic_line_warning_sign '┊'
set global lsp_hover_anchor true
set global lsp_auto_show_code_actions true
set global lsp_auto_highlight_references true
hook global WinSetOption filetype=(zig|go) %{
map buffer user r ': lsp-rename-prompt<ret>' -docstring "LSP Rename"
map buffer user a ': lsp-code-actions<ret>' -docstring "LSP Code actions"
map buffer user , ': lsp-hover<ret>' -docstring "LSP hover"
map buffer user l ': enter-user-mode lsp<ret>' -docstring "LSP mode"
lsp-enable-window
lsp-auto-signature-help-enable
}
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
}
hook global WinSetOption filetype=zig %{
set-option buffer formatcmd "zig fmt --stdin"
hook buffer BufWritePre .* format-buffer
}
hook global WinSetOption filetype=go %{
set-option buffer formatcmd "goimports"
hook buffer BufWritePre .* format-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>"
map -docstring "comment" global user c ": comment-line<ret>"
map -docstring "stop searching" global user h ": set-register slash ''<ret>"
map -docstring "show whitespaces" global user s " :add-highlighter global/show-whitespaces show-whitespaces<ret>"
map -docstring "hide whitespaces" global user S " :remove-highlighter global/show-whitespaces<ret>"
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
# ------------
source "%val{config}/plugins/smarttab.kak/rc/smarttab.kak"
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 }
# ------------
# 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' {} \;
}
hook global ModuleLoaded fzf %{
set-option global fzf_terminal_command 'fzf-terminal kak -c %val{session} -e "%arg{@}"'
set-option global fzf_default_opts '--color=light'
}
hook global ModuleLoaded fzf-file %{
set-option global fzf_file_command 'rg -L --hidden --files --glob !.git'
}
hook global ModuleLoaded fzf-grep %{
set-option global fzf_grep_command 'rg'
}
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'
# ------------
# Buffer switching
# ------------
source "%val{config}/plugins/kakoune-buffers/buffers.kak"
map global normal ^ q
map global normal <a-^> Q
map global normal q b
map global normal Q B
map global normal <a-q> <a-b>
map global normal <a-Q> <a-B>
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'
# ------------
# Comandos para interactuar con el mundo exterior
# ------------
define-command exportmd %{
nop %sh{
cd "$(dirname "$kak_buffile")"
exportmd pdf "$kak_buffile"
}
}
define-command nemo %{
nop %sh{
swaymsg exec "nemo $(dirname "$kak_buffile")"
}
}

@ -0,0 +1 @@
Subproject commit 62a3de575cceeaf9f556b824123a418def8bea7b

@ -0,0 +1 @@
Subproject commit 6b2081f5b7d58c72de319a5cba7bf628b6802881

@ -0,0 +1 @@
Subproject commit 1dd3f33c4f65da5c13aee5d44b2e77399595830f

@ -0,0 +1 @@
Subproject commit 54e66fcb6adf247e6ea8465ec68fe507eb27f25f

22
.config/kak/sleuth.kak Normal file
View file

@ -0,0 +1,22 @@
# https://github.com/mawww/kakoune/issues/2108#issuecomment-721313321
define-command sleuth -docstring 'Heuristically set buffer options' %{
try %{
evaluate-commands -draft %{
# Search the first indent level
execute-keys 'gg' '/' '^\h+' '<ret>'
# Tab vs. Space
# https://youtu.be/V7PLxL8jIl8
try %{
execute-keys '<a-k>' '\t' '<ret>'
noexpandtab
set-option buffer indentwidth 0
} catch %{
expandtab
set-option buffer indentwidth %val{selection_length}
set-option buffer softtabstop %val{selection_length}
}
}
}
}

92
.config/nvim/init.vim Normal file
View file

@ -0,0 +1,92 @@
set mouse=a " Enable mouse
set linebreak " Wrap words
set hidden " Do not save when switching buffers
set inccommand=nosplit " Incremental live completion
set tabstop=4 shiftwidth=4 " 4 space \t
set relativenumber cursorline cursorlineopt=number lazyredraw
set ignorecase smartcase
set updatetime=250
set termguicolors
colorscheme paige
highlight! Comment guifg=#474747 guibg=#ffffff
highlight! htmlComment guifg=#474747 guibg=#ffffff
highlight! htmlCommentPart guifg=#474747 guibg=#ffffff
highlight! gitcommitComment guifg=#474747 guibg=#ffffff
highlight! CursorLineNr ctermfg=232 ctermbg=254 gui=bold guifg=#080808 guibg=#cccccc
set completeopt=menu,menuone,noselect
lua << EOF
local nvim_lsp = require('lspconfig')
-- Use an on_attach function to only map the following keys
-- after the language server attaches to the current buffer
local on_attach = function(client, bufnr)
local function buf_set_keymap(...) vim.api.nvim_buf_set_keymap(bufnr, ...) end
local function buf_set_option(...) vim.api.nvim_buf_set_option(bufnr, ...) end
buf_set_option('omnifunc', 'v:lua.vim.lsp.omnifunc')
local opts = { noremap=true, silent=true }
buf_set_keymap('n', 'gD', '<cmd>lua vim.lsp.buf.declaration()<CR>', opts)
buf_set_keymap('n', 'gd', '<cmd>lua vim.lsp.buf.definition()<CR>', opts)
buf_set_keymap('n', 'K', '<cmd>lua vim.lsp.buf.hover()<CR>', opts)
buf_set_keymap('n', 'gi', '<cmd>lua vim.lsp.buf.implementation()<CR>', opts)
buf_set_keymap('n', '<C-k>', '<cmd>lua vim.lsp.buf.signature_help()<CR>', opts)
buf_set_keymap('n', '<space>wa', '<cmd>lua vim.lsp.buf.add_workspace_folder()<CR>', opts)
buf_set_keymap('n', '<space>wr', '<cmd>lua vim.lsp.buf.remove_workspace_folder()<CR>', opts)
buf_set_keymap('n', '<space>wl', '<cmd>lua print(vim.inspect(vim.lsp.buf.list_workspace_folders()))<CR>', opts)
buf_set_keymap('n', '<space>D', '<cmd>lua vim.lsp.buf.type_definition()<CR>', opts)
buf_set_keymap('n', '<space>rn', '<cmd>lua vim.lsp.buf.rename()<CR>', opts)
buf_set_keymap('n', '<space>ca', '<cmd>lua vim.lsp.buf.code_action()<CR>', opts)
buf_set_keymap('n', 'gr', '<cmd>lua vim.lsp.buf.references()<CR>', opts)
buf_set_keymap('n', '<space>e', '<cmd>lua vim.lsp.diagnostic.show_line_diagnostics()<CR>', opts)
buf_set_keymap('n', '[d', '<cmd>lua vim.lsp.diagnostic.goto_prev()<CR>', opts)
buf_set_keymap('n', ']d', '<cmd>lua vim.lsp.diagnostic.goto_next()<CR>', opts)
buf_set_keymap('n', '<space>q', '<cmd>lua vim.lsp.diagnostic.set_loclist()<CR>', opts)
end
local servers = { 'zls', 'gopls' }
for _, lsp in ipairs(servers) do
nvim_lsp[lsp].setup {
on_attach = on_attach,
}
end
local prettier = {
function()
return {
exe = "prettier",
args = {"--stdin-filepath", vim.fn.fnameescape(vim.api.nvim_buf_get_name(0))},
stdin = true
}
end
}
require('formatter').setup({
filetype = {
javascript = prettier,
typescript = prettier,
html = prettier,
css = prettier,
scss = prettier,
sass = prettier,
svelte = prettier, -- necesita https://github.com/sveltejs/prettier-plugin-svelte
}
})
EOF
augroup FormatAutogroup
autocmd!
autocmd BufWritePost *.js,*.ts,*.html,*.css,*.scss,*.sass FormatWrite
autocmd BufWritePost *.svelte FormatWrite " necesita https://github.com/sveltejs/prettier-plugin-svelte
augroup END
let g:fzf_layout = { 'down': '40%' }
noremap <space>f :Files<return>
noremap <space>b :Buffers<return>

@ -0,0 +1 @@
Subproject commit 0cdce2da8762ee01ee7d8df047b6e569d58c1ba3

@ -0,0 +1 @@
Subproject commit 1f7bfa4007043c30027b2cd79625e8aac5cff1f9

@ -0,0 +1 @@
Subproject commit 531751ef03d77bf094f1fc07844b6c03ec4862bb

@ -0,0 +1 @@
Subproject commit 0d72c3814da3cc01d4435deaa6168fa913c694fd

@ -0,0 +1 @@
Subproject commit 627308e30639be3e2d5402808ce18690557e8292

@ -0,0 +1 @@
Subproject commit 430bc227654abc3eb5e27a9052a857344ca08cdc

@ -0,0 +1 @@
Subproject commit 65ade2453342062010386e226eaa754889e2b557

@ -0,0 +1 @@
Subproject commit 3a37f2a2414fa4c20c70e67e978977c1e2a43187

@ -0,0 +1 @@
Subproject commit 0762d89c24f5a1da6bf26ca83f3719c379008ff9

39
.gitmodules vendored
View file

@ -1,3 +1,42 @@
[submodule ".config/nvim/pack/plugins/start/nvim-lspconfig"]
path = .config/nvim/pack/plugins/start/nvim-lspconfig
url = https://github.com/neovim/nvim-lspconfig
[submodule ".config/nvim/pack/plugins/start/vim-commentary"]
path = .config/nvim/pack/plugins/start/vim-commentary
url = https://tpope.io/vim/commentary.git
[submodule ".config/nvim/pack/plugins/start/vim-sleuth"]
path = .config/nvim/pack/plugins/start/vim-sleuth
url = https://github.com/tpope/vim-sleuth
[submodule ".config/nvim/pack/plugins/start/zig.vim"]
path = .config/nvim/pack/plugins/start/zig.vim
url = https://github.com/ziglang/zig.vim
[submodule ".config/nvim/pack/plugins/start/fzf.vim"]
path = .config/nvim/pack/plugins/start/fzf.vim
url = https://github.com/junegunn/fzf.vim
[submodule ".config/nvim/pack/plugins/start/vim-go"]
path = .config/nvim/pack/plugins/start/vim-go
url = https://github.com/fatih/vim-go
[submodule ".config/nvim/pack/plugins/start/formatter.nvim"]
path = .config/nvim/pack/plugins/start/formatter.nvim
url = https://github.com/mhartington/formatter.nvim
[submodule ".config/nvim/pack/plugins/start/vim-svelte"]
path = .config/nvim/pack/plugins/start/vim-svelte
url = https://github.com/evanleck/vim-svelte
[submodule ".config/nvim/pack/plugins/start/paige"]
path = .config/nvim/pack/plugins/start/paige
url = https://git.sr.ht/~leon_plickat/paige
[submodule ".config/kak/plugins/smarttab.kak"]
path = .config/kak/plugins/smarttab.kak
url = https://github.com/andreyorst/smarttab.kak
[submodule ".config/kak/plugins/zig.kak"]
path = .config/kak/plugins/zig.kak
url = https://gitea.nulo.in/Nulo/zig.kak
[submodule ".config/kak/plugins/fzf.kak"]
path = .config/kak/plugins/fzf.kak
url = https://gitea.nulo.in/Nulo/fzf.kak
[submodule ".config/kak/plugins/kakoune-buffers"]
path = .config/kak/plugins/kakoune-buffers
url = https://github.com/Delapouite/kakoune-buffers
[submodule ".config/vis/plugins/cursors"] [submodule ".config/vis/plugins/cursors"]
path = .config/vis/plugins/cursors path = .config/vis/plugins/cursors
url = https://github.com/erf/vis-cursors url = https://github.com/erf/vis-cursors

View file

@ -0,0 +1,24 @@
#!/usr/bin/env lua5.1
-- https://stackoverflow.com/a/326715
function os.capture(cmd, raw)
local f = assert(io.popen(cmd, 'r'))
local s = assert(f:read('*a'))
f:close()
if raw then return s end
s = string.gsub(s, '^%s+', '')
s = string.gsub(s, '%s+$', '')
s = string.gsub(s, '[\n\r]+', ' ')
return s
end
local rename_to = os.capture("echo | fuzzel-run --dmenu")
local workspace_number = os.capture("swaymsg -t get_workspaces | jq '.[] | select(.focused).num'")
local workspace_new_name = workspace_number .. ": " .. rename_to
if #rename_to == 0 then
workspace_new_name = workspace_number
end
assert(os.execute("swaymsg rename workspace to '"..workspace_new_name.."'"))

View file

@ -0,0 +1,88 @@
[Desktop Entry]
Name=Kakoune
GenericName=Text Editor
GenericName[de]=Texteditor
GenericName[fr]=Éditeur de texte
GenericName[ru]=Текстовый редактор
GenericName[sr]=Едитор текст
GenericName[tr]=Metin Düzenleyici
Comment=Edit text files
Comment[af]=Redigeer tekslêers
Comment[am]=
Comment[ar]=حرّر ملفات نصية
Comment[az]=Mətn fayllarını redaktə edin
Comment[be]=Рэдагаваньне тэкставых файлаў
Comment[bg]=Редактиране на текстови файлове
Comment[bn]= ি
Comment[bs]=Izmijeni tekstualne datoteke
Comment[ca]=Edita fitxers de text
Comment[cs]=Úprava textových souborů
Comment[cy]=Golygu ffeiliau testun
Comment[da]=Redigér tekstfiler
Comment[de]=Textdateien bearbeiten
Comment[el]=Επεξεργασία αρχείων κειμένου
Comment[en_CA]=Edit text files
Comment[en_GB]=Edit text files
Comment[es]=Edita archivos de texto
Comment[et]=Redigeeri tekstifaile
Comment[eu]=Editatu testu-fitxategiak
Comment[fa]=ویرایش پروندههای متنی
Comment[fi]=Muokkaa tekstitiedostoja
Comment[fr]=Éditer des fichiers texte
Comment[ga]=Eagar comhad Téacs
Comment[gu]=
Comment[he]=ערוך קבצי טקסט
Comment[hi]= ि
Comment[hr]=Uređivanje tekstualne datoteke
Comment[hu]=Szövegfájlok szerkesztése
Comment[id]=Edit file teks
Comment[it]=Modifica file di testo
Comment[ja]=
Comment[kn]= ಿ
Comment[ko]=
Comment[lt]=Redaguoti tekstines bylas
Comment[lv]=Rediģēt teksta failus
Comment[mk]=Уреди текстуални фајлови
Comment[ml]= ി
Comment[mn]=Текст файл боловсруулах
Comment[mr]= ि
Comment[ms]=Edit fail teks
Comment[nb]=Rediger tekstfiler
Comment[ne]=
Comment[nl]=Tekstbestanden bewerken
Comment[nn]=Rediger tekstfiler
Comment[no]=Rediger tekstfiler
Comment[or]= ି
Comment[pa]=
Comment[pl]=Edytor plików tekstowych
Comment[pt]=Editar ficheiros de texto
Comment[pt_BR]=Edite arquivos de texto
Comment[ro]=Editare fişiere text
Comment[ru]=Редактирование текстовых файлов
Comment[sk]=Úprava textových súborov
Comment[sl]=Urejanje datotek z besedili
Comment[sq]=Përpuno files teksti
Comment[sr]=Уређујте текст фајлове
Comment[sr@Latn]=Izmeni tekstualne datoteke
Comment[sv]=Redigera textfiler
Comment[ta]=
Comment[th]=
Comment[tk]=Metin faýllary editle
Comment[tr]=Metin dosyaları düzenleyin
Comment[uk]=Редактор текстових файлів
Comment[vi]=Son tho tp tin văn bn
Comment[wa]=Asspougnî des fitchîs tecses
Comment[zh_CN]=
Comment[zh_TW]=
TryExec=kak
Exec=footclient kak %F
Type=Application
Keywords=Text;editor;
Keywords[fr]=Texte;éditeur;
Keywords[ru]=текст;текстовый редактор;
Keywords[sr]=Текст;едитор;
Keywords[tr]=Metin;düzenleyici;
Icon=nvim
Categories=Utility;TextEditor;
StartupNotify=false
MimeType=text/english;text/plain;text/x-makefile;text/x-c++hdr;text/x-c++src;text/x-chdr;text/x-csrc;text/x-java;text/x-moc;text/x-pascal;text/x-tcl;text/x-tex;application/x-shellscript;text/x-c;text/x-c++;text/markdown;