::
This commit is contained in:
parent
a27ce3efaa
commit
dc74d3edf4
22
README.md
22
README.md
@ -17,4 +17,26 @@ sudo apt-get install neovim
|
||||
|
||||
## 文件结构
|
||||
```
|
||||
.
|
||||
├── init.lua
|
||||
├── install.sh
|
||||
├── lua
|
||||
│ ├── Filetype
|
||||
│ │ ├── c.lua
|
||||
│ │ ├── markdown.lua
|
||||
│ │ └── vue.lua
|
||||
│ ├── G.lua
|
||||
│ ├── normal
|
||||
│ │ ├── keymap.lua
|
||||
│ │ ├── normal.lua
|
||||
│ │ ├── options.lua
|
||||
│ │ └── plug.lua
|
||||
│ └── Plugin
|
||||
│ ├── coc.lua
|
||||
│ ├── coc-settings.json
|
||||
│ ├── Imchange.lua
|
||||
│ ├── lualine.lua
|
||||
│ ├── NERDTree.lua
|
||||
│ └── treesitter.lua
|
||||
└── README.md
|
||||
```
|
||||
|
26
init.lua
26
init.lua
@ -1,4 +1,28 @@
|
||||
require ('normal.normal')
|
||||
local G = require('G')
|
||||
|
||||
local lazypath = G.fn.stdpath("data") .. "/lazy/lazy.nvim"
|
||||
if not G.loop.fs_stat(lazypath) then
|
||||
G.fn.system({
|
||||
"git",
|
||||
"clone",
|
||||
"--filter=blob:none",
|
||||
"https://github.com/folke/lazy.nvim.git",
|
||||
"--branch=stable", -- latest stable release
|
||||
lazypath,
|
||||
})
|
||||
end
|
||||
|
||||
G.opt.rtp:prepend(lazypath)
|
||||
|
||||
|
||||
if vim.g.vscode then
|
||||
require('Plugin.Imchange')
|
||||
else
|
||||
require('neovim.neovim')
|
||||
end
|
||||
|
||||
require('normal.normal')
|
||||
|
||||
|
||||
-- require('vscode')
|
||||
-- require('Plugin.coc')
|
||||
|
@ -1,105 +0,0 @@
|
||||
local G = require("G")
|
||||
|
||||
G.cmd("au VimEnter * :MarkdownPreviewToggle")
|
||||
|
||||
--set to 1, nvim will open the preview window after entering the markdown buffer
|
||||
--default: 0
|
||||
G.g.mkdp_auto_start = 1
|
||||
|
||||
--set to 1, the nvim will auto close current preview window when change
|
||||
--from markdown buffer to another buffer
|
||||
--default: 1
|
||||
G.g.mkdp_auto_close = 1
|
||||
|
||||
--set to 1, the vim will refresh markdown when save the buffer or
|
||||
--leave from insert mode, default 0 is auto refresh markdown as you edit or
|
||||
--move the cursor
|
||||
--default: 0
|
||||
G.g.mkdp_refresh_slow = 0
|
||||
|
||||
--set to 1, the MarkdownPreview command can be use for all files,
|
||||
--by default it can be use in markdown file
|
||||
--default: 0
|
||||
G.g.mkdp_command_for_global = 0
|
||||
|
||||
--set to 1, preview server available to others in your network
|
||||
--by default, the server listens on localhost (127.0.0.1)
|
||||
--default: 0
|
||||
G.g.mkdp_open_to_the_world = 0
|
||||
|
||||
--use custom IP to open preview page
|
||||
--useful when you work in remote vim and preview on local browser
|
||||
--more detail see: https://github.com/iamcco/markdown-preview.nvim/pull/9
|
||||
--default empty
|
||||
G.g.mkdp_open_ip = ''
|
||||
|
||||
--specify browser to open preview page
|
||||
--for path with space
|
||||
--valid: `/path/with\ space/xxx`
|
||||
--invalid: `/path/with\\ space/xxx`
|
||||
--default: ''
|
||||
G.g.mkdp_browser = 'wyeb'
|
||||
|
||||
--set to 1, echo preview page url in command line when open preview page
|
||||
--default is 0
|
||||
G.g.mkdp_echo_preview_url = 0
|
||||
|
||||
--a custom vim function name to open preview page
|
||||
--this function will receive url as param
|
||||
--default is empty
|
||||
G.g.mkdp_browserfunc = ''
|
||||
|
||||
--options for markdown render
|
||||
--mkit: markdown-it options for render
|
||||
--katex: katex options for math
|
||||
--uml: markdown-it-plantuml options
|
||||
--maid: mermaid options
|
||||
--disable_sync_scroll: if disable sync scroll, default 0
|
||||
--sync_scroll_type: 'middle', 'top' or 'relative', default value is 'middle'
|
||||
-- middle: mean the cursor position alway show at the middle of the preview page
|
||||
-- top: mean the vim top viewport alway show at the top of the preview page
|
||||
-- relative: mean the cursor position alway show at the relative positon of the preview page
|
||||
--hide_yaml_meta: if hide yaml metadata, default is 1
|
||||
--sequence_diagrams: js-sequence-diagrams options
|
||||
--content_editable: if enable content editable for preview page, default: v:false
|
||||
--disable_filename: if disable filename header for preview page, default: 0
|
||||
|
||||
--G.cmd([[
|
||||
-- let g:mkdp_preview_options = {
|
||||
-- \'mkit': {},
|
||||
-- \'katex': {},
|
||||
-- \'uml': {},
|
||||
-- \'maid': {},
|
||||
-- \'disable_sync_scroll': 0,
|
||||
-- \'sync_scroll_type': 'middle',
|
||||
-- \'hide_yaml_meta': 1,
|
||||
-- \'sequence_diagrams': {},
|
||||
-- \'flowchart_diagrams': {},
|
||||
-- \'content_editable': v:false,
|
||||
-- \'disable_filename': 0,
|
||||
-- \'toc': {}
|
||||
-- \}
|
||||
-- ]])
|
||||
--use a custom markdown style must be absolute path
|
||||
--like '/Users/username/markdown.css' or expand('~/markdown.css')
|
||||
|
||||
G.g.mkdp_markdown_css = ''
|
||||
|
||||
--use a custom highlight style must absolute path
|
||||
--like '/Users/username/highlight.css' or expand('~/highlight.css')
|
||||
G.g.mkdp_highlight_css = ''
|
||||
|
||||
--use a custom port to start server or empty for random
|
||||
G.g.mkdp_port = '12345'
|
||||
|
||||
--preview page title
|
||||
--${name} will be replace with the file name
|
||||
G.g.mkdp_page_title = '「${name}」'
|
||||
|
||||
--recognized filetypes
|
||||
--these filetypes will have MarkdownPreview... commands
|
||||
G.g.mkdp_filetypes = {'markdown'}
|
||||
|
||||
--set default theme (dark or light)
|
||||
--By default the theme is define according to the preferences of the system
|
||||
G.g.mkdp_theme = 'dark'
|
@ -1 +0,0 @@
|
||||
require('Plugin.ale')
|
@ -1,8 +0,0 @@
|
||||
{
|
||||
"snippets.ultisnips.pythonPrompt": false,
|
||||
"explorer.icon.enableNerdfont": true,
|
||||
"explorer.toggle": true,
|
||||
"outline.autoWidth": true,
|
||||
"outline.autoPreview": true,
|
||||
"data.home": "~",
|
||||
}
|
@ -1,139 +0,0 @@
|
||||
local G = require('G')
|
||||
|
||||
G.g.coc_user_config = G.fn.stdpath('config') .. 'lua/Plugin/coc-settings.json'
|
||||
|
||||
G.g['coc_global_extensions'] = {
|
||||
"coc-clangd",
|
||||
"coc-python",
|
||||
"coc-lua",
|
||||
"coc-json",
|
||||
|
||||
"coc-translator",
|
||||
"coc-yank",
|
||||
"coc-pairs",
|
||||
}
|
||||
|
||||
-- Having longer updatetime (default is 4000 ms = 4s) leads to noticeable
|
||||
-- delays and poor user experience
|
||||
G.opt.updatetime = 300
|
||||
|
||||
-- Always show the signcolumn, otherwise it would shift the text each time
|
||||
-- diagnostics appeared/became resolved
|
||||
G.opt.signcolumn = "yes"
|
||||
|
||||
local keyset = vim.keymap.set
|
||||
-- Autocomplete
|
||||
function _G.check_back_leader()
|
||||
local col = G.fn.col('.') - 1
|
||||
return col == 0 or G.fn.getline('.'):sub(col, col):match('%s') ~= nil
|
||||
end
|
||||
|
||||
-- Use Tab for trigger completion with characters ahead and navigate
|
||||
-- NOTE: There's always a completion item selected by default, you may want to enable
|
||||
-- no select by setting `"suggest.noselect": true` in your configuration file
|
||||
-- NOTE: Use command ':verbose imap <tab>' to make sure Tab is not mapped by
|
||||
-- other plugins before putting this into your config
|
||||
local opts = {silent = true, noremap = true, expr = true, replace_keycodes = false}
|
||||
keyset("i", "<TAB>", 'coc#pum#visible() ? coc#pum#next(1) : v:lua.check_back_leader() ? "<TAB>" : coc#refresh()', opts)
|
||||
keyset("i", "<S-TAB>", [[coc#pum#visible() ? coc#pum#prev(1) : "\<C-h>"]], opts)
|
||||
|
||||
-- Make <CR> to accept selected completion item or notify coc.nvim to format
|
||||
-- <C-g>u breaks current undo, please make your own choice
|
||||
keyset("i", "<cr>", [[coc#pum#visible() ? coc#pum#confirm() : "\<C-g>u\<CR>\<c-r>=coc#on_enter()\<CR>"]], opts)
|
||||
|
||||
-- Use `[g` and `]g` to navigate diagnostics
|
||||
-- Use `:CocDiagnostics` to get all diagnostics of current buffer in location list
|
||||
keyset("n", "[g", "<Plug>(coc-diagnostic-prev)", {silent = true})
|
||||
keyset("n", "]g", "<Plug>(coc-diagnostic-next)", {silent = true})
|
||||
|
||||
-- GoTo code navigation
|
||||
keyset("n", "gd", "<Plug>(coc-definition)", {silent = true})
|
||||
keyset("n", "gy", "<Plug>(coc-type-definition)", {silent = true})
|
||||
keyset("n", "gi", "<Plug>(coc-implementation)", {silent = true})
|
||||
keyset("n", "gr", "<Plug>(coc-references)", {silent = true})
|
||||
|
||||
-- Symbol renaming
|
||||
keyset("n", "<leader>rn", "<Plug>(coc-rename)", {silent = true})
|
||||
|
||||
-- Formatting selected code
|
||||
keyset("x", "<leader>i", "<Plug>(coc-format-selected)", {silent = true})
|
||||
keyset("n", "<leader>i", "<Plug>(coc-format-selected)", {silent = true})
|
||||
|
||||
-- Apply codeAction to the selected region
|
||||
-- Example: `<leader>aap` for current paragraph
|
||||
local opts = {silent = true, nowait = true}
|
||||
|
||||
-- Map function and class text objects
|
||||
-- NOTE: Requires 'textDocument.documentSymbol' support from the language server
|
||||
keyset("x", "if", "<Plug>(coc-funcobj-i)", opts)
|
||||
keyset("o", "if", "<Plug>(coc-funcobj-i)", opts)
|
||||
keyset("x", "af", "<Plug>(coc-funcobj-a)", opts)
|
||||
keyset("o", "af", "<Plug>(coc-funcobj-a)", opts)
|
||||
keyset("x", "ic", "<Plug>(coc-classobj-i)", opts)
|
||||
keyset("o", "ic", "<Plug>(coc-classobj-i)", opts)
|
||||
keyset("x", "ac", "<Plug>(coc-classobj-a)", opts)
|
||||
keyset("o", "ac", "<Plug>(coc-classobj-a)", opts)
|
||||
|
||||
-- translator
|
||||
keyset("n", "<leader>tt", "<Plug>(coc-translator-p)")
|
||||
keyset("v", "<leader>tt", "<Plug>(coc-translator-pv)")
|
||||
|
||||
-- translator-releader
|
||||
keyset("n", "<leader>tr", "<Plug>(coc-translator-r)")
|
||||
keyset("v", "<leader>tr", "<Plug>(coc-translator-rv)")
|
||||
keyset("n", "<leader>ol", ":CocOutline<CR>")
|
||||
|
||||
|
||||
-- Highlight the symbol and its references on a CursorHold event(cursor is idle)
|
||||
G.api.nvim_create_augroup("CocGroup", {})
|
||||
G.api.nvim_create_autocmd("CursorHold", {
|
||||
group = "CocGroup",
|
||||
command = "silent call CocActionAsync('highlight')",
|
||||
desc = "Highlight symbol under cursor on CursorHold"
|
||||
})
|
||||
|
||||
-- Setup formatexpr specified filetype(s)
|
||||
G.api.nvim_create_autocmd("FileType", {
|
||||
group = "CocGroup",
|
||||
pattern = "typescript,json",
|
||||
command = "setl formatexpr=CocAction('formatSelected')",
|
||||
desc = "Setup formatexpr specified filetype(s)."
|
||||
})
|
||||
|
||||
-- Update signature help on jump placeholder
|
||||
G.api.nvim_create_autocmd("User", {
|
||||
group = "CocGroup",
|
||||
pattern = "CocJumpPlaceholder",
|
||||
command = "call CocActionAsync('showSignatureHelp')",
|
||||
desc = "Update signature help on jump placeholder"
|
||||
})
|
||||
|
||||
-- Remap <C-f> and <C-b> to scroll float windows/popups
|
||||
---@diagnostic disable-next-line: redefined-local
|
||||
local opts = {silent = true, nowait = true, expr = true}
|
||||
keyset("n", "<C-f>", 'coc#float#has_scroll() ? coc#float#scroll(1) : "<C-f>"', opts)
|
||||
keyset("n", "<C-b>", 'coc#float#has_scroll() ? coc#float#scroll(0) : "<C-b>"', opts)
|
||||
keyset("i", "<C-f>",
|
||||
'coc#float#has_scroll() ? "<c-r>=coc#float#scroll(1)<cr>" : "<Right>"', opts)
|
||||
keyset("i", "<C-b>",
|
||||
'coc#float#has_scroll() ? "<c-r>=coc#float#scroll(0)<cr>" : "<Left>"', opts)
|
||||
keyset("v", "<C-f>", 'coc#float#has_scroll() ? coc#float#scroll(1) : "<C-f>"', opts)
|
||||
keyset("v", "<C-b>", 'coc#float#has_scroll() ? coc#float#scroll(0) : "<C-b>"', opts)
|
||||
|
||||
-- Add `:Format` command to format current buffer
|
||||
G.api.nvim_create_user_command("Format", "call CocAction('format')", {})
|
||||
|
||||
-- " Add `:Fold` command to fold current buffer
|
||||
G.api.nvim_create_user_command("Fold", "call CocAction('fold', <f-args>)", {nargs = '?'})
|
||||
|
||||
-- Add `:OR` command for organize imports of the current buffer
|
||||
G.api.nvim_create_user_command("OR", "call CocActionAsync('runCommand', 'editor.action.organizeImport')", {})
|
||||
|
||||
-- Add (Neo)Vim's native statusline support
|
||||
-- NOTE: Please see `:h coc-status` for integrations with external plugins that
|
||||
-- provide custom statusline: lightline.vim, vim-airline
|
||||
G.opt.statusline:prepend("%{coc#status()}%{get(b:,'coc_current_function','')}")
|
||||
|
||||
|
||||
|
||||
|
6
lua/neovim/keymap.lua
Normal file
6
lua/neovim/keymap.lua
Normal file
@ -0,0 +1,6 @@
|
||||
local G, opt = require('G'), {noremap = true}
|
||||
|
||||
--NvimTree
|
||||
G.map({
|
||||
{"n", "<c-e>", ":NERDTreeToggle<CR>", opt},
|
||||
})
|
3
lua/neovim/neovim.lua
Normal file
3
lua/neovim/neovim.lua
Normal file
@ -0,0 +1,3 @@
|
||||
require('neovim.plugsettings.plug')
|
||||
|
||||
require('neovim.keymap')
|
21
lua/neovim/plugsettings/plug.lua
Normal file
21
lua/neovim/plugsettings/plug.lua
Normal file
@ -0,0 +1,21 @@
|
||||
require("lazy").setup({
|
||||
|
||||
-- nerdtree
|
||||
{
|
||||
'preservim/nerdtree',
|
||||
dependencies = {
|
||||
'Xuyuanp/nerdtree-git-plugin',
|
||||
'ryanoasis/vim-devicons',
|
||||
},
|
||||
cmd = 'NERDTreeToggle',
|
||||
},
|
||||
|
||||
--颜色识别
|
||||
{
|
||||
'lilydjwg/colorizer',
|
||||
},
|
||||
|
||||
-- 语法高亮
|
||||
'nvim-treesitter/nvim-treesitter',
|
||||
|
||||
})
|
@ -1,4 +1,3 @@
|
||||
|
||||
local G, opt = require('G'), {noremap = true}
|
||||
|
||||
-- base
|
||||
@ -56,11 +55,6 @@ G.map({
|
||||
{"v", "ga", ":EasyAlign<CR>", opt},
|
||||
})
|
||||
|
||||
--NvimTree
|
||||
G.map({
|
||||
{"n", "<c-e>", ":NERDTreeToggle<CR>", opt},
|
||||
})
|
||||
|
||||
|
||||
|
||||
|
||||
|
@ -1,4 +1,6 @@
|
||||
require('normal.plug')
|
||||
require('normal.plugsettings.plug')
|
||||
|
||||
require('normal.keymap')
|
||||
require('normal.options')
|
||||
|
||||
|
||||
|
@ -1,24 +1,6 @@
|
||||
|
||||
local G = require('G')
|
||||
|
||||
local lazypath = G.fn.stdpath("data") .. "/lazy/lazy.nvim"
|
||||
if not G.loop.fs_stat(lazypath) then
|
||||
G.fn.system({
|
||||
"git",
|
||||
"clone",
|
||||
"--filter=blob:none",
|
||||
"https://github.com/folke/lazy.nvim.git",
|
||||
"--branch=stable", -- latest stable release
|
||||
lazypath,
|
||||
})
|
||||
end
|
||||
|
||||
G.opt.rtp:prepend(lazypath)
|
||||
|
||||
-- Example using a list of specs with the default options
|
||||
|
||||
require("lazy").setup({
|
||||
lockfile = false,
|
||||
|
||||
-- 主题插件
|
||||
'nvim-lualine/lualine.nvim',
|
||||
@ -26,10 +8,6 @@ lockfile = false,
|
||||
'shaunsingh/nord.nvim',
|
||||
'yaocccc/nvim-hlchunk',
|
||||
|
||||
-- lsp 补全以及语法高亮
|
||||
-- {'neoclide/coc.nvim', branch = 'release'},
|
||||
-- 'nvim-treesitter/nvim-treesitter',
|
||||
|
||||
-- surround 和 wildfire 配合有神奇的效果
|
||||
'tpope/vim-surround',
|
||||
'gcmt/wildfire.vim',
|
||||
@ -38,41 +16,18 @@ lockfile = false,
|
||||
'junegunn/vim-easy-align',
|
||||
'tpope/vim-commentary',
|
||||
|
||||
--颜色识别
|
||||
'lilydjwg/colorizer',
|
||||
|
||||
--markdown
|
||||
{
|
||||
'iamcco/markdown-preview.nvim',
|
||||
ft = {
|
||||
'markdown',
|
||||
}
|
||||
},
|
||||
|
||||
-- 文件搜索
|
||||
-- 'junegunn/fzf',
|
||||
|
||||
-- 多光标
|
||||
-- 'terryma/vim-multiple-cursors',
|
||||
|
||||
-- github copilot
|
||||
-- 'github/copilot.vim',
|
||||
'terryma/vim-multiple-cursors',
|
||||
|
||||
-- fzf
|
||||
'vijaymarupudi/nvim-fzf',
|
||||
|
||||
-- nerdtree
|
||||
{
|
||||
'preservim/nerdtree',
|
||||
dependencies = {
|
||||
'Xuyuanp/nerdtree-git-plugin',
|
||||
'ryanoasis/vim-devicons',
|
||||
},
|
||||
cmd = 'NERDTreeToggle',
|
||||
},
|
||||
|
||||
-- 项目管理
|
||||
-- {
|
||||
|
||||
-- github copilot
|
||||
-- 'github/copilot.vim',
|
||||
|
||||
-- 项目管理 {
|
||||
-- 'Shatur/neovim-session-manager',
|
||||
-- dependencies = {
|
||||
-- 'nvim-lua/plenary.nvim'
|
||||
@ -89,6 +44,8 @@ lockfile = false,
|
||||
-- end,
|
||||
-- dependencies = { {'nvim-tree/nvim-web-devicons'}}
|
||||
-- }
|
||||
-- lsp 补全以及语法高亮
|
||||
-- {'neoclide/coc.nvim', branch = 'release'},
|
||||
|
||||
})
|
||||
|
Loading…
Reference in New Issue
Block a user