From 931adaff3bd5c4c9e14c1ebf540e1db2596ead6d Mon Sep 17 00:00:00 2001 From: Nachuan Tang Date: Tue, 28 Feb 2023 02:28:07 -0500 Subject: [PATCH] add new plugins --- .vimrc | 2 +- .vimrc.bundles | 37 ++++++++++++++++++++++-------- .vimrc.lua | 62 +++++++++++++++++++++++++++++++++++++++++++++++++- 3 files changed, 89 insertions(+), 12 deletions(-) diff --git a/.vimrc b/.vimrc index f264f3f..0beb71f 100644 --- a/.vimrc +++ b/.vimrc @@ -57,7 +57,7 @@ set hidden " Allow buffer switching without saving set iskeyword-=. " '.' is an end of word designator set iskeyword-=# " '#' is an end of word designator - set iskeyword-=- " '-' is an end of word designator + set iskeyword+=- " let '-' not be an end of word designator "set iskeyword-=_ " '_' is an end of word designator " Instead of reverting the cursor to the last position in the buffer, we diff --git a/.vimrc.bundles b/.vimrc.bundles index 56ddd5d..912f990 100644 --- a/.vimrc.bundles +++ b/.vimrc.bundles @@ -45,32 +45,26 @@ Plug 'gelguy/wilder.nvim' " To use Python remote plugin features in Vim, can be skipped - " Plug 'roxma/nvim-yarp' - " Plug 'roxma/vim-hug-neovim-rpc' + Plug 'roxma/nvim-yarp' + Plug 'roxma/vim-hug-neovim-rpc' endif Plug 'dstein64/vim-startuptime' Plug 'simeji/winresizer' Plug 'rust-lang/rust.vim', { 'for': ['rust'] } - Plug 'tpope/vim-surround' + Plug 'machakann/vim-sandwich' Plug 'rhysd/conflict-marker.vim' Plug 'jiangmiao/auto-pairs' Plug 'mg979/vim-visual-multi' + Plug 'RRethy/vim-illuminate' "Plug 'easymotion/vim-easymotion' Plug 'vim-scripts/restore_view.vim' Plug 'mhinz/vim-startify' Plug 'christoomey/vim-tmux-navigator' - if executable('fzf') - " fzf#install() makes sure that you have the latest binary, comment out because I don't want it to install binary for me - Plug 'junegunn/fzf' ", { 'do': { -> fzf#install() } } - Plug 'junegunn/fzf.vim' - Plug 'antoinemadec/coc-fzf' - endif - Plug 'NLKNguyen/papercolor-theme' Plug 'airblade/vim-rooter' @@ -83,6 +77,13 @@ " only work with vim if g:vim_type == 'vim' set encoding=UTF-8 + + if executable('fzf') + Plug 'junegunn/fzf', { 'do': { -> fzf#install() } } + Plug 'junegunn/fzf.vim' + Plug 'antoinemadec/coc-fzf' + endif + Plug 'scrooloose/nerdtree', { 'on' : ['NERDTreeToggle', 'NERDTreeFind'] } Plug 'tiagofumo/vim-nerdtree-syntax-highlight' Plug 'vim-airline/vim-airline' @@ -115,6 +116,14 @@ if g:vim_version >= 0.7 Plug 'nvim-treesitter/nvim-treesitter', {'do': ':TSUpdate'} + " for telescope + Plug 'nvim-lua/plenary.nvim' + Plug 'nvim-telescope/telescope.nvim', { 'tag': '0.1.x' } + if executable('make') + " c plugin for telescope to make it faster + Plug 'nvim-telescope/telescope-fzf-native.nvim', { 'do': 'make' } + endif + " comment out this plugin if the machine doesn't have required " font install Plug 'nvim-tree/nvim-web-devicons' @@ -147,6 +156,14 @@ endfunction endif " } + if HasPlug('vim-illuminate') + let g:Illuminate_ftHighlightGroups = { + \ 'vim': ['vimVar', 'vimString', 'vimLineComment', + \ 'vimFuncName', 'vimFunction', 'vimUserFunc', 'vimFunc'] + \ } + let g:Illuminate_ftblacklist = ['nerdtree', 'help'] + endif + if HasPlug('wilder.nvim') call wilder#setup({ \ 'modes': [':'], diff --git a/.vimrc.lua b/.vimrc.lua index 12f356a..015b254 100644 --- a/.vimrc.lua +++ b/.vimrc.lua @@ -4,6 +4,64 @@ local vim_version_minor = vim_version['minor'] -- debug -- print(vim.inspect(version)) -- +local function vim_illuminate_config() + require('illuminate').configure({ + providers = { + 'lsp', + 'treesitter', + 'regex', + }, + delay = 100, + filetype_overrides = {}, + filetypes_denylist = { + 'dirvish', + 'fugitive', + 'NvimTree', + 'help', + }, + filetypes_allowlist = {}, + modes_denylist = {}, + modes_allowlist = {}, + providers_regex_syntax_denylist = {}, + providers_regex_syntax_allowlist = {}, + under_cursor = true, + large_file_cutoff = nil, + large_file_overrides = nil, + min_count_to_highlight = 1, + }) +end + +local function telescope_config() + if vim.fn.HasPlug('telescope-fzf-native.nvim') then + require('telescope').setup { + extensions = { + fzf = { + fuzzy = true, -- false will only do exact matching + override_generic_sorter = true, + override_file_sorter = true, + case_mode = "smart_case", -- or "ignore_case" or "respect_case" + } + } + } + require('telescope').load_extension('fzf') + end + + local builtin = require('telescope.builtin') + + vim.keymap.set('n', 'f', builtin.find_files, {}) + -- need to install ripgrep + vim.keymap.set('n', 'r', builtin.live_grep, {}) + -- vim.keymap.set('n', 'fb', builtin.buffers, {}) + -- vim.keymap.set('n', 'fh', builtin.help_tags, {}) + vim.api.nvim_create_autocmd( + "User", + { + pattern = "TelescopePreviewerLoaded", + command = "setlocal wrap number" + } + ) +end + local function github_theme_config() -- Example config in Lua require("github-theme").setup({ @@ -172,6 +230,7 @@ local function nvim_tree_config() end if vim_version_minor >= 5 then + vim_illuminate_config() transparent_config() lualine_config() github_theme_config() @@ -179,7 +238,8 @@ if vim_version_minor >= 5 then end if vim_version_minor >= 7 then nvim_treesitter_config() - color_picker_nvim_config() + telescope_config() + -- color_picker_nvim_config() -- lsp_zero_config() end if vim_version_minor >= 8 then