diff --git a/.config/nvim/init.vim b/.config/nvim/init.vim new file mode 100644 index 0000000..6942fa8 --- /dev/null +++ b/.config/nvim/init.vim @@ -0,0 +1,86 @@ +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 ignorecase smartcase + +set updatetime=250 + +set termguicolors +" colorscheme rose-pine +colorscheme paige +" autocmd ColorScheme * highlight! Normal guibg=NONE + +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', 'tsserver', 'svelte' } +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 b/.config/nvim/pack/plugins/start/fzf new file mode 160000 index 0000000..e4c3ecc --- /dev/null +++ b/.config/nvim/pack/plugins/start/fzf @@ -0,0 +1 @@ +Subproject commit e4c3ecc57e99f4037199f11b384a7f8758d1a0ff diff --git a/.config/nvim/pack/plugins/start/fzf.vim b/.config/nvim/pack/plugins/start/fzf.vim new file mode 160000 index 0000000..d6aa214 --- /dev/null +++ b/.config/nvim/pack/plugins/start/fzf.vim @@ -0,0 +1 @@ +Subproject commit d6aa21476b2854694e6aa7b0941b8992a906c5ec diff --git a/.config/nvim/pack/plugins/start/nvim-lspconfig b/.config/nvim/pack/plugins/start/nvim-lspconfig new file mode 160000 index 0000000..3a22ac6 --- /dev/null +++ b/.config/nvim/pack/plugins/start/nvim-lspconfig @@ -0,0 +1 @@ +Subproject commit 3a22ac6f8d87d42f89b9de791053c98b803f1b6d 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/rose-pine b/.config/nvim/pack/plugins/start/rose-pine new file mode 160000 index 0000000..e9bf877 --- /dev/null +++ b/.config/nvim/pack/plugins/start/rose-pine @@ -0,0 +1 @@ +Subproject commit e9bf877ded422ce4323980c8347ca8578fe3b408 diff --git a/.config/nvim/pack/plugins/start/vim-commentary b/.config/nvim/pack/plugins/start/vim-commentary new file mode 160000 index 0000000..349340d --- /dev/null +++ b/.config/nvim/pack/plugins/start/vim-commentary @@ -0,0 +1 @@ +Subproject commit 349340debb34f6302931f0eb7139b2c11dfdf427 diff --git a/.config/nvim/pack/plugins/start/vim-go b/.config/nvim/pack/plugins/start/vim-go new file mode 160000 index 0000000..2831f48 --- /dev/null +++ b/.config/nvim/pack/plugins/start/vim-go @@ -0,0 +1 @@ +Subproject commit 2831f4872431685d28fbe3e567cd539a455fe750 diff --git a/.config/nvim/pack/plugins/start/vim-sleuth b/.config/nvim/pack/plugins/start/vim-sleuth new file mode 160000 index 0000000..38bd401 --- /dev/null +++ b/.config/nvim/pack/plugins/start/vim-sleuth @@ -0,0 +1 @@ +Subproject commit 38bd4010110614822cde523ebc5724963312ab63 diff --git a/.config/nvim/pack/plugins/start/vim-svelte b/.config/nvim/pack/plugins/start/vim-svelte new file mode 160000 index 0000000..5f88e5a --- /dev/null +++ b/.config/nvim/pack/plugins/start/vim-svelte @@ -0,0 +1 @@ +Subproject commit 5f88e5a0fe7dcece0008dae3453edbd99153a042 diff --git a/.config/nvim/pack/plugins/start/vim-yami b/.config/nvim/pack/plugins/start/vim-yami new file mode 160000 index 0000000..716fe22 --- /dev/null +++ b/.config/nvim/pack/plugins/start/vim-yami @@ -0,0 +1 @@ +Subproject commit 716fe223a430a1379ef1e4bec84348a2f07430fd diff --git a/.config/nvim/pack/plugins/start/zig.vim b/.config/nvim/pack/plugins/start/zig.vim new file mode 160000 index 0000000..fb534e7 --- /dev/null +++ b/.config/nvim/pack/plugins/start/zig.vim @@ -0,0 +1 @@ +Subproject commit fb534e7d12be7e529f79ad5ab99c08dc99f53294 diff --git a/.gitmodules b/.gitmodules index 2454b6c..d4cca32 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,3 +1,39 @@ +[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/rose-pine"] + path = .config/nvim/pack/plugins/start/rose-pine + url = https://github.com/rose-pine/neovim +[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/fzf"] + path = .config/nvim/pack/plugins/start/fzf + url = https://github.com/junegunn/fzf +[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/vim-yami"] + path = .config/nvim/pack/plugins/start/vim-yami + url = https://github.com/danishprakash/vim-yami +[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