更换插件管理器

This commit is contained in:
QQ 2023-01-28 15:11:37 +08:00
parent 1a2e068a8b
commit a4cfb715c0
13 changed files with 231 additions and 153 deletions

View File

@ -7,16 +7,18 @@
.
├── coc-settings.json
├── init.lua
├── lazy-lock.json
├── lua
│   ├── core
│   │   ├── G.lua
│   │   ├── keymap.lua
│   │   ├── options.lua
│   │   └── plug.lua
│   ├── Filetype
│   │   ├── c.lua
│   │   └── markdown.lua
│   └── Plugin
│   ├── coc.lua
│   ├── lualine.lua
│   └── nerdcommenter.lua
│   └── lualine.lua
└── README.md
```
## vim-surround插件
@ -56,6 +58,28 @@ select the closest text object.
![官方给的gif](https://raw.githubusercontent.com/gcmt/wildfire.vim/master/_assets/preview.gif)
## nerdcommenter
快速注释插件
`<leader>c<space>` 切换注释状态
## Markdow-preview
下载后需要到插件目录下使用`npm install`或者`yarn install`

View File

@ -1,8 +1,6 @@
{
"snippets.ultisnips.pythonPrompt": false,
"explorer.icon.enableNerdfont": true,
"explorer.toggle": true,
"markdown-preview-enhanced.previewTheme":"github-dark.css",
"markdown-preview-enhanced.latexEngine": "pdflatex",
"markdown-preview-enhanced.chromePath": "/usr/bin/wyeb"
"explorer.toggle": true
}

View File

@ -1,10 +1,7 @@
vim.g['mapleader'] = ' '
require('core.plug')
require('core.options')
require('core.keymap')
require('Plugin.coc')
require('Plugin.lualine')
require('Plugin.nerdcommenter')
require('Plugin.Imchange')

View File

@ -1,14 +0,0 @@
{
"coc.nvim": { "branch": "release", "commit": "e86b15bbcabc2cc1f20a40e7c127a424e7ad3850" },
"colorizer": { "branch": "master", "commit": "72790a003d5a706c287486a1a81e3a6b32158b54" },
"gruvbox": { "branch": "master", "commit": "bf2885a95efdad7bd5e4794dd0213917770d79b7" },
"lazy.nvim": { "branch": "main", "commit": "96d759d1cbd8b0bd0ea0a0c2987f99410272f348" },
"lazygit.nvim": { "branch": "main", "commit": "32bffdebe273e571588f25c8a708ca7297928617" },
"lualine.nvim": { "branch": "master", "commit": "0050b308552e45f7128f399886c86afefc3eb988" },
"markdown-preview.vim": { "branch": "master", "commit": "97388dc537454a90422f186cb4e1a4f9a3f95122" },
"nerdcommenter": { "branch": "master", "commit": "98cc4a2d64ca67cccbf5b5cf47c682ebadaaff58" },
"vim-easy-align": { "branch": "master", "commit": "12dd6316974f71ce333e360c0260b4e1f81169c3" },
"vim-easymotion": { "branch": "master", "commit": "b3cfab2a6302b3b39f53d9fd2cd997e1127d7878" },
"vim-surround": { "branch": "master", "commit": "3d188ed2113431cf8dac77be61b842acb64433d9" },
"wildfire.vim": { "branch": "master", "commit": "b371e2b1d938ae0e164146136051de164ecb9aa5" }
}

View File

@ -1,4 +1,103 @@
local map = vim.api.nvim_set_keymap
local openPreview = ":CocCommand markdown-preview-enhanced.openPreview<CR>"
local G = require("core.G")
local TogglePreview = "<Plug>MarkdownPreviewToggle"
map('n', '<leader>r', openPreview, {noremap = false})
--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'

View File

@ -5,6 +5,7 @@ G.b = vim.b
G.o = vim.o
G.fn = vim.fn
G.api = vim.api
G.opt = vim.opt
function G.map(maps)
for _,map in pairs(maps) do
@ -33,4 +34,6 @@ function G.eval(c)
return G.api.nvim_eval(c)
end
G.g.mapleader = ' '
return G

29
lua/Plugin/Imchange.lua Normal file
View File

@ -0,0 +1,29 @@
local G, im = require("G"), "keyboard-us"
function InsertLeave()
local t = io.popen("fcitx5-remote -n")
im = t:read()
G.cmd(":silent !fcitx5-remote -c")
end
function InsertEnter()
if im == 'pinyin'
then
print(im)
G.cmd("!fcitx5-remote -s pinyin")
end
end
G.api.nvim_create_autocmd(
{"InsertLeave"}, {
pattern = "*",
callback = InsertLeave
}
)
G.api.nvim_create_autocmd(
{"InsertEnter"}, {
pattern = "*",
callback = InsertEnter
}
)

View File

@ -1,3 +0,0 @@
local G = require("core.G")
G.g['mkdp_path_to_chrome'] = '/usr/bin/wyeb'

View File

@ -3,7 +3,6 @@ vim.g['coc_global_extensions'] = {
"coc-python",
"coc-json",
"coc-lua",
"coc-markdown-preview-enhanced",
"coc-webview",
"coc-translator",

View File

@ -1,28 +0,0 @@
vim.cmd([[
" Create default mappings
let g:NERDCreateDefaultMappings = 1
" Add spaces after comment delimiters by default
let g:NERDSpaceDelims = 1
" Use compact syntax for prettified multi-line comments
let g:NERDCompactSexyComs = 1
" Align line-wise comment delimiters flush left instead of following code indentation
let g:NERDDefaultAlign = 'left'
" Set a language to use its alternate delimiters by default
let g:NERDAltDelims_java = 1
" Add your own custom formats or override the defaults
let g:NERDCustomDelimiters = { 'c': { 'left': '/**','right': '*/' } }
" Allow commenting and inverting empty lines (useful when commenting a region)
let g:NERDCommentEmptyLines = 1
" Enable trimming of trailing whitespace when uncommenting
let g:NERDTrimTrailingWhitespace = 1
" Enable NERDCommenterToggle to check all selected lines is commented or not
let g:NERDToggleCheckAllLines = 1
]])

View File

@ -1,4 +1,4 @@
local G,opt = require("core.G"), {noremap = true}
local G, opt = require('G'), {noremap = true}
G.map({
{'n', '<leader>y', '"+y', opt},
@ -10,7 +10,7 @@ G.map({
{'v', '<leader>d', '"+d', opt},
{'n', '<leader>nh', ':nohlsearch<CR>', opt},
{'n', '<leader>rp',':%s/',opt},
{'n', '<leader>rp', ':%s/',opt},
{'v', 'L', '$', opt},
{'v', 'H', '^', opt},
@ -66,12 +66,3 @@ G.map({

View File

@ -1,83 +1,69 @@
local set= vim.opt
local G = require('G')
-- 行号
set.nu = true
set.rnu = true
set.scrolloff = 999
G.opt.nu = true
G.opt.rnu = true
G.opt.scrolloff = 999
-- 自动保存
set.autowrite = true
set.autowriteall = true
G.opt.autowrite = true
G.opt.autowriteall = true
-- tab键
set.sw = 2
set.ts = 2
set.softtabstop = 2
set.smarttab = true
set.expandtab = true
set.autoindent = true
G.opt.sw = 2
G.opt.ts = 2
G.opt.softtabstop = 2
G.opt.smarttab = true
G.opt.expandtab = true
G.opt.autoindent = true
-- 光标
set.cursorline = true
G.opt.cursorline = true
-- 分屏
set.splitright = true
set.splitbelow = true
G.opt.splitright = true
G.opt.splitbelow = true
-- 搜索
set.ignorecase = true
set.incsearch = true
G.opt.ignorecase = true
G.opt.incsearch = true
-- 不换行
set.textwidth = 999
set.wrap = false
G.opt.textwidth = 999
G.opt.wrap = false
-- 背景
set.background = 'dark'
G.opt.background = 'dark'
-- 主题
vim.cmd("colorscheme gruvbox")
-- 输入法自动根据模式自动切换
vim.cmd([[ au InsertLeave * :silent !fcitx5-remote -c ]])
G.cmd("colorscheme gruvbox")
-- 文件判断
vim.cmd([[ filetype plugin indent on ]])
G.cmd("filetype plugin indent on")
-- 取消换行注释
vim.api.nvim_create_autocmd({ "BufEnter" }, {
G.api.nvim_create_autocmd({ "BufEnter" }, {
pattern = { "*" },
callback = function()
-- vim.opt.formatoptions = vim.opt.formatoptions - { "c", "r", "o" }
vim.opt.formatoptions = vim.opt.formatoptions
- "o" -- O and o, don't continue comments
G.opt.formatoptions = G.opt.formatoptions
- "o" -- O and o, don't continue comments
+ "r" -- But do continue when pressing enter.
end,
})
local require_markdown = {}
function require_markdown()
require('Filetype.markdown')
G.cmd('MarkdownPreviewToggle')
end
vim.api.nvim_create_autocmd(
{"FileType"}, { pattern = "markdown", callback = require_markdown }
G.api.nvim_create_autocmd(
{"FileType"}, {
pattern = "markdown",
callback = require_markdown
}
)

View File

@ -1,48 +1,45 @@
-- lazy插件自动安装插件
local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim"
if not vim.loop.fs_stat(lazypath) then
vim.fn.system({
"git",
"clone",
"--depth=1",
"--filter=blob:none",
"https://github.com/folke/lazy.nvim.git",
"--branch=stable", -- latest stable release
lazypath,
})
local ensure_packer = function()
local fn = vim.fn
local install_path = fn.stdpath('data')..'/site/pack/packer/start/packer.nvim'
if fn.empty(fn.glob(install_path)) > 0 then
fn.system({'git', 'clone', '--depth', '1', 'https://github.com/wbthomason/packer.nvim', install_path})
vim.cmd [[packadd packer.nvim]]
return true
end
return false
end
vim.opt.rtp:prepend(lazypath)
local packer_bootstrap = ensure_packer()
local G = require('G')
return require('packer').startup(function(use)
require("lazy").setup({
-- 主题插件
'nvim-lualine/lualine.nvim',
'morhetz/gruvbox',
use 'nvim-lualine/lualine.nvim'
use 'morhetz/gruvbox'
-- lsp 补全
{'neoclide/coc.nvim', branch = 'release'},
use {'neoclide/coc.nvim', branch = 'release'}
-- surround 和 wildfire 配合有神奇的效果
'tpope/vim-surround',
'gcmt/wildfire.vim',
-- easymotion
'easymotion/vim-easymotion',
use 'tpope/vim-surround'
use 'gcmt/wildfire.vim'
-- easymotion
use 'easymotion/vim-easymotion'
-- 格式整理
'junegunn/vim-easy-align',
'preservim/nerdcommenter',
use 'junegunn/vim-easy-align'
use 'preservim/nerdcommenter'
--颜色识别
'lilydjwg/colorizer',
use 'lilydjwg/colorizer'
--markdown
'iamcco/markdown-preview.vim',
use 'iamcco/markdown-preview.nvim'
-- git
'kdheepak/lazygit.nvim',
})
use 'kdheepak/lazygit.nvim'
end)