nvim config

发布时间 2023-03-31 19:03:49作者: ploolq

" echo $MYVIMRC
" source $MYVIMRC

set enc=utf-8
set fencs=utf-8,gbk,big5,cp936,gb18030,gb2312,utf-16
set fenc=utf-8
set shortmess=atI

"禁止bell
set belloff=all
set visualbell
set t_vb=

let mapleader = "\<Space>"
inoremap jj <ESC>


"-------------------------------------------------------------------------------
" 去除行尾空白符 bronson/vim-trailing-whitespace
"-------------------------------------------------------------------------------
"This plugin causes trailing whitespace to be highlighted in red.

"To fix the whitespace errors, call :FixWhitespace.

"By default it operates on the entire file.

"Pass a range (or use V to select some lines)
"to restrict the portion of the file that gets fixed.

"fun! TrimWhiteSpace()
"    let l:save = winsaveview()
"    keeppatterns %s/\s\+$//e
"    call winrestview(l:save)
"endfun

"noremap <leader>t :call :FixWhitespace <CR>

"-------------------------------------------------------------------------------
" 注释 vim-commentary
"-------------------------------------------------------------------------------
" toggle注释单行
" normal mode: gcc

" toggle 多行注释
" 首先进入visual mode,然后选择。gc toggle注释

"-------------------------------------------------------------------------------
" 缩进
"-------------------------------------------------------------------------------
"  visual mode
"  shift+< 然后 > 增加缩进
"  shift+> 然后 > 减少缩进

" normal mode
" shift + > + >
" shift + < + <

"-------------------------------------------------------------------------------
" 大小写转换
"-------------------------------------------------------------------------------
"  visual mode
"  ~

"-------------------------------------------------------------------------------
"  视图
"-------------------------------------------------------------------------------
" normal mode
" <C-O>  <C-I> zz
" <C-E>  <C-D>
" <C-Y>  <C-U>
" G      gg

"-------------------------------------------------------------------------------
"  选择
"-------------------------------------------------------------------------------
" Make vaa select the entire file...
xmap aa VGo1G

" -------------------------------------------------------------------------------
" 搜索 yggdroot/leaderf
" -------------------------------------------------------------------------------
" 编译C语言扩展,搜索会快10倍
":LeaderfInstallCExtension

"<leader>f 打开窗口
"<C-R> 切换搜索模式,fuzzy或regex
"Ctrl j k 在搜索结果中选择
"<C-T> 在新标签页打开文件
"<C-]> 竖向分隔窗口打开文件

" let g:Lf_WindowPosition = 'popup'
"  let g:Lf_PreviewInPopup = 1
"  let g:Lf_WindowHeight = 0.85
"  let g:Lf_DefaultExternalTool = 'rg'
"  let g:Lf_ShowHidden = 1

"noremap <A-n> :Leaderf file --no-ignore <CR>
"noremap <A-m> :Leaderf rg --no-ignore<CR>

"  noremap <A-n> :Leaderf file <CR>
"  noremap <A-m> :Leaderf rg <CR>
"<C-P> 预览当前文件
"Ctrl H L 滚动预览窗口
"  let g:Lf_CommandMap = {'<C-Up>': ['<C-L>'], '<C-Down>': ['<C-H>']}

"-------------------------------------------------------------------------------
" copy paste
"-------------------------------------------------------------------------------
"https://ramezanpour.net/post/2022/07/24/access-os-clipboard-in-neovim

" macOS
set clipboard+=unnamedplus

" windows
" https://github.com/equalsraf/win32yank

" Linux Wayland
" sudo apt install wl-clipboard

" linux X11
" https://github.com/astrand/xclip

"-------------------------------------------------------------------------------
" 字体 行号 主题
"-------------------------------------------------------------------------------
" 不与 Vi 兼容(采用 Vim 自己的操作命令)
set nocompatible

"行号
set number

"自动保存
"Plug '907th/vim-auto-save'
let g:auto_save = 1

" 字体
 if has('gui_running')
    if has("win16") || has("win32") || has("win95") || has("win64")
        set guifont=Sarasa_Mono_Fixed:h14
    else
        set guifont=Sarasa\ Mono\ Fixed\ 14
    endif
endif

" 在状态栏显示正在输入的命令
set showcmd

set mouse=a

" 启用256色
set t_Co=256

" 按下回车键后,下一行的缩进会自动跟上一行的缩进保持一致
set autoindent

" 由于 Tab 键在不同的编辑器缩进不一致,该设置自动将 Tab 转为空格。
set expandtab
" tab相关变更
" 设置Tab键的宽度,等同的空格个数
set tabstop=4
" 每一次缩进对应的空格数
set shiftwidth=4
" 按退格键时可以一次删掉 4 个空格
set softtabstop=4

" 关闭自动折行
set nowrap

" 在状态栏显示光标的当前位置(位于哪一行哪一列)。
set  ruler
" 突出显示当前列
"set cursorcolumn
" 突出显示当前行
set cursorline

" 光标遇到圆括号、方括号、大括号时,自动高亮对应的另一个圆括号、方括号和大括号。
set showmatch

set history=10000

" 打开文件监视。如果在编辑过程中文件发生外部改变(比如被别的编辑器编辑了),就会发出提示。
set autoread

" undo redo
" u    <C-R>

"Square up visual selections...
set virtualedit=block

" Make BS/DEL work as expected in visual modes (i.e. delete the selected text)...
xmap <BS> x

" Prefer vertical orientation when using :diffsplit
set diffopt+=vertical

"可随时用倒退键删除
set backspace=2


"行号
map <leader>n  :set invnumber <CR>
"行折叠
map <leader>w  :set invwrap <CR>

"窗口分隔
map <leader>=  :vsp <CR>
map <leader>-  :sp <CR>

"窗口跳转
"<C-W> jkhl

"关闭当前window
nnoremap <C-q> <ESC>:q <CR>
inoremap <C-q> <ESC>:q <CR>


"新tab中打开本文件
inoremap <C-T> <ESC>:tabnew %<CR> i
nnoremap <C-T> <ESC>:tabnew %<CR>

" 创建新tab
inoremap <C-N> <C-O>:tabnew <CR>
nnoremap <C-N> :tabnew <CR> i


"-------------------------------------------------------------------------------
" 安装插件
"-------------------------------------------------------------------------------
call plug#begin()
"file explorer
Plug 'scrooloose/nerdtree'
Plug 'Xuyuanp/nerdtree-git-plugin'

" search file, content
Plug 'nvim-lua/plenary.nvim'
Plug 'nvim-telescope/telescope.nvim', { 'branch': '0.1.x' }
Plug 'nvim-telescope/telescope-fzf-native.nvim', { 'do': 'cmake -S. -Bbuild -DCMAKE_BUILD_TYPE=Release && cmake --build build --config Release && cmake --install build --prefix build' }

" hight light
Plug 'nvim-treesitter/nvim-treesitter', {'do': ':TSUpdate'}
Plug 'RRethy/vim-illuminate'

" auto compeletion
Plug 'neovim/nvim-lspconfig'
Plug 'hrsh7th/cmp-nvim-lsp'
Plug 'hrsh7th/nvim-cmp'
Plug 'hrsh7th/cmp-buffer'
Plug 'hrsh7th/cmp-path'
Plug 'hrsh7th/cmp-cmdline'

Plug 'williamboman/mason.nvim', { 'do': ':MasonUpdate' }

" LSP
Plug 'neoclide/coc.nvim', {'branch': 'release'}
Plug 'scrooloose/syntastic'

" DAP
Plug 'mfussenegger/nvim-dap'
Plug 'rcarriga/nvim-dap-ui'
Plug 'theHamsta/nvim-dap-virtual-text'
Plug 'ldelossa/nvim-dap-projects'

" Theme
Plug 'Mofiqul/vscode.nvim'
"  Plug 'navarasu/onedark.nvim'
"  Plug 'sickill/vim-monokai'

" icon
Plug 'nvim-tree/nvim-web-devicons'

" Project
Plug 'ahmedkhalf/project.nvim'

" column limit
Plug 'm4xshen/smartcolumn.nvim'

" status bar
Plug 'nvim-lualine/lualine.nvim'
" If you want to have icons in your statusline choose one of these
Plug 'nvim-tree/nvim-web-devicons'

" tab
Plug 'akinsho/bufferline.nvim', { 'tag': 'v3.*' }

" window
Plug 'sindrets/winshift.nvim'

" register
Plug 'gennaro-tedesco/nvim-peekup'

" color
Plug 'NvChad/nvim-colorizer.lua'

" start up
Plug 'glepnir/dashboard-nvim'

" terminal
Plug 'akinsho/toggleterm.nvim', {'tag' : '*'}

" comment
Plug 'numToStr/Comment.nvim'
Plug 'folke/todo-comments.nvim'

" UI
Plug 'MunifTanjim/nui.nvim'
Plug 'rcarriga/nvim-notify'
Plug 'folke/noice.nvim'

" git
Plug 'f-person/git-blame.nvim'
Plug 'sindrets/diffview.nvim'

" bookmark
Plug 'MattesGroeger/vim-bookmarks'

" scroll
Plug 'dstein64/nvim-scrollview', { 'branch': 'main' }

" mini map
Plug 'gorbit99/codewindow.nvim'

" pair
Plug 'windwp/nvim-autopairs'
Plug 'luochen1990/rainbow'
Plug 'tpope/vim-surround'

" format
Plug 'lukas-reineke/indent-blankline.nvim'
Plug 'bronson/vim-trailing-whitespace'

" ascii art
Plug 'godlygeek/tabular'

" autosave
Plug '907th/vim-auto-save'

" mouse key
Plug 'folke/which-key.nvim'

call plug#end()

"-------------------------------------------------------------------------------
"  Theme
"-------------------------------------------------------------------------------
"  syntax enable
"  colorscheme monokai

lua <<EOF
-- Lua:
-- For dark theme (neovim's default)
vim.o.background = 'dark'
-- For light theme
-- vim.o.background = 'light'

local c = require('vscode.colors').get_colors()
require('vscode').setup({
    -- Alternatively set style in setup
    -- style = 'light'

    -- Enable transparent background
    transparent = true,

    -- Enable italic comment
    italic_comments = true,

    -- Disable nvim-tree background color
    disable_nvimtree_bg = true,

    -- Override colors (see ./lua/vscode/colors.lua)
    color_overrides = {
        vscFront = '#cecece',
        vscBack = '#1c1c1c',
    },

    -- Override highlight groups (see ./lua/vscode/theme.lua)
    group_overrides = {
        -- this supports the same val table as vim.api.nvim_set_hl
        -- use colors from this colorscheme by requiring vscode.colors!
        Cursor = { fg=c.vscDarkBlue, bg=c.vscLightGreen, bold=true },
    }
})
require('vscode').load()
EOF


"  lua <<EOF
"  -- Lua
"  require('onedark').setup  {
"      -- Main options --
"      style = 'dark', -- Default theme style. Choose between 'dark', 'darker', 'cool', 'deep', 'warm', 'warmer' and 'light'
"      transparent = false,  -- Show/hide background
"      term_colors = true, -- Change terminal color as per the selected theme style
"      ending_tildes = false, -- Show the end-of-buffer tildes. By default they are hidden
"      cmp_itemkind_reverse = false, -- reverse item kind highlights in cmp menu

"      -- toggle theme style ---
"      toggle_style_key = nil, -- keybind to toggle theme style. Leave it nil to disable it, or set it to a string, for example "<leader>ts"
"      toggle_style_list = {'dark', 'darker', 'cool', 'deep', 'warm', 'warmer', 'light'}, -- List of styles to toggle between

"      -- Change code style ---
"      -- Options are italic, bold, underline, none
"      -- You can configure multiple style with comma separated, For e.g., keywords = 'italic,bold'
"      code_style = {
"          comments = 'italic',
"          keywords = 'none',
"          functions = 'bold',
"          strings = 'none',
"          variables = 'none'
"      },

"      -- Lualine options --
"      lualine = {
"          transparent = false, -- lualine center bar transparency
"      },

"      -- Custom Highlights --
"      colors = {}, -- Override default colors
"      highlights = {}, -- Override highlight groups

"      -- Plugins Config --
"      diagnostics = {
"          darker = true, -- darker colors for diagnostic
"          undercurl = true,   -- use undercurl instead of underline for diagnostics
"          background = true,    -- use background color for virtual text
"      },
"  }

"  require('onedark').load()
"  EOF

"-------------------------------------------------------------------------------
" NERDTree
"-------------------------------------------------------------------------------

"toggle panel
map <leader>e :NERDTreeToggle<CR>

let NERDTreeAutoCenter=1

let NERDTreeShowLineNumbers=1

let NERDTreeShowHidden=1

let NERDTreeWinSize=35

" 在终端启动vim时,共享NERDTree
let g:nerdtree_tabs_open_on_console_startup=1

let g:NERDTreeGitStatusIndicatorMapCustom = {
    \ "Modified"  : "✹",
    \ "Staged"    : "✚",
    \ "Untracked" : "✭",
    \ "Renamed"   : "➜",
    \ "Unmerged"  : "═",
    \ "Deleted"   : "✖",
    \ "Dirty"     : "✗",
    \ "Clean"     : "✔︎",
    \ 'Ignored'   : '☒',
    \ "Unknown"   : "?"
    \ }

"-------------------------------------------------------------------------------
" 搜索
"-------------------------------------------------------------------------------
" 搜索时,高亮显示匹配结果。
set hlsearch
"highlight clear Search

"清除高亮
map <leader>c :nohl <CR>

" 搜索设置
set ignorecase
set incsearch


"===============================================================================
" telescope.nvim
"===============================================================================
" Dep plug
" https://github.com/nvim-telescope/telescope-fzf-native.nvim
" https://github.com/nvim-treesitter/nvim-treesitter
" https://github.com/nvim-tree/nvim-web-devicons

" Dep cli
" https://github.com/BurntSushi/ripgrep
" https://github.com/sharkdp/fd

lua << EOF
local builtin = require('telescope.builtin')
vim.keymap.set('n', '<leader>ff', builtin.find_files, {})
vim.keymap.set('n', '<leader>fg', builtin.live_grep, {})
vim.keymap.set('n', '<leader>fb', builtin.buffers, {})
vim.keymap.set('n', '<leader>fh', builtin.help_tags, {})
EOF

"===============================================================================
" telescope-fzf-native.nvim
"===============================================================================
lua << EOF
-- You dont need to set any of these options. These are the default ones. Only
-- the loading is important
require('telescope').setup {
  extensions = {
    fzf = {
      fuzzy = true,                    -- false will only do exact matching
      override_generic_sorter = true,  -- override the generic sorter
      override_file_sorter = true,     -- override the file sorter
      case_mode = "smart_case",        -- or "ignore_case" or "respect_case"
                                       -- the default case_mode is "smart_case"
    }
  }
}
-- To get fzf loaded and working with telescope, you need to call
-- load_extension, somewhere after setup function:
require('telescope').load_extension('fzf')
EOF

"===============================================================================
" nvim-treesitter/nvim-treesitter
"===============================================================================
" The goal of nvim-treesitter is both to provide
" a simple and easy way to use the interface for tree-sitter in Neovim and
" to provide some basic functionality such as highlighting based on it

" :TSModuleInfo [{module}] " list information about modules state for each filetyp
" :TSUpdate {language}. To update all parsers unconditionally, use :TSUpdate all or just :TSUpdate.
lua << EOF
require('nvim-treesitter.configs').setup{
  -- A list of parser names, or "all" (the five listed parsers should always be installed)
  ensure_installed = { "c","cpp", "lua", "vim", "help", "query","bash", "c_sharp","cmake","cuda", "diff","dockerfile","dot","glsl","go","html","css","scss","tsx","sql","java","javascript","typescript","vue","yaml","json","json5","latex","llvm","make","ninja","python","rust", "regex" },

  -- Install parsers synchronously (only applied to `ensure_installed`)
  sync_install = false,

  -- Automatically install missing parsers when entering buffer
  -- Recommendation: set to false if you don't have `tree-sitter` CLI installed locally
  auto_install = true,

  -- List of parsers to ignore installing (for "all")
  ignore_install = { "javascript" },

  ---- If you need to change the installation directory of the parsers (see -> Advanced Setup)
  -- parser_install_dir = "/some/path/to/store/parsers", -- Remember to run vim.opt.runtimepath:append("/some/path/to/store/parsers")!

  highlight = {
    enable = true,

    -- NOTE: these are the names of the parsers and not the filetype. (for example if you want to
    -- disable highlighting for the `tex` filetype, you need to include `latex` in this list as this is
    -- the name of the parser)
    -- list of language that will be disabled
    disable = { "c", "rust" },
    -- Or use a function for more flexibility, e.g. to disable slow treesitter highlight for large files
    disable = function(lang, buf)
        local max_filesize = 100 * 1024 -- 100 KB
        local ok, stats = pcall(vim.loop.fs_stat, vim.api.nvim_buf_get_name(buf))
        if ok and stats and stats.size > max_filesize then
            return true
        end
    end,

    -- Setting this to true will run `:h syntax` and tree-sitter at the same time.
    -- Set this to `true` if you depend on 'syntax' being enabled (like for indentation).
    -- Using this option may slow down your editor, and you may see some duplicate highlights.
    -- Instead of true it can also be a list of languages
    additional_vim_regex_highlighting = false,
  },
}
EOF

"===============================================================================
" hrsh7th/nvim-cmp
"===============================================================================
lua <<EOF
  -- Set up nvim-cmp.
  local cmp = require'cmp'

  cmp.setup({
    snippet = {
      -- REQUIRED - you must specify a snippet engine
      expand = function(args)
        vim.fn["vsnip#anonymous"](args.body) -- For `vsnip` users.
        -- require('luasnip').lsp_expand(args.body) -- For `luasnip` users.
        -- require('snippy').expand_snippet(args.body) -- For `snippy` users.
        -- vim.fn["UltiSnips#Anon"](args.body) -- For `ultisnips` users.
      end,
    },
    window = {
      -- completion = cmp.config.window.bordered(),
      -- documentation = cmp.config.window.bordered(),
    },
    mapping = cmp.mapping.preset.insert({
      ['<C-b>'] = cmp.mapping.scroll_docs(-4),
      ['<C-f>'] = cmp.mapping.scroll_docs(4),
      ['<C-Space>'] = cmp.mapping.complete(),
      ['<C-e>'] = cmp.mapping.abort(),
      ['<CR>'] = cmp.mapping.confirm({ select = true }), -- Accept currently selected item. Set `select` to `false` to only confirm explicitly selected items.
    }),
    sources = cmp.config.sources({
      { name = 'nvim_lsp' },
      { name = 'vsnip' }, -- For vsnip users.
      -- { name = 'luasnip' }, -- For luasnip users.
      -- { name = 'ultisnips' }, -- For ultisnips users.
      -- { name = 'snippy' }, -- For snippy users.
    }, {
      { name = 'buffer' },
    })
  })

  -- Set configuration for specific filetype.
  cmp.setup.filetype('gitcommit', {
    sources = cmp.config.sources({
      { name = 'cmp_git' }, -- You can specify the `cmp_git` source if you were installed it.
    }, {
      { name = 'buffer' },
    })
  })

  -- Use buffer source for `/` and `?` (if you enabled `native_menu`, this won't work anymore).
  cmp.setup.cmdline({ '/', '?' }, {
    mapping = cmp.mapping.preset.cmdline(),
    sources = {
      { name = 'buffer' }
    }
  })

  -- Use cmdline & path source for ':' (if you enabled `native_menu`, this won't work anymore).
  cmp.setup.cmdline(':', {
    mapping = cmp.mapping.preset.cmdline(),
    sources = cmp.config.sources({
      { name = 'path' }
    }, {
      { name = 'cmdline' }
    })
  })

  -- Set up lspconfig.
  local capabilities = require('cmp_nvim_lsp').default_capabilities()
  -- Replace <YOUR_LSP_SERVER> with each lsp server you've enabled.
  --require('lspconfig')['<YOUR_LSP_SERVER>'].setup {
  --  capabilities = capabilities
  --}
EOF


"===============================================================================
"   coc-nvim
"===============================================================================
" static analysis
let g:coc_global_extensions = ['coc-marketplace', 'coc-calc' ,'coc-clangd' ,'coc-cmake' ,'coc-css' ,'coc-cssmodules' ,'coc-diagnostic' ,'coc-docker' ,'coc-eslint' ,'coc-explorer' ,'coc-floaterm' ,'coc-fzf-preview' ,'coc-git' ,'coc-glslx' ,'coc-go' ,'coc-highlight' ,'coc-html' ,'coc-html-css-support' ,'coc-htmlhint' ,'coc-java' ,'coc-json' ,'coc-lists' ,'coc-ltex' ,'coc-lua' ,'coc-markdownlint' ,'coc-nav' ,'coc-omnisharp' ,'coc-pairs' ,'coc-perl' ,'coc-powershell' ,'coc-prettier' ,'coc-pyright' ,'coc-python' ,'coc-rust-analyzer' ,'coc-sh' ,'coc-snippets' ,'coc-spell-checker' ,'coc-sql' ,'coc-stylua' ,'coc-svg' ,'coc-swagger' ,'coc-syntax' ,'coc-tsserver' ,'coc-xml' ,'coc-yaml' ,'coc-yank']
":CocList marketplace

" GoTo code navigation
nmap <silent> gd <Plug>(coc-definition)
nmap <silent> gy <Plug>(coc-type-definition)
nmap <silent> gi <Plug>(coc-implementation)
nmap <silent> gr <Plug>(coc-references)

"  lua require("mason").setup()

lua << EOF
 -- Setup language servers.
 local lspconfig = require('lspconfig')
 lspconfig.ccls.setup {
   init_options = {
     compilationDatabaseDirectory = "build";
     index = {
       threads = 0;
     };
     clang = {
       excludeArgs = { "-frounding-math"} ;
     };
   }
 }
EOF

"===============================================================================
"   dap
"===============================================================================
" debug
lua <<EOF
require('nvim-dap-projects').search_project_config()
require("dapui").setup()
require("nvim-dap-virtual-text").setup()

vim.fn.sign_define('DapBreakpoint',{ text ='?', texthl ='', linehl ='', numhl =''})
vim.fn.sign_define('DapStopped',{ text ='▶️', texthl ='', linehl ='', numhl =''})

vim.keymap.set('n', '<F5>', require 'dap'.continue)
vim.keymap.set('n', '<F10>', require 'dap'.step_over)
vim.keymap.set('n', '<F11>', require 'dap'.step_into)
vim.keymap.set('n', '<F12>', require 'dap'.step_out)
vim.keymap.set('n', '<F9>', require 'dap'.toggle_breakpoint)
EOF


"===============================================================================
"   project.nvim
"===============================================================================
lua << EOF
  require("project_nvim").setup {
-- Manual mode doesn't automatically change your root directory, so you have
  -- the option to manually do so using `:ProjectRoot` command.
  manual_mode = false,

  -- Methods of detecting the root directory. **"lsp"** uses the native neovim
  -- lsp, while **"pattern"** uses vim-rooter like glob pattern matching. Here
  -- order matters: if one is not detected, the other is used as fallback. You
  -- can also delete or rearangne the detection methods.
  detection_methods = { "lsp", "pattern" },

  -- All the patterns used to detect root dir, when **"pattern"** is in
  -- detection_methods
  patterns = { ".git", "_darcs", ".hg", ".bzr", ".svn", "Makefile", "package.json" },

  -- Table of lsp clients to ignore by name
  -- eg: { "efm", ... }
  ignore_lsp = {},

  -- Don't calculate root dir on specific directories
  -- Ex: { "~/.cargo/*", ... }
  exclude_dirs = {},

  -- Show hidden files in telescope
  show_hidden = true,

  -- When set to false, you will get a message when project.nvim changes your
  -- directory.
  silent_chdir = true,

  -- What scope to change the directory, valid options are
  -- * global (default)
  -- * tab
  -- * win
  scope_chdir = 'global',

  -- Path where project.nvim will store the project history for use in
  -- telescope
  datapath = vim.fn.stdpath("data"),
  }
EOF


"===============================================================================
"   smartcolumn.nvim
"===============================================================================
lua << EOF

local config = {
   colorcolumn = {"120"},
   disabled_filetypes = { "help", "text", "markdown" },
   custom_colorcolumn = {ruby = "120", java = { "180", "200"}},
   scope = "file",
}

require("smartcolumn").setup(config)
EOF


"===============================================================================
"   nvim-lualine/lualine.nvim
"===============================================================================
lua << EOF
require('lualine').setup {
  options = {
    icons_enabled = true,
    theme = 'auto',
    component_separators = { left = '', right = ''},
    section_separators = { left = '', right = ''},
    disabled_filetypes = {
      statusline = {},
      winbar = {},
    },
    ignore_focus = {},
    always_divide_middle = true,
    globalstatus = false,
    refresh = {
      statusline = 1000,
      tabline = 1000,
      winbar = 1000,
    }
  },
  sections = {
    lualine_a = {'mode'},
    lualine_b = {'branch', 'diff', 'diagnostics'},
    lualine_c = {'filename'},
    lualine_x = {'encoding', 'fileformat', 'filetype'},
    lualine_y = {'progress'},
    lualine_z = {'location'}
  },
  inactive_sections = {
    lualine_a = {},
    lualine_b = {},
    lualine_c = {'filename'},
    lualine_x = {'location'},
    lualine_y = {},
    lualine_z = {}
  },
  tabline = {},
  winbar = {},
  inactive_winbar = {},
  extensions = {}
}
EOF


"===============================================================================
"   sindrets/winshift.nvim
"===============================================================================
lua <<EOF
-- Lua
require("winshift").setup({
  highlight_moving_win = true,  -- Highlight the window being moved
  focused_hl_group = "Visual",  -- The highlight group used for the moving window
  moving_win_options = {
    -- These are local options applied to the moving window while it's
    -- being moved. They are unset when you leave Win-Move mode.
    wrap = false,
    cursorline = false,
    cursorcolumn = false,
    colorcolumn = "",
  },
  keymaps = {
    disable_defaults = false, -- Disable the default keymaps
    win_move_mode = {
      ["h"] = "left",
      ["j"] = "down",
      ["k"] = "up",
      ["l"] = "right",
      ["H"] = "far_left",
      ["J"] = "far_down",
      ["K"] = "far_up",
      ["L"] = "far_right",
      ["<left>"] = "left",
      ["<down>"] = "down",
      ["<up>"] = "up",
      ["<right>"] = "right",
      ["<S-left>"] = "far_left",
      ["<S-down>"] = "far_down",
      ["<S-up>"] = "far_up",
      ["<S-right>"] = "far_right",
    },
  },
  ---A function that should prompt the user to select a window.
  ---
  ---The window picker is used to select a window while swapping windows with
  ---`:WinShift swap`.
  ---@return integer? winid # Either the selected window ID, or `nil` to
  ---   indicate that the user cancelled / gave an invalid selection.
  window_picker = function()
    return require("winshift.lib").pick_window({
      -- A string of chars used as identifiers by the window picker.
      picker_chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890",
      filter_rules = {
        -- This table allows you to indicate to the window picker that a window
        -- should be ignored if its buffer matches any of the following criteria.
        cur_win = true, -- Filter out the current window
        floats = true,  -- Filter out floating windows
        filetype = {},  -- List of ignored file types
        buftype = {},   -- List of ignored buftypes
        bufname = {},   -- List of vim regex patterns matching ignored buffer names
      },
      ---A function used to filter the list of selectable windows.
      ---@param winids integer[] # The list of selectable window IDs.
      ---@return integer[] filtered # The filtered list of window IDs.
      filter_func = nil,
    })
  end,
})
EOF

"===============================================================================
"   bufferline.nvim
"===============================================================================
lua << EOF
vim.opt.termguicolors = true
require("bufferline").setup{}
EOF


"===============================================================================
"  gennaro-tedesco/nvim-peekup
"===============================================================================
let g:peekup_open = '<leader>"'


"===============================================================================
"  NvChad/nvim-colorizer.lua
"===============================================================================
lua require 'colorizer'.setup()



"===============================================================================
"  RRethy/vim-illuminate
"===============================================================================
lua <<EOF
-- default configuration
require('illuminate').configure({
    -- providers: provider used to get references in the buffer, ordered by priority
    providers = {
        'lsp',
        'treesitter',
        'regex',
    },
    -- delay: delay in milliseconds
    delay = 100,
    -- filetype_overrides: filetype specific overrides.
    -- The keys are strings to represent the filetype while the values are tables that
    -- supports the same keys passed to .configure except for filetypes_denylist and filetypes_allowlist
    filetype_overrides = {},
    -- filetypes_denylist: filetypes to not illuminate, this overrides filetypes_allowlist
    filetypes_denylist = {
        'dirvish',
        'fugitive',
    },
    -- filetypes_allowlist: filetypes to illuminate, this is overriden by filetypes_denylist
    filetypes_allowlist = {},
    -- modes_denylist: modes to not illuminate, this overrides modes_allowlist
    -- See `:help mode()` for possible values
    modes_denylist = {},
    -- modes_allowlist: modes to illuminate, this is overriden by modes_denylist
    -- See `:help mode()` for possible values
    modes_allowlist = {},
    -- providers_regex_syntax_denylist: syntax to not illuminate, this overrides providers_regex_syntax_allowlist
    -- Only applies to the 'regex' provider
    -- Use :echom synIDattr(synIDtrans(synID(line('.'), col('.'), 1)), 'name')
    providers_regex_syntax_denylist = {},
    -- providers_regex_syntax_allowlist: syntax to illuminate, this is overriden by providers_regex_syntax_denylist
    -- Only applies to the 'regex' provider
    -- Use :echom synIDattr(synIDtrans(synID(line('.'), col('.'), 1)), 'name')
    providers_regex_syntax_allowlist = {},
    -- under_cursor: whether or not to illuminate under the cursor
    under_cursor = true,
    -- large_file_cutoff: number of lines at which to use large_file_config
    -- The `under_cursor` option is disabled when this cutoff is hit
    large_file_cutoff = nil,
    -- large_file_config: config to use for large files (based on large_file_cutoff).
    -- Supports the same keys passed to .configure
    -- If nil, vim-illuminate will be disabled for large files.
    large_file_overrides = nil,
    -- min_count_to_highlight: minimum number of matches required to perform highlighting
    min_count_to_highlight = 1,
})
EOF

"===============================================================================
"   glepnir/dashboard-nvim
"===============================================================================

lua <<EOF
require('dashboard').setup {
      -- config
    }
EOF


"===============================================================================
"   akinsho/toggleterm.nvim
"===============================================================================

lua require("toggleterm").setup()


"===============================================================================
"   numToStr/Comment.nvim
"===============================================================================

lua require('Comment').setup()

lua << EOF
  require("todo-comments").setup {
    -- your configuration comes here
    -- or leave it empty to use the default settings
    -- refer to the configuration section below
  }
EOF

"===============================================================================
"   folke/noice.nvim
"===============================================================================
" :checkhealth noice
lua <<EOF
require("noice").setup({
  lsp = {
    -- override markdown rendering so that **cmp** and other plugins use **Treesitter**
    override = {
      ["vim.lsp.util.convert_input_to_markdown_lines"] = true,
      ["vim.lsp.util.stylize_markdown"] = true,
      ["cmp.entry.get_documentation"] = true,
    },
  },
  -- you can enable a preset for easier configuration
  presets = {
    bottom_search = true, -- use a classic bottom cmdline for search
    command_palette = true, -- position the cmdline and popupmenu together
    long_message_to_split = true, -- long messages will be sent to a split
    inc_rename = false, -- enables an input dialog for inc-rename.nvim
    lsp_doc_border = false, -- add a border to hover docs and signature help
  },
})
EOF

lua << EOF
require("notify").setup({
    background_colour = "#333333"
  })
EOF

"===============================================================================
"   git
"===============================================================================
let g:gitblame_enabled = 0

"===============================================================================
"   MattesGroeger/vim-bookmarks
"===============================================================================

highlight BookmarkSign ctermbg=NONE ctermfg=160
highlight BookmarkLine ctermbg=194 ctermfg=NONE
let g:bookmark_sign = '♥'
let g:bookmark_highlight_lines = 1

let g:bookmark_no_default_key_mappings = 1
nmap <Leader><Leader> <Plug>BookmarkToggle
nmap <Leader>i <Plug>BookmarkAnnotate
nmap <Leader>a <Plug>BookmarkShowAll
nmap <Leader>j <Plug>BookmarkNext
nmap <Leader>k <Plug>BookmarkPrev
nmap <Leader>c <Plug>BookmarkClear
nmap <Leader>x <Plug>BookmarkClearAll
nmap <Leader>kk <Plug>BookmarkMoveUp
nmap <Leader>jj <Plug>BookmarkMoveDown
nmap <Leader>g <Plug>BookmarkMoveToLine

let g:bookmark_save_per_working_dir = 1
let g:bookmark_auto_save = 1


" Finds the Git super-project directory based on the file passed as an argument.
function! g:BMBufferFileLocation(file)
    let filename = 'vim-bookmarks'
    let location = ''
    if isdirectory(fnamemodify(a:file, ":p:h").'/.git')
        " Current work dir is git's work tree
        let location = fnamemodify(a:file, ":p:h").'/.git'
    else
        " Look upwards (at parents) for a directory named '.git'
        let location = finddir('.git', fnamemodify(a:file, ":p:h").'/.;')
    endif
    if len(location) > 0
        return simplify(location.'/.'.filename)
    else
        return simplify(fnamemodify(a:file, ":p:h").'/.'.filename)
    endif
endfunction


"===============================================================================
"  dstein64/nvim-scrollview
"===============================================================================
lua <<EOF
require('scrollview').setup({
  excluded_filetypes = {'nerdtree'},
  current_only = true,
  winblend = 75,
  base = 'buffer',
  column = 80
})
EOF

"===============================================================================
"  gorbit99/codewindow.nvim
"===============================================================================
lua <<EOF
   local codewindow = require('codewindow')
    local config ={
  active_in_terminals = false, -- Should the minimap activate for terminal buffers
  auto_enable = false, -- Automatically open the minimap when entering a (non-excluded) buffer (accepts a table of filetypes)
  exclude_filetypes = {}, -- Choose certain filetypes to not show minimap on
  max_minimap_height = nil, -- The maximum height the minimap can take (including borders)
  max_lines = nil, -- If auto_enable is true, don't open the minimap for buffers which have more than this many lines.
  minimap_width = 20, -- The width of the text part of the minimap
  use_lsp = true, -- Use the builtin LSP to show errors and warnings
  use_treesitter = true, -- Use nvim-treesitter to highlight the code
  use_git = true, -- Show small dots to indicate git additions and deletions
  width_multiplier = 4, -- How many characters one dot represents
  z_index = 1, -- The z-index the floating window will be on
  show_cursor = true, -- Show the cursor position in the minimap
  window_border = 'single' -- The border style of the floating window (accepts all usual options)
};

    codewindow.setup(config)
    codewindow.apply_default_keybinds()

EOF


"===============================================================================
"  windwp/nvim-autopairs
"===============================================================================
lua << EOF
require("nvim-autopairs").setup {}
EOF



"===============================================================================
"  lukas-reineke/indent-blankline.nvim
"===============================================================================
lua << EOF
require("indent_blankline").setup {
    -- for example, context is off by default, use this to turn it on
    show_current_context = true,
    show_current_context_start = true,
}
EOF


"===============================================================================
"  mouse key
"===============================================================================
lua << EOF
local wk = require("which-key")
wk.register(mappings, opts)
EOF