diff --git a/.vimrc b/.vimrc index 472a426..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,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' Plug 'editorconfig/editorconfig-vim' Plug 'https://github.com/mattn/emmet-vim.git' Plug 'https://github.com/alfredodeza/pytest.vim.git' @@ -55,6 +54,8 @@ 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' +Plug 'https://github.com/dart-lang/dart-vim-plugin.git' " Auto complete Plug 'https://github.com/onsails/lspkind-nvim.git' @@ -84,9 +85,22 @@ 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 '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() @@ -101,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 @@ -154,7 +169,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..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,*.ts,*.py FormatWrite + autocmd BufWritePost *.js,*.jsx,*.tsx,*.ts,*.py,*.json,*.dart,*.html FormatWrite augroup END lua << EOF @@ -24,11 +24,62 @@ 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 +} + +local htmldjango_formatter = { + function() + return { + exe = "djlint", + args = {"--reformat", "--preserve-blank-lines", "-"}, + 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 { @@ -37,11 +88,28 @@ require "formatter".setup { stdin = true, } end - } + }, + json = json_formatter, + htmldjango = htmldjango_formatter, } } 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 "============================================================================= @@ -51,9 +119,8 @@ set foldexpr=nvim_treesitter#foldexpr() set foldminlines=50 set foldnestmax=2 -lua < 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 = '', @@ -154,16 +212,16 @@ EOF " LSP-CMP "============================================================================= lua <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 @@ -15,18 +18,36 @@ 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 +nnoremap 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" -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' +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 = { @@ -50,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') @@ -111,71 +133,37 @@ 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 <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 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 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