From e383b5fb5b7b41ec0c7c6787bce94f5619e130f1 Mon Sep 17 00:00:00 2001 From: Nulo Date: Fri, 3 Jun 2022 20:41:46 -0300 Subject: [PATCH] Revert "Borrar config de kak y nvim" This reverts commit 693415e3a99a51253dfa020c159f525dcac5bcc4. --- .config/kak/colors/grayscale-superiority.kak | 72 ++++++++ .config/kak/kakrc | 163 ++++++++++++++++++ .config/kak/plugins/fzf.kak | 1 + .config/kak/plugins/kakoune-buffers | 1 + .config/kak/plugins/smarttab.kak | 1 + .config/kak/plugins/zig.kak | 1 + .config/kak/sleuth.kak | 22 +++ .config/nvim/init.vim | 92 ++++++++++ .../nvim/pack/plugins/start/formatter.nvim | 1 + .config/nvim/pack/plugins/start/fzf.vim | 1 + .../nvim/pack/plugins/start/nvim-lspconfig | 1 + .config/nvim/pack/plugins/start/paige | 1 + .../nvim/pack/plugins/start/vim-commentary | 1 + .config/nvim/pack/plugins/start/vim-go | 1 + .config/nvim/pack/plugins/start/vim-sleuth | 1 + .config/nvim/pack/plugins/start/vim-svelte | 1 + .config/nvim/pack/plugins/start/zig.vim | 1 + .gitmodules | 39 +++++ 18 files changed, 401 insertions(+) create mode 100644 .config/kak/colors/grayscale-superiority.kak create mode 100644 .config/kak/kakrc create mode 160000 .config/kak/plugins/fzf.kak create mode 160000 .config/kak/plugins/kakoune-buffers create mode 160000 .config/kak/plugins/smarttab.kak create mode 160000 .config/kak/plugins/zig.kak create mode 100644 .config/kak/sleuth.kak create mode 100644 .config/nvim/init.vim create mode 160000 .config/nvim/pack/plugins/start/formatter.nvim create mode 160000 .config/nvim/pack/plugins/start/fzf.vim create mode 160000 .config/nvim/pack/plugins/start/nvim-lspconfig create mode 160000 .config/nvim/pack/plugins/start/paige create mode 160000 .config/nvim/pack/plugins/start/vim-commentary create mode 160000 .config/nvim/pack/plugins/start/vim-go create mode 160000 .config/nvim/pack/plugins/start/vim-sleuth create mode 160000 .config/nvim/pack/plugins/start/vim-svelte create mode 160000 .config/nvim/pack/plugins/start/zig.vim diff --git a/.config/kak/colors/grayscale-superiority.kak b/.config/kak/colors/grayscale-superiority.kak new file mode 100644 index 0000000..8ac7b71 --- /dev/null +++ b/.config/kak/colors/grayscale-superiority.kak @@ -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 <' -docstring "LSP Rename" + map buffer user a ': lsp-code-actions' -docstring "LSP Code actions" + map buffer user , ': lsp-hover' -docstring "LSP hover" + map buffer user l ': enter-user-mode lsp' -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 " wl-copy" +map -docstring "paste the clipboard" global user p " wl-paste --no-newline" +map -docstring "comment" global user c ": comment-line" +map -docstring "stop searching" global user h ": set-register slash ''" + +map -docstring "show whitespaces" global user s " :add-highlighter global/show-whitespaces show-whitespaces" +map -docstring "hide whitespaces" global user S " :remove-highlighter global/show-whitespaces" + +map global insert '' 'b' + +# https://github.com/Gigahawk/nixdots/blob/c98340cc56c998ac52f62d0df49c541bafcaaad7/dotfiles/kakrc +# - to select inner object +# = to select outer object +map global normal -- - +map global normal -- = + +# ------------ +# 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-modef' +map -docstring 'search buffers' global user b ': fzf-modeb' +map -docstring 'grep files' global user g ': fzf-modeg' + +# ------------ +# Buffer switching +# ------------ + +source "%val{config}/plugins/kakoune-buffers/buffers.kak" + +map global normal ^ q +map global normal Q + +map global normal q b +map global normal Q B +map global normal +map global normal + +map global normal b ':pick-buffers' -docstring 'pick buffers' +map global normal B ':enter-user-mode -lock buffers' -docstring 'buffers (lock)…' + +map global normal '' '' -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")" + } +} diff --git a/.config/kak/plugins/fzf.kak b/.config/kak/plugins/fzf.kak new file mode 160000 index 0000000..62a3de5 --- /dev/null +++ b/.config/kak/plugins/fzf.kak @@ -0,0 +1 @@ +Subproject commit 62a3de575cceeaf9f556b824123a418def8bea7b diff --git a/.config/kak/plugins/kakoune-buffers b/.config/kak/plugins/kakoune-buffers new file mode 160000 index 0000000..6b2081f --- /dev/null +++ b/.config/kak/plugins/kakoune-buffers @@ -0,0 +1 @@ +Subproject commit 6b2081f5b7d58c72de319a5cba7bf628b6802881 diff --git a/.config/kak/plugins/smarttab.kak b/.config/kak/plugins/smarttab.kak new file mode 160000 index 0000000..1dd3f33 --- /dev/null +++ b/.config/kak/plugins/smarttab.kak @@ -0,0 +1 @@ +Subproject commit 1dd3f33c4f65da5c13aee5d44b2e77399595830f diff --git a/.config/kak/plugins/zig.kak b/.config/kak/plugins/zig.kak new file mode 160000 index 0000000..54e66fc --- /dev/null +++ b/.config/kak/plugins/zig.kak @@ -0,0 +1 @@ +Subproject commit 54e66fcb6adf247e6ea8465ec68fe507eb27f25f diff --git a/.config/kak/sleuth.kak b/.config/kak/sleuth.kak new file mode 100644 index 0000000..96367ee --- /dev/null +++ b/.config/kak/sleuth.kak @@ -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+' '' + + # Tab vs. Space + # https://youtu.be/V7PLxL8jIl8 + try %{ + execute-keys '' '\t' '' + noexpandtab + set-option buffer indentwidth 0 + } catch %{ + expandtab + set-option buffer indentwidth %val{selection_length} + set-option buffer softtabstop %val{selection_length} + } + } + } +} + diff --git a/.config/nvim/init.vim b/.config/nvim/init.vim new file mode 100644 index 0000000..2cefaf0 --- /dev/null +++ b/.config/nvim/init.vim @@ -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', 'lua vim.lsp.buf.declaration()', opts) + buf_set_keymap('n', 'gd', 'lua vim.lsp.buf.definition()', opts) + buf_set_keymap('n', 'K', 'lua vim.lsp.buf.hover()', opts) + buf_set_keymap('n', 'gi', 'lua vim.lsp.buf.implementation()', opts) + buf_set_keymap('n', '', 'lua vim.lsp.buf.signature_help()', opts) + buf_set_keymap('n', 'wa', 'lua vim.lsp.buf.add_workspace_folder()', opts) + buf_set_keymap('n', 'wr', 'lua vim.lsp.buf.remove_workspace_folder()', opts) + buf_set_keymap('n', 'wl', 'lua print(vim.inspect(vim.lsp.buf.list_workspace_folders()))', opts) + buf_set_keymap('n', 'D', 'lua vim.lsp.buf.type_definition()', opts) + buf_set_keymap('n', 'rn', 'lua vim.lsp.buf.rename()', opts) + buf_set_keymap('n', 'ca', 'lua vim.lsp.buf.code_action()', opts) + buf_set_keymap('n', 'gr', 'lua vim.lsp.buf.references()', opts) + buf_set_keymap('n', 'e', 'lua vim.lsp.diagnostic.show_line_diagnostics()', opts) + buf_set_keymap('n', '[d', 'lua vim.lsp.diagnostic.goto_prev()', opts) + buf_set_keymap('n', ']d', 'lua vim.lsp.diagnostic.goto_next()', opts) + buf_set_keymap('n', 'q', 'lua vim.lsp.diagnostic.set_loclist()', 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 f :Files +noremap b :Buffers diff --git a/.config/nvim/pack/plugins/start/formatter.nvim b/.config/nvim/pack/plugins/start/formatter.nvim new file mode 160000 index 0000000..0cdce2d --- /dev/null +++ b/.config/nvim/pack/plugins/start/formatter.nvim @@ -0,0 +1 @@ +Subproject commit 0cdce2da8762ee01ee7d8df047b6e569d58c1ba3 diff --git a/.config/nvim/pack/plugins/start/fzf.vim b/.config/nvim/pack/plugins/start/fzf.vim new file mode 160000 index 0000000..1f7bfa4 --- /dev/null +++ b/.config/nvim/pack/plugins/start/fzf.vim @@ -0,0 +1 @@ +Subproject commit 1f7bfa4007043c30027b2cd79625e8aac5cff1f9 diff --git a/.config/nvim/pack/plugins/start/nvim-lspconfig b/.config/nvim/pack/plugins/start/nvim-lspconfig new file mode 160000 index 0000000..531751e --- /dev/null +++ b/.config/nvim/pack/plugins/start/nvim-lspconfig @@ -0,0 +1 @@ +Subproject commit 531751ef03d77bf094f1fc07844b6c03ec4862bb diff --git a/.config/nvim/pack/plugins/start/paige b/.config/nvim/pack/plugins/start/paige new file mode 160000 index 0000000..0d72c38 --- /dev/null +++ b/.config/nvim/pack/plugins/start/paige @@ -0,0 +1 @@ +Subproject commit 0d72c3814da3cc01d4435deaa6168fa913c694fd diff --git a/.config/nvim/pack/plugins/start/vim-commentary b/.config/nvim/pack/plugins/start/vim-commentary new file mode 160000 index 0000000..627308e --- /dev/null +++ b/.config/nvim/pack/plugins/start/vim-commentary @@ -0,0 +1 @@ +Subproject commit 627308e30639be3e2d5402808ce18690557e8292 diff --git a/.config/nvim/pack/plugins/start/vim-go b/.config/nvim/pack/plugins/start/vim-go new file mode 160000 index 0000000..430bc22 --- /dev/null +++ b/.config/nvim/pack/plugins/start/vim-go @@ -0,0 +1 @@ +Subproject commit 430bc227654abc3eb5e27a9052a857344ca08cdc diff --git a/.config/nvim/pack/plugins/start/vim-sleuth b/.config/nvim/pack/plugins/start/vim-sleuth new file mode 160000 index 0000000..65ade24 --- /dev/null +++ b/.config/nvim/pack/plugins/start/vim-sleuth @@ -0,0 +1 @@ +Subproject commit 65ade2453342062010386e226eaa754889e2b557 diff --git a/.config/nvim/pack/plugins/start/vim-svelte b/.config/nvim/pack/plugins/start/vim-svelte new file mode 160000 index 0000000..3a37f2a --- /dev/null +++ b/.config/nvim/pack/plugins/start/vim-svelte @@ -0,0 +1 @@ +Subproject commit 3a37f2a2414fa4c20c70e67e978977c1e2a43187 diff --git a/.config/nvim/pack/plugins/start/zig.vim b/.config/nvim/pack/plugins/start/zig.vim new file mode 160000 index 0000000..0762d89 --- /dev/null +++ b/.config/nvim/pack/plugins/start/zig.vim @@ -0,0 +1 @@ +Subproject commit 0762d89c24f5a1da6bf26ca83f3719c379008ff9 diff --git a/.gitmodules b/.gitmodules index f4ef1a6..ba807bd 100644 --- a/.gitmodules +++ b/.gitmodules @@ -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"] path = .config/vis/plugins/cursors url = https://github.com/erf/vis-cursors