From b245b9b4d3b2af9e2751c0721e17378f8ad07f99 Mon Sep 17 00:00:00 2001 From: Nachuan Tang Date: Sat, 4 Feb 2023 18:36:33 -0500 Subject: [PATCH] replace some plugins for nvim --- .vimrc.bundles | 34 +++++++++++++++++++---- .vimrc.lua | 74 +++++++++++++++++++++++++++++++++++++++++++++++++- 2 files changed, 101 insertions(+), 7 deletions(-) diff --git a/.vimrc.bundles b/.vimrc.bundles index bd6a0d6..e3d3c0d 100644 --- a/.vimrc.bundles +++ b/.vimrc.bundles @@ -55,11 +55,6 @@ Plug 'jiangmiao/auto-pairs' Plug 'mg979/vim-visual-multi' - Plug 'vim-airline/vim-airline' - Plug 'vim-airline/vim-airline-themes' - - " The bottom buffer display - Plug 'bling/vim-bufferline' Plug 'easymotion/vim-easymotion' Plug 'vim-scripts/restore_view.vim' @@ -77,10 +72,19 @@ " put text in neibouring tmux pane into auto complete Plug 'wellle/tmux-complete.vim' + Plug 'NoahTheDuke/vim-just' Plug 'ludovicchabant/vim-gutentags', { 'for': ['c', 'cpp'] } Plug 'lambdalisue/readablefold.vim' + " only work with vim + if g:vim_type == 'vim' + Plug 'vim-airline/vim-airline' + Plug 'vim-airline/vim-airline-themes' + endif + + " The bottom buffer display + Plug 'bling/vim-bufferline' " only work with nvim > 0.5 " For other versions, just loading the plugin may " cause error @@ -92,12 +96,19 @@ Plug 'EdenEast/nightfox.nvim' Plug 'projekt0n/github-nvim-theme' + Plug 'nvim-lualine/lualine.nvim' + " If you want to have icons in your statusline choose one of these + Plug 'kyazdani42/nvim-web-devicons' + " partial code execution " Plug 'michaelb/sniprun', {'do': 'bash install.sh'} endif if g:vim_version >= 0.7 Plug 'nvim-treesitter/nvim-treesitter', {'do': ':TSUpdate'} endif + if g:vim_version >= 0.8 + Plug 'nvim-tree/nvim-tree.lua' + endif endif call plug#end() @@ -192,7 +203,7 @@ endif " } " NerdTree { - if isdirectory(expand(plugin_dir . "/nerdtree")) + if g:vim_type == 'vim' && isdirectory(expand(plugin_dir . "/nerdtree")) let g:NERDShutUp=1 " work around for nerdtree bug: https://github.com/preservim/nerdtree/issues/1321 @@ -211,6 +222,17 @@ endif let NERDTreeKeepTreeInNewTab = 1 endif " } + + " nvim-tree.lua { + if g:vim_type == 'nvim' && isdirectory(expand(plugin_dir . "/nvim-tree.lua")) + + + nnoremap e :NvimTreeFindFileToggle + nnoremap r :NvimTreeRefresh + " nnoremap e :NvimTreeFindFile + + endif + " } "if has('nvim') && str2float(g:nvim_version) >= 0.5 && isdirectory(expand(plugin_dir . "/lualine.nvim")) " nvim-lualine/lualine.nvim { diff --git a/.vimrc.lua b/.vimrc.lua index 8b2b7db..db50cb1 100644 --- a/.vimrc.lua +++ b/.vimrc.lua @@ -1,5 +1,5 @@ -require'nvim-treesitter.configs'.setup { +require('nvim-treesitter.configs').setup { -- ensure_installed = { "c", "bash", "lua" }, sync_install = false, auto_install = true, @@ -9,3 +9,75 @@ require'nvim-treesitter.configs'.setup { additional_vim_regex_highlighting = false, }, } + +require('lualine').setup { + sections = { + lualine_a = {'mode'}, + lualine_b = {}, + lualine_c = { + { + 'buffers', + mode = 4, + } + }, + -- lualine_x = {'encoding', 'fileformat', 'filetype'}, + lualine_x = {'encoding'}, + lualine_y = {}, + lualine_z = {'location'} + }, + -- tabline = { + -- lualine_a = { + -- { + -- 'buffers', + -- mode = 4, + -- } + -- }, + -- lualine_b = {}, + -- lualine_c = {}, + -- lualine_x = {}, + -- lualine_y = {}, + -- lualine_z = {'tabs'} + -- }, + -- winbar = { + -- lualine_a = {}, + -- lualine_b = {}, + -- lualine_c = {'filename'}, + -- lualine_x = {}, + -- lualine_y = {}, + -- lualine_z = {} + -- }, +} + +-- nvim-tree configuration +-- + +-- disable netrw at the very start of your init.lua (strongly advised) +vim.g.loaded_netrw = 1 +vim.g.loaded_netrwPlugin = 1 + +-- set termguicolors to enable highlight groups +vim.opt.termguicolors = true + +-- setup with some options +require("nvim-tree").setup({ + sort_by = "case_sensitive", + view = { + width = 30, + mappings = { + list = { + { key = "C-[", action = "dir_up" }, + { key = "C-]", action = "cd" }, + { key = "", action = "toggle_file_info" }, + }, + }, + }, + renderer = { + group_empty = true, + }, + filters = { + dotfiles = false, + }, +}) + +-- +-- nvim-tree configuration end