add table-mode and toggleterm,change readme

This commit is contained in:
gameloader
2022-10-07 19:27:54 +08:00
parent 1291acb250
commit 2d25c86d3c
8 changed files with 242 additions and 110 deletions

View File

@ -1,72 +1,68 @@
local M = {}
M.load_default_options = function()
local set_options = {
backup = false, -- creates a backup file
clipboard = "unnamedplus", -- allows neovim to access the system clipboard
cmdheight = 1, -- more space in the neovim command line for displaying messages
completeopt = { "menuone", "noselect" },
conceallevel = 0, -- so that `` is visible in markdown files
fileencoding = "utf-8", -- the encoding written to a file
foldmethod = "manual", -- folding, set to "expr" for treesitter based folding
foldexpr = "", -- set to "nvim_treesitter#foldexpr()" for treesitter based folding
guifont = "monospace:h17", -- the font used in graphical neovim applications
background = "light", -- set the background to light or dark
hidden = true, -- required to keep multiple buffers and open multiple buffers
hlsearch = true, -- highlight all matches on previous search pattern
ignorecase = true, -- ignore case in search patterns
mouse = "a", -- allow the mouse to be used in neovim
pumheight = 10, -- pop up menu height
showmode = false, -- we don't need to see things like -- INSERT -- anymore
showtabline = 2, -- always show tabs
smartcase = true, -- smart case
smartindent = true, -- make indenting smarter again
splitbelow = true, -- force all horizontal splits to go below current window
splitright = true, -- force all vertical splits to go to the right of current window
swapfile = false, -- creates a swapfile
termguicolors = true, -- set term gui colors (most terminals support this)
timeoutlen = 1000, -- time to wait for a mapped sequence to complete (in milliseconds)
title = true, -- set the title of window to the value of the titlestring
-- opt.titlestring = "%<%F%=%l/%L - nvim" -- what the title of the window will be set to
undodir = undodir, -- set an undo directory
undofile = true, -- enable persistent undo
updatetime = 100, -- faster completion
writebackup = false, -- if a file is being edited by another program (or was written to file while editing with another program), it is not allowed to be edited
expandtab = true, -- convert tabs to spaces
shiftwidth = 2, -- the number of spaces inserted for each indentation
tabstop = 2, -- insert 2 spaces for a tab
cursorline = true, -- highlight the current line
number = true, -- set numbered lines
numberwidth = 4, -- set number column width to 2 {default 4}
signcolumn = "yes", -- always show the sign column, otherwise it would shift the text each time
wrap = true, -- display lines as one long line
-- shadafile = join_paths(get_cache_dir(), "lvim.shada"),
scrolloff = 8, -- minimal number of screen lines to keep above and below the cursor.
sidescrolloff = 8, -- minimal number of screen lines to keep left and right of the cursor.
showcmd = false,
ruler = false,
laststatus = 3,
}
local set_options = {
backup = false, -- creates a backup file
clipboard = "unnamedplus", -- allows neovim to access the system clipboard
cmdheight = 1, -- more space in the neovim command line for displaying messages
completeopt = { "menuone", "noselect" },
conceallevel = 0, -- so that `` is visible in markdown files
fileencoding = "utf-8", -- the encoding written to a file
foldmethod = "manual", -- folding, set to "expr" for treesitter based folding
foldexpr = "", -- set to "nvim_treesitter#foldexpr()" for treesitter based folding
guifont = "monospace:h17", -- the font used in graphical neovim applications
background = "light", -- set the background to light or dark
hidden = true, -- required to keep multiple buffers and open multiple buffers
hlsearch = true, -- highlight all matches on previous search pattern
ignorecase = true, -- ignore case in search patterns
mouse = "a", -- allow the mouse to be used in neovim
pumheight = 10, -- pop up menu height
showmode = false, -- we don't need to see things like -- INSERT -- anymore
showtabline = 2, -- always show tabs
smartcase = true, -- smart case
smartindent = true, -- make indenting smarter again
splitbelow = true, -- force all horizontal splits to go below current window
splitright = true, -- force all vertical splits to go to the right of current window
swapfile = false, -- creates a swapfile
termguicolors = true, -- set term gui colors (most terminals support this)
timeoutlen = 1000, -- time to wait for a mapped sequence to complete (in milliseconds)
title = true, -- set the title of window to the value of the titlestring
-- opt.titlestring = "%<%F%=%l/%L - nvim" -- what the title of the window will be set to
undodir = undodir, -- set an undo directory
undofile = true, -- enable persistent undo
updatetime = 100, -- faster completion
writebackup = false, -- if a file is being edited by another program (or was written to file while editing with another program), it is not allowed to be edited
expandtab = true, -- convert tabs to spaces
shiftwidth = 2, -- the number of spaces inserted for each indentation
tabstop = 2, -- insert 2 spaces for a tab
cursorline = true, -- highlight the current line
number = true, -- set numbered lines
numberwidth = 4, -- set number column width to 2 {default 4}
signcolumn = "yes", -- always show the sign column, otherwise it would shift the text each time
wrap = true, -- display lines as one long line
-- shadafile = join_paths(get_cache_dir(), "lvim.shada"),
scrolloff = 8, -- minimal number of screen lines to keep above and below the cursor.
sidescrolloff = 8, -- minimal number of screen lines to keep left and right of the cursor.
showcmd = false,
ruler = false,
laststatus = 3,
}
for k, v in pairs(set_options) do
vim.opt[k] = v
end
for k, v in pairs(set_options) do
vim.opt[k] = v
end
local let_options = {
-- disable netrw at the very start of your init.lua (strongly advised)
loaded = 1,
loaded_netrwPlugin = 1,
-- set leaderkey to space
mapleader = " ",
}
local let_options = {
-- disable netrw at the very start of your init.lua (strongly advised)
loaded = 1,
loaded_netrwPlugin = 1,
-- set leaderkey to space
mapleader = " ",
}
for k, v in pairs(let_options) do
vim.g[k] = v
end
end
for k, v in pairs(let_options) do
vim.g[k] = v
end
end
return M
return M

View File

@ -18,6 +18,20 @@ wk.register({
-- 代码相关
map("n", ",", ":RunCode<CR>", opt)
-- markdown related
-- markdown 相关
wk.register({
["<Leader>m"] = { ":MarkdownPreview<CR>", "Markdown preview" },
})
-- markdown table
-- markdown 表格
wk.register({
["<Leader>t"] = {
name = "+Table",
},
})
-- git related
-- git 相关
wk.register({

View File

@ -1,45 +1,53 @@
require('Comment').setup{
---Add a space b/w comment and the line
padding = true,
---Whether the cursor should stay at its position
sticky = true,
---Lines to be ignored while (un)comment
ignore = "^$",
---LHS of toggle mappings in NORMAL mode
toggler = {
---Line-comment toggle keymap
line = 'gcc',
---Block-comment toggle keymap
block = 'gbc',
},
---LHS of operator-pending mappings in NORMAL and VISUAL mode
opleader = {
---Line-comment keymap
line = 'gc',
---Block-comment keymap
block = 'gb',
},
---LHS of extra mappings
extra = {
---Add comment on the line above
above = 'gcO',
---Add comment on the line below
below = 'gco',
---Add comment at the end of line
eol = 'gcA',
},
---Enable keybindings
---NOTE: If given `false` then the plugin won't create any mappings
mappings = {
---Operator-pending mapping; `gcc` `gbc` `gc[count]{motion}` `gb[count]{motion}`
basic = true,
---Extra mapping; `gco`, `gcO`, `gcA`
extra = true,
---Extended mapping; `g>` `g<` `g>[count]{motion}` `g<[count]{motion}`
extended = false,
},
---Function to call before (un)comment
pre_hook = nil,
---Function to call after (un)comment
post_hook = nil,
}
require("Comment").setup({
---Add a space b/w comment and the line
padding = true,
---Whether the cursor should stay at its position
sticky = true,
---Lines to be ignored while (un)comment
ignore = "^$",
---LHS of toggle mappings in NORMAL mode
toggler = {
---Line-comment toggle keymap
line = "gcc",
---Block-comment toggle keymap
block = "gbc",
},
---LHS of operator-pending mappings in NORMAL and VISUAL mode
opleader = {
---Line-comment keymap
line = "gc",
---Block-comment keymap
block = "gb",
},
---LHS of extra mappings
extra = {
---Add comment on the line above
above = "gcO",
---Add comment on the line below
below = "gco",
---Add comment at the end of line
eol = "gcA",
},
---Enable keybindings
---NOTE: If given `false` then the plugin won't create any mappings
mappings = {
---Operator-pending mapping; `gcc` `gbc` `gc[count]{motion}` `gb[count]{motion}`
basic = true,
---Extra mapping; `gco`, `gcO`, `gcA`
extra = true,
---Extended mapping; `g>` `g<` `g>[count]{motion}` `g<[count]{motion}`
extended = false,
},
---Function to call before (un)comment
pre_hook = nil,
---Function to call after (un)comment
post_hook = nil,
})
-- cancel auto next line comment
-- 取消换行后自动添加注释
vim.api.nvim_create_autocmd("BufEnter", {
callback = function()
vim.opt.formatoptions = vim.opt.formatoptions - { "o" }
end,
})

View File

@ -0,0 +1,5 @@
local let_table_settings = {}
for k, v in pairs(let_table_settings) do
vim.g[k] = v
end

View File

@ -0,0 +1,8 @@
require("toggleterm").setup({
open_mapping = [[<C-\>]],
insert_mapping = true,
start_in_insert = true,
autochdir = true,
auto_scroll = false, -- automatically scroll to the bottom on terminal output
direction = "horizontal",
})

View File

@ -14,6 +14,10 @@ return require("packer").startup(function()
end,
})
-- a good terminal
-- 一个好的nvim内终端
use({ "akinsho/toggleterm.nvim", tag = "*" })
-- git plugin like magit
-- 类似magit的插件neogit
-- use({ "TimUntersberger/neogit", requires = "nvim-lua/plenary.nvim" })
@ -22,6 +26,17 @@ return require("packer").startup(function()
-- 使用lazygit接口
use("kdheepak/lazygit.nvim")
----------------- markdown --------------------
-- markdown preview
-- markdown自动预览
use({
"iamcco/markdown-preview.nvim",
})
-- markdown table
-- 优化markdown添加表格
use("dhruvasagar/vim-table-mode")
-- nvim-tree for file manage
use({
"kyazdani42/nvim-tree.lua",