This commit is contained in:
QQ 2023-10-01 17:18:36 +08:00
parent 516c9e019e
commit c1541c6e2e
17 changed files with 174 additions and 179 deletions

View File

@ -1,42 +0,0 @@
if package.config:sub(1,1) == "\\" then
return
end
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
G.cmd(":silent !fcitx5-remote -s pinyin")
end
end
function Is_fcitx5_installed()
local cmd = "fcitx5 -v"
local status = os.execute(cmd)
return (status == 0)
end
if Is_fcitx5_installed() then
G.api.nvim_create_autocmd(
{"InsertLeave"}, {
pattern = "*",
callback = InsertLeave
}
)
G.api.nvim_create_autocmd(
{"InsertEnter"}, {
pattern = "*",
callback = InsertEnter
}
)
end

View File

@ -1 +0,0 @@

View File

@ -1,40 +0,0 @@
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 = {}
}

View File

@ -1,54 +0,0 @@
local G = require("G")
require'nvim-treesitter.configs'.setup {
-- A list of parser names, or "all" (the four listed parsers should always be installed)
ensure_installed = {},
indent = { enable = true },
-- 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 = {
-- `false` will disable the whole extension
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(G.loop.fs_stat, G.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,
},
parsers = {
html = {
install_info = {
url = "https://github.com/ikatyang/tree-sitter-vue",
files = {"src/parser.c"},
branch = "main"
}
}
}
}

View File

@ -1,4 +1,4 @@
require('neovim.plugsettings.plug') -- require('neovim.plugsettings.plug')
require('neovim.keymap') require('neovim.keymap')
require('neovim.options') require('neovim.options')

31
lua/neovim/plug.lua Normal file
View File

@ -0,0 +1,31 @@
return {
-- github copilot
'github/copilot.vim',
'vijaymarupudi/nvim-fzf', -- fzf
'shaunsingh/nord.nvim', -- 主题插件
require('neovim.plugsettings.lualine'), -- lualine
require('neovim.plugsettings.nvimtree'), -- nvimtree
require('neovim.plugsettings.lspconfig'), -- lspconfig
require('neovim.plugsettings.treesitter'), -- treesitter
-- nerdtree
{
'preservim/nerdtree',
dependencies = {
'Xuyuanp/nerdtree-git-plugin',
'ryanoasis/vim-devicons',
},
cmd = 'NERDTreeToggle',
},
--颜色识别
{
'lilydjwg/colorizer',
},
}

View File

@ -0,0 +1,3 @@
return {
'neovim/nvim-lspconfig',
}

View File

@ -0,0 +1,45 @@
return {
'nvim-lualine/lualine.nvim',
config = function()
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 = {}
}
end,
}

View File

@ -0,0 +1,2 @@
return {
}

View File

@ -1,34 +0,0 @@
require("lazy").setup({
-- github copilot
-- 'github/copilot.vim',
-- fzf
'vijaymarupudi/nvim-fzf',
-- lualine
'nvim-lualine/lualine.nvim',
-- 主题插件
'morhetz/gruvbox',
'shaunsingh/nord.nvim',
-- nerdtree
{
'preservim/nerdtree',
dependencies = {
'Xuyuanp/nerdtree-git-plugin',
'ryanoasis/vim-devicons',
},
cmd = 'NERDTreeToggle',
},
--颜色识别
{
'lilydjwg/colorizer',
},
-- 语法高亮
'nvim-treesitter/nvim-treesitter',
})

View File

@ -0,0 +1,58 @@
return {
-- 语法高亮
'nvim-treesitter/nvim-treesitter',
config = function()
require'nvim-treesitter.configs'.setup {
-- A list of parser names, or "all" (the four listed parsers should always be installed)
ensure_installed = {},
indent = { enable = true },
-- 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 = {
-- `false` will disable the whole extension
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(G.loop.fs_stat, G.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,
},
parsers = {
html = {
install_info = {
url = "https://github.com/ikatyang/tree-sitter-vue",
files = {"src/parser.c"},
branch = "main"
}
}
}
}
end
}

View File

@ -1,4 +1,4 @@
local G, opt = require('G'), {noremap = true} local opt = {noremap = true}
-- base -- base
G.map({ G.map({

View File

@ -1,5 +1,3 @@
require('normal.plugsettings.plug')
require('normal.keymap') require('normal.keymap')
require('normal.options') require('normal.options')

View File

@ -1,6 +1,4 @@
-- Example using a list of specs with the default options return {
require("lazy").setup({
-- 括号箭头 -- 括号箭头
'yaocccc/nvim-hlchunk', 'yaocccc/nvim-hlchunk',
@ -40,7 +38,7 @@ require("lazy").setup({
-- lsp 补全以及语法高亮 -- lsp 补全以及语法高亮
-- {'neoclide/coc.nvim', branch = 'release'}, -- {'neoclide/coc.nvim', branch = 'release'},
}) }

25
lua/plugsettings.lua Normal file
View File

@ -0,0 +1,25 @@
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)
local normalplugs = require('normal.plug')
local vscodeplugs = require('vscode.plug')
local neovimplugs = require('neovim.plug')
if G.g.vscode then
plugs = {vscodeplugs, normalplugs}
else
plugs = {neovimplugs, normalplugs}
end
require("lazy").setup(plugs)

View File

@ -0,0 +1,6 @@
local opt = {noremap = true}
G.map({
{'n', 'j', 'gj', opt},
{'n', 'k', 'gk', opt},
})