From 2b67513562d3286af7c5cfb9641b45eb7b2e8669 Mon Sep 17 00:00:00 2001 From: Jose Blanco Date: Wed, 17 Nov 2021 13:18:05 -0600 Subject: [PATCH 01/10] =?UTF-8?q?=F0=9F=94=A8=20implement=20some=20customs?= =?UTF-8?q?=20keymaps?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .vimrc | 4 +++- after/plugin/editor.vim | 35 ++++++++++++++++++++++++++++++++++- after/plugin/explorer.vim | 16 ++++++++++++++++ 3 files changed, 53 insertions(+), 2 deletions(-) diff --git a/.vimrc b/.vimrc index 472a426..bc4468d 100644 --- a/.vimrc +++ b/.vimrc @@ -55,6 +55,7 @@ Plug 'mfussenegger/nvim-dap-python' Plug 'Pocco81/DAPInstall.nvim' Plug 'rcarriga/nvim-dap-ui' Plug 'mhartington/formatter.nvim' +Plug 'sheerun/vim-polyglot' " Auto complete Plug 'https://github.com/onsails/lspkind-nvim.git' @@ -87,6 +88,7 @@ Plug 'sudormrfbin/cheatsheet.nvim' " If you have nodejs and yarn Plug 'iamcco/markdown-preview.nvim', { 'do': 'cd app && npm install' } Plug 'https://github.com/dhruvasagar/vim-table-mode' +Plug 'jremmen/vim-ripgrep' " Initialize plugin system call plug#end() @@ -154,7 +156,7 @@ let $NVIM_TUI_ENABLE_TRUE_COLOR=1 :set termguicolors :set background=dark -:colorscheme hybrid_material +:colorscheme hybrid_reverse " REMAPS " Leader diff --git a/after/plugin/editor.vim b/after/plugin/editor.vim index c9d420e..8fa74fa 100644 --- a/after/plugin/editor.vim +++ b/after/plugin/editor.vim @@ -77,13 +77,46 @@ EOF " LSP-CONFIG "============================================================================= +nnoremap gi lua vim.lsp.buf.implementation() + " Disable text object diagnostic to avoid overbloating UI lua << EOF vim.lsp.handlers["textDocument/publishDiagnostics"] = vim.lsp.with( vim.lsp.diagnostic.on_publish_diagnostics, { virtual_text = false } -) + ) +EOF + +"============================================================================= +" TREESITTER +"============================================================================= +set nofoldenable +set foldmethod=expr +set foldexpr=nvim_treesitter#foldexpr() +set foldminlines=50 +set foldnestmax=2 + +lua << EOF +local parser_configs = require("nvim-treesitter.parsers").get_parser_configs() +parser_configs.http = { + install_info = { + url = "https://github.com/NTBBloodbath/tree-sitter-http", + files = { "src/parser.c" }, + branch = "main", + }, +} + +require("nvim-treesitter.configs").setup { + highlight = { + enable = true, + }, + indent = { + enable = false, + }, + ensure_installed = "all", + ignore_install = { "haskell" }, +} EOF "============================================================================= diff --git a/after/plugin/explorer.vim b/after/plugin/explorer.vim index ef17adf..92faa42 100644 --- a/after/plugin/explorer.vim +++ b/after/plugin/explorer.vim @@ -7,6 +7,9 @@ command! -nargs=1 Livegrep lua require('telescope.builtin').live_grep({search_di nnoremap ff Telescope find_files nnoremap fl Telescope live_grep +nnoremap fp Telescope find_project_files +nnoremap fg Telescope live_grep +nnoremap fb Telescope buffers nnoremap fw Telescope grep_string nnoremap fb Telescope buffers nnoremap fgf Telescope git_files @@ -17,6 +20,10 @@ nnoremap fma Telescope vim_bookmarks all nnoremap fmf Telescope vim_bookmarks current_file nnoremap fdf Telescope lsp_document_diagnostics nnoremap fda Telescope lsp_workspace_diagnostics +nnoremap fc TodoTelescope +nnoremap fy Telescope neoclip +nnoremap fs Telescope ultisnips +nnoremap fq Telescope quickfix lua << EOF local actions = require "telescope.actions" @@ -27,6 +34,15 @@ local internal_pickers = require'telescope.builtin.internal' local diffview = require"diffview" local git_utils = require'utils.git' +require('telescope.builtin').find_project_files = function(opts) + path = vim.fn.finddir(".git", vim.fn.expand('%:p:h')..';') + root = vim.fn.fnamemodify(vim.fn.substitute(path, ".git", "", ""), ":p:h") + + opts.cwd = root + + require'telescope.builtin'.find_files(opts) +end + require'telescope'.setup { defaults = { mappings = { From 01287415728504fa8d537c82d14d02e8b2167810 Mon Sep 17 00:00:00 2001 From: Jose Blanco Date: Wed, 17 Nov 2021 13:21:48 -0600 Subject: [PATCH 02/10] fea: update treesitter config --- after/plugin/editor.vim | 35 ++--------------------------------- 1 file changed, 2 insertions(+), 33 deletions(-) diff --git a/after/plugin/editor.vim b/after/plugin/editor.vim index 8fa74fa..12d0050 100644 --- a/after/plugin/editor.vim +++ b/after/plugin/editor.vim @@ -42,37 +42,6 @@ require "formatter".setup { } EOF -"============================================================================= -" TREESITTER -"============================================================================= -set nofoldenable -set foldmethod=expr -set foldexpr=nvim_treesitter#foldexpr() -set foldminlines=50 -set foldnestmax=2 - -lua < Date: Thu, 6 Jan 2022 10:54:07 -0600 Subject: [PATCH 03/10] feat: implement suport for tsx file --- after/plugin/editor.vim | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/after/plugin/editor.vim b/after/plugin/editor.vim index 12d0050..a363aaf 100644 --- a/after/plugin/editor.vim +++ b/after/plugin/editor.vim @@ -10,7 +10,7 @@ let g:EditorConfig_exclude_patterns = ['fugitive://.*', 'scp://.*'] augroup Format autocmd! - autocmd BufWritePost *.js,*.jsx,*.ts,*.py FormatWrite + autocmd BufWritePost *.js,*.jsx,*.tsx,*.ts,*.py FormatWrite augroup END lua << EOF @@ -29,6 +29,7 @@ require "formatter".setup { typescript = node_formatters, javascript = node_formatters, javascriptreact = node_formatters, + typescriptreact = node_formatters, python = { function() return { @@ -85,7 +86,6 @@ require("nvim-treesitter.configs").setup { enable = false, }, ensure_installed = "maintained", - ignore_install = { "haskell" }, } EOF "============================================================================= @@ -214,3 +214,17 @@ require('lspconfig').omnisharp.setup { cmd = { '/usr/local/share/omnisharp/run', "--languageserver", "--hostPID", tostring(vim.fn.getpid())}, } EOF + +"============================================================================= +" FLUTTER-TOOLS +"============================================================================= +" +lua < Date: Thu, 6 Jan 2022 10:54:20 -0600 Subject: [PATCH 04/10] feat: add some configs for telescope leavea comment with vim-doge it is disabled for now because is breaking the highlights --- .vimrc | 2 ++ after/plugin/explorer.vim | 4 ++++ 2 files changed, 6 insertions(+) diff --git a/.vimrc b/.vimrc index bc4468d..246a5cf 100644 --- a/.vimrc +++ b/.vimrc @@ -89,6 +89,8 @@ Plug 'sudormrfbin/cheatsheet.nvim' Plug 'iamcco/markdown-preview.nvim', { 'do': 'cd app && npm install' } Plug 'https://github.com/dhruvasagar/vim-table-mode' Plug 'jremmen/vim-ripgrep' +Plug 'akinsho/flutter-tools.nvim' +" Plug 'kkoomen/vim-doge', { 'do': { -> doge#install() } } " Initialize plugin system call plug#end() diff --git a/after/plugin/explorer.vim b/after/plugin/explorer.vim index 92faa42..dd6c225 100644 --- a/after/plugin/explorer.vim +++ b/after/plugin/explorer.vim @@ -25,6 +25,9 @@ nnoremap fy Telescope neoclip nnoremap fs Telescope ultisnips nnoremap fq Telescope quickfix +nnoremap fh Telescope search_history +nnoremap fch Telescope command_history + lua << EOF local actions = require "telescope.actions" local action_state = require "telescope.actions.state" @@ -194,4 +197,5 @@ let g:nvim_tree_icons = { lua < Date: Fri, 1 Apr 2022 15:41:09 -0600 Subject: [PATCH 05/10] feat: add anyfolds plugin update config to work with nvim6 --- .vimrc | 10 +++-- after/plugin/editor.vim | 6 +++ after/plugin/explorer.vim | 88 ++++++++++++--------------------------- 3 files changed, 39 insertions(+), 65 deletions(-) diff --git a/.vimrc b/.vimrc index 246a5cf..c1330dc 100644 --- a/.vimrc +++ b/.vimrc @@ -45,8 +45,7 @@ Plug 'https://github.com/kyazdani42/nvim-tree.lua' " Language Plug 'nvim-treesitter/nvim-treesitter', {'do': ':TSUpdate'} -Plug 'sheerun/vim-polyglot' -Plug 'tami5/lspsaga.nvim', { 'branch': 'nvim51'} +Plug 'tami5/lspsaga.nvim', { 'branch': 'nvim6.0'} Plug 'editorconfig/editorconfig-vim' Plug 'https://github.com/mattn/emmet-vim.git' Plug 'https://github.com/alfredodeza/pytest.vim.git' @@ -55,7 +54,6 @@ Plug 'mfussenegger/nvim-dap-python' Plug 'Pocco81/DAPInstall.nvim' Plug 'rcarriga/nvim-dap-ui' Plug 'mhartington/formatter.nvim' -Plug 'sheerun/vim-polyglot' " Auto complete Plug 'https://github.com/onsails/lspkind-nvim.git' @@ -85,12 +83,16 @@ Plug 'MattesGroeger/vim-bookmarks' Plug 'https://github.com/tom-anders/telescope-vim-bookmarks.nvim.git' Plug 'https://github.com/AckslD/nvim-neoclip.lua.git' Plug 'sudormrfbin/cheatsheet.nvim' +Plug 'https://github.com/pseewald/vim-anyfold.git' " If you have nodejs and yarn Plug 'iamcco/markdown-preview.nvim', { 'do': 'cd app && npm install' } Plug 'https://github.com/dhruvasagar/vim-table-mode' Plug 'jremmen/vim-ripgrep' Plug 'akinsho/flutter-tools.nvim' -" Plug 'kkoomen/vim-doge', { 'do': { -> doge#install() } } +Plug 'kkoomen/vim-doge', { 'do': { -> doge#install() } } + +" Plug 'https://github.com/arcticicestudio/nord-vim.git' +Plug 'https://github.com/jcypret/nord-vim-midnight.git' " Initialize plugin system call plug#end() diff --git a/after/plugin/editor.vim b/after/plugin/editor.vim index a363aaf..97da8d6 100644 --- a/after/plugin/editor.vim +++ b/after/plugin/editor.vim @@ -228,3 +228,9 @@ EOF "============================================================================= " let g:doge_doc_standard_typescript='tsdoc' + +"============================================================================= +" ANYFOLD +"============================================================================= +" +set foldlevel=99 diff --git a/after/plugin/explorer.vim b/after/plugin/explorer.vim index dd6c225..c05880c 100644 --- a/after/plugin/explorer.vim +++ b/after/plugin/explorer.vim @@ -18,8 +18,8 @@ nnoremap fgw Telescope git_local git_grep_string nnoremap fgc Telescope git_commits nnoremap fma Telescope vim_bookmarks all nnoremap fmf Telescope vim_bookmarks current_file -nnoremap fdf Telescope lsp_document_diagnostics -nnoremap fda Telescope lsp_workspace_diagnostics +nnoremap fdf Telescope diagnostics bufnr=0 +nnoremap fda Telescope diagnostics nnoremap fc TodoTelescope nnoremap fy Telescope neoclip nnoremap fs Telescope ultisnips @@ -130,72 +130,38 @@ nnoremap nt :NvimTreeToggle nnoremap nf :NvimTreeFindFile nnoremap nr :NvimTreeRefresh -let g:nvim_tree_side = 'left' -let g:nvim_tree_auto_resize = 1 let g:nvim_tree_indent_markers = 1 -let g:nvim_tree_hide_dotfiles = 1 -let g:nvim_tree_lsp_diagnostics = 1 -let g:nvim_tree_window_picker_exclude = { - \ 'filetype': [ - \ 'notify', - \ 'packer', - \ 'qf' - \ ], - \ 'buftype': [ - \ 'terminal' - \ ] - \ } -let g:nvim_tree_ignore = [ - \'.git', - \'.cache', - \'__pycache__', - \'.pyc', - \'.pyo', - \'bower_components', - \'DS_Store', - \] -let g:nvim_tree_special_files = { - \'README.md': 1, - \'Makefile': 1, - \'MAKEFILE': 1 - \} let g:nvim_tree_show_icons = { \ 'git': 1, \ 'folders': 1, \ 'files': 1, \ 'folder_arrows': 1, \ } -let g:nvim_tree_icons = { - \ 'default': '', - \ 'symlink': '', - \ 'git': { - \ 'unstaged': "✗", - \ 'staged': "✓", - \ 'unmerged': "", - \ 'renamed': "➜", - \ 'untracked': "★", - \ 'deleted': "", - \ 'ignored': "◌" - \ }, - \ 'folder': { - \ 'arrow_open': "", - \ 'arrow_closed': "", - \ 'default': "", - \ 'open': "", - \ 'empty': "", - \ 'empty_open': "", - \ 'symlink': "", - \ 'symlink_open': "", - \ }, - \ 'lsp': { - \ 'hint': "", - \ 'info': "", - \ 'warning': "", - \ 'error': "", - \ } - \ } lua < Date: Fri, 20 May 2022 08:36:31 -0400 Subject: [PATCH 06/10] moar configs --- .vimrc | 1 + after/plugin/editor.vim | 20 ++++++++++++++++++++ 2 files changed, 21 insertions(+) diff --git a/.vimrc b/.vimrc index c1330dc..b58d78f 100644 --- a/.vimrc +++ b/.vimrc @@ -54,6 +54,7 @@ Plug 'mfussenegger/nvim-dap-python' Plug 'Pocco81/DAPInstall.nvim' Plug 'rcarriga/nvim-dap-ui' Plug 'mhartington/formatter.nvim' +Plug 'https://github.com/Hoffs/omnisharp-extended-lsp.nvim.git' " Auto complete Plug 'https://github.com/onsails/lspkind-nvim.git' diff --git a/after/plugin/editor.vim b/after/plugin/editor.vim index 97da8d6..a0c7cd9 100644 --- a/after/plugin/editor.vim +++ b/after/plugin/editor.vim @@ -234,3 +234,23 @@ let g:doge_doc_standard_typescript='tsdoc' "============================================================================= " set foldlevel=99 + +"============================================================================= +" OMNISHARP LSP +"============================================================================= +" +lua < Date: Wed, 22 Jun 2022 07:41:49 -0600 Subject: [PATCH 07/10] feat: upgrade and more changes --- .vimrc | 1 + after/plugin/editor.vim | 80 ++++++++++++++++++++++++++++++++++----- after/plugin/explorer.vim | 3 ++ after/plugin/utils.vim | 2 +- ftplugin/dart.vim | 5 +++ 5 files changed, 80 insertions(+), 11 deletions(-) diff --git a/.vimrc b/.vimrc index b58d78f..5c8c42a 100644 --- a/.vimrc +++ b/.vimrc @@ -55,6 +55,7 @@ Plug 'Pocco81/DAPInstall.nvim' Plug 'rcarriga/nvim-dap-ui' Plug 'mhartington/formatter.nvim' Plug 'https://github.com/Hoffs/omnisharp-extended-lsp.nvim.git' +Plug 'https://github.com/dart-lang/dart-vim-plugin.git' " Auto complete Plug 'https://github.com/onsails/lspkind-nvim.git' diff --git a/after/plugin/editor.vim b/after/plugin/editor.vim index a0c7cd9..fcb0c3c 100644 --- a/after/plugin/editor.vim +++ b/after/plugin/editor.vim @@ -10,7 +10,7 @@ let g:EditorConfig_exclude_patterns = ['fugitive://.*', 'scp://.*'] augroup Format autocmd! - autocmd BufWritePost *.js,*.jsx,*.tsx,*.ts,*.py FormatWrite + autocmd BufWritePost *.js,*.jsx,*.tsx,*.ts,*.py,*.json,*.dart FormatWrite augroup END lua << EOF @@ -24,12 +24,52 @@ local node_formatters = { end, } +local json_formatter = { + function() + return { + exe = "prettier", + args = {"--stdin-filepath", vim.fn.fnameescape(vim.api.nvim_buf_get_name(0)), "--double-quote"}, + stdin = true + } + end +} + +local dart_formatter = { + function() + return { + exe = "~/projects/taxfyle-mobile/flutter/bin/dart", + args = {"format"}, + stdin = true + } + end +} + require "formatter".setup { filetype = { typescript = node_formatters, javascript = node_formatters, javascriptreact = node_formatters, typescriptreact = node_formatters, + dart = dart_formatter, + lua = { + -- Pick from defaults: + require('formatter.filetypes.lua').stylua, + + -- ,or define your own: + function() + return { + exe = "stylua", + args = { + "--search-parent-directories", + "--stdin-filepath", + util.escape_path(util.get_current_buffer_file_path()), + "--", + "-", + }, + stdin = true, + } + end + }, python = { function() return { @@ -38,7 +78,8 @@ require "formatter".setup { stdin = true, } end - } + }, + json = json_formatter, } } EOF @@ -85,7 +126,8 @@ require("nvim-treesitter.configs").setup { indent = { enable = false, }, - ensure_installed = "maintained", + ignore_install = { "phpdoc" }, + ensure_installed = "all", } EOF "============================================================================= @@ -105,6 +147,9 @@ nnoremap lua require('lspsaga.action').smart_scroll_with_saga nnoremap lua require('lspsaga.action').smart_scroll_with_saga(-1) nnoremap cd :Lspsaga show_line_diagnostics +nnoremap gdj :Lspsaga diagnostic_jump_next +nnoremap gdk :Lspsaga diagnostic_jump_prev + lua << EOF require("lspsaga").init_lsp_saga { error_sign = '', @@ -210,9 +255,9 @@ require('lspconfig').pyright.setup { capabilities = require("cmp_nvim_lsp").update_capabilities(vim.lsp.protocol.make_client_capabilities()), } -require('lspconfig').omnisharp.setup { - cmd = { '/usr/local/share/omnisharp/run', "--languageserver", "--hostPID", tostring(vim.fn.getpid())}, -} +-- require('lspconfig').omnisharp.setup { + -- cmd = { '/usr/local/share/omnisharp/run', "--languageserver", "--hostPID", tostring(vim.fn.getpid())}, +-- } EOF "============================================================================= @@ -239,16 +284,31 @@ set foldlevel=99 " OMNISHARP LSP "============================================================================= " + lua <fq Telescope quickfix nnoremap fh Telescope search_history nnoremap fch Telescope command_history +nnoremap fmc Telescope flutter commands + lua << EOF local actions = require "telescope.actions" local action_state = require "telescope.actions.state" @@ -69,6 +71,7 @@ require'telescope'.setup { require('telescope').load_extension('fzf') require('telescope').load_extension('vim_bookmarks') +require("telescope").load_extension("flutter") require('telescope').load_extension('neoclip') require('telescope').load_extension('ultisnips') diff --git a/after/plugin/utils.vim b/after/plugin/utils.vim index da87d11..5332bd8 100644 --- a/after/plugin/utils.vim +++ b/after/plugin/utils.vim @@ -20,7 +20,7 @@ nmap rp RestNvimPreview lua << EOF require"rest-nvim".setup { - result_split_horizontal = true, + result_split_horizontal = false, skip_ssl_verification = true, } EOF diff --git a/ftplugin/dart.vim b/ftplugin/dart.vim index f65bea3..7526298 100644 --- a/ftplugin/dart.vim +++ b/ftplugin/dart.vim @@ -1,3 +1,8 @@ +set softtabstop=2 +set sw=2 +set ts=2 + + augroup fl_dart autocmd! autocmd Syntax dart highlight default link dartFlutterClasses Type From e82302af89fa3a44073e086cafe438d72185423a Mon Sep 17 00:00:00 2001 From: Jose Blanco Date: Tue, 18 Apr 2023 08:45:55 -0600 Subject: [PATCH 08/10] feat: update to support nvim 0.9.0 --- .vimrc | 9 ++++++++- after/plugin/editor.vim | 18 +++++++++--------- after/plugin/explorer.vim | 4 ++-- after/plugin/look-and-feel.vim | 22 ++++++++++++++++++++++ 4 files changed, 41 insertions(+), 12 deletions(-) diff --git a/.vimrc b/.vimrc index 5c8c42a..fac6355 100644 --- a/.vimrc +++ b/.vimrc @@ -96,6 +96,12 @@ Plug 'kkoomen/vim-doge', { 'do': { -> doge#install() } } " Plug 'https://github.com/arcticicestudio/nord-vim.git' Plug 'https://github.com/jcypret/nord-vim-midnight.git' +Plug 'kamykn/spelunker.vim' +Plug 'kamykn/popup-menu.nvim' + +" Copilot +Plug 'https://github.com/github/copilot.vim.git' + " Initialize plugin system call plug#end() @@ -109,7 +115,8 @@ call plug#end() :set more " Performance boosters -:set nocursorline +:set cursorline cul +:set cursorcolumn cuc :set lazyredraw :set re=1 :set noshowcmd diff --git a/after/plugin/editor.vim b/after/plugin/editor.vim index fcb0c3c..781cef4 100644 --- a/after/plugin/editor.vim +++ b/after/plugin/editor.vim @@ -201,16 +201,16 @@ EOF " LSP-CMP "============================================================================= lua <fmc Telescope flutter commands lua << EOF local actions = require "telescope.actions" local action_state = require "telescope.actions.state" -local git_pickers = require'telescope.builtin.git' -local internal_pickers = require'telescope.builtin.internal' +local git_pickers = require'telescope.builtin.__git' +local internal_pickers = require'telescope.builtin.__internal' local diffview = require"diffview" local git_utils = require'utils.git' diff --git a/after/plugin/look-and-feel.vim b/after/plugin/look-and-feel.vim index 5cdb6d0..42e7e25 100644 --- a/after/plugin/look-and-feel.vim +++ b/after/plugin/look-and-feel.vim @@ -31,3 +31,25 @@ let g:diminactive_enable_focus = 1 "============================================================================= hi illuminatedWord cterm=underline gui=underline + +"============================================================================= +" SPELUNKER +"============================================================================= + +" Option to disable word checking. +" Disable URI checking. (default: 0) +let g:spelunker_disable_uri_checking = 1 + +" Disable email-like words checking. (default: 0) +let g:spelunker_disable_email_checking = 1 + +"============================================================================= +" COPILOT +"============================================================================= + +lua << EOF + vim.g.copilot_no_tab_map = true + vim.api.nvim_set_keymap( + "i", "", 'copilot#Accept("")', { silent = true, expr = true } + ) +EOF From e1571b3fd7392a6975eecccfc84c9c55a6da9ab2 Mon Sep 17 00:00:00 2001 From: Jose Blanco Date: Wed, 9 Aug 2023 15:57:22 -0600 Subject: [PATCH 09/10] chore: update packages --- .vimrc | 4 +-- after/plugin/explorer.vim | 1 - after/plugin/git.vim | 57 +++++++++++++++++++++++---------------- 3 files changed, 36 insertions(+), 26 deletions(-) diff --git a/.vimrc b/.vimrc index fac6355..ac6d395 100644 --- a/.vimrc +++ b/.vimrc @@ -21,7 +21,7 @@ Plug 'https://github.com/neovim/nvim-lspconfig' Plug 'https://github.com/tpope/vim-fugitive.git' Plug 'https://github.com/tommcdo/vim-fugitive-blame-ext.git' Plug 'https://github.com/sodapopcan/vim-twiggy.git' -Plug 'lewis6991/gitsigns.nvim' +Plug 'https://github.com/lewis6991/gitsigns.nvim' Plug 'https://github.com/rhysd/git-messenger.vim.git' Plug 'https://github.com/ruanyl/vim-gh-line' Plug 'sindrets/diffview.nvim' @@ -45,7 +45,7 @@ Plug 'https://github.com/kyazdani42/nvim-tree.lua' " Language Plug 'nvim-treesitter/nvim-treesitter', {'do': ':TSUpdate'} -Plug 'tami5/lspsaga.nvim', { 'branch': 'nvim6.0'} +Plug 'tami5/lspsaga.nvim' Plug 'editorconfig/editorconfig-vim' Plug 'https://github.com/mattn/emmet-vim.git' Plug 'https://github.com/alfredodeza/pytest.vim.git' diff --git a/after/plugin/explorer.vim b/after/plugin/explorer.vim index f63b1d0..5898b23 100644 --- a/after/plugin/explorer.vim +++ b/after/plugin/explorer.vim @@ -161,7 +161,6 @@ require'nvim-tree'.setup { "bower_components", "DS_Store", ".git", - ".cache", ".pyc", ".pyo" } diff --git a/after/plugin/git.vim b/after/plugin/git.vim index fd999fc..0c19764 100644 --- a/after/plugin/git.vim +++ b/after/plugin/git.vim @@ -117,29 +117,6 @@ require('gitsigns').setup { numhl = true, -- Toggle with `:Gitsigns toggle_numhl` linehl = false, -- Toggle with `:Gitsigns toggle_linehl` word_diff = false, -- Toggle with `:Gitsigns toggle_word_diff` - keymaps = { - -- Default keymap options - noremap = true, - - ['n ghj'] = { expr = true, "&diff ? ']c' : 'lua require\"gitsigns.actions\".next_hunk()'"}, - ['n ghk'] = { expr = true, "&diff ? '[c' : 'lua require\"gitsigns.actions\".prev_hunk()'"}, - - ['n ghs'] = 'lua require"gitsigns".stage_hunk()', - ['v ghs'] = 'lua require"gitsigns".stage_hunk({vim.fn.line("."), vim.fn.line("v")})', - ['n ghu'] = 'lua require"gitsigns".undo_stage_hunk()', - ['n ghr'] = 'lua require"gitsigns".reset_hunk()', - ['v ghr'] = 'lua require"gitsigns".reset_hunk({vim.fn.line("."), vim.fn.line("v")})', - ['n ghR'] = 'lua require"gitsigns".reset_buffer()', - ['n ghp'] = 'lua require"gitsigns".preview_hunk()', - ['n ghb'] = 'lua require"gitsigns".blame_line(true)', - ['n ghS'] = 'lua require"gitsigns".stage_buffer()', - ['n ghU'] = 'lua require"gitsigns".reset_buffer_index()', - ['n gha'] = 'lua require"gitsigns".setloclist()', - - -- Text objects - ['o ih'] = ':lua require"gitsigns.actions".select_hunk()', - ['x ih'] = ':lua require"gitsigns.actions".select_hunk()' - }, watch_index = { interval = 1000, follow_files = true @@ -169,5 +146,39 @@ require('gitsigns').setup { yadm = { enable = false }, + on_attach = function(bufnr) + local gs = package.loaded.gitsigns + + local function map(mode, l, r, opts) + opts = opts or {} + opts.buffer = bufnr + vim.keymap.set(mode, l, r, opts) + end + + map('n', 'ghk', gs.preview_hunk) + map('n', 'ghj', gs.next_hunk) + + map('n', 'ghs', gs.stage_hunk) + map('v', 'ghs', function() gs.stage_hunk {vim.fn.line("."), vim.fn.line("v")} end) + + map('n', 'ghu', gs.undo_stage_hunk) + + map('n', 'ghr', gs.reset_hunk) + map('v', 'ghr', function() gs.reset_hunk {vim.fn.line("."), vim.fn.line("v")} end) + + map('n', 'ghR', gs.reset_buffer) + map('n', 'ghp', gs.preview_hunk) + map('n', 'ghb', function() gs.blame_line{full=true} end) + map('n', 'ghB', gs.toggle_current_line_blame) + map('n', 'ghd', gs.diffthis) + map('n', 'ghD', function() gs.diffthis('~') end) + map('n', 'ghS', gs.stage_buffer) + map('n', 'ghU', gs.reset_buffer_index) + map('n', 'gha', gs.setloclist) + + -- Text objects + map('o', 'ih', gs.select_hunk) + map('x', 'ih', gs.select_hunk) + end } EOF From 231e514c2969d3bc2d6fb9533e9bccea806be830 Mon Sep 17 00:00:00 2001 From: Jose Blanco Date: Thu, 10 Aug 2023 16:06:19 -0600 Subject: [PATCH 10/10] chore: implement formatter for djangohtml --- after/plugin/editor.vim | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/after/plugin/editor.vim b/after/plugin/editor.vim index 781cef4..a8689f2 100644 --- a/after/plugin/editor.vim +++ b/after/plugin/editor.vim @@ -10,7 +10,7 @@ let g:EditorConfig_exclude_patterns = ['fugitive://.*', 'scp://.*'] augroup Format autocmd! - autocmd BufWritePost *.js,*.jsx,*.tsx,*.ts,*.py,*.json,*.dart FormatWrite + autocmd BufWritePost *.js,*.jsx,*.tsx,*.ts,*.py,*.json,*.dart,*.html FormatWrite augroup END lua << EOF @@ -44,6 +44,16 @@ local dart_formatter = { end } +local htmldjango_formatter = { + function() + return { + exe = "djlint", + args = {"--reformat", "--preserve-blank-lines", "-"}, + stdin = true + } + end +} + require "formatter".setup { filetype = { typescript = node_formatters, @@ -80,6 +90,7 @@ require "formatter".setup { end }, json = json_formatter, + htmldjango = htmldjango_formatter, } } EOF