change some buffers
This commit is contained in:
parent
c5128bda3c
commit
00b293c1d8
1
init.lua
1
init.lua
@ -17,6 +17,7 @@ require("plugin-config/nvim-autopairs")
|
||||
require("plugin-config/table-mode")
|
||||
require("plugin-config/project")
|
||||
require("plugin-config/dashboard")
|
||||
require("plugin-config/JABS")
|
||||
require("plugin-config/toggleterm")
|
||||
require("plugin-config/coderunner")
|
||||
require("plugin-config/lazygit")
|
||||
|
@ -10,7 +10,7 @@ M.load_default_options = function()
|
||||
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
|
||||
guifont = "Menlo:h17", -- the font used in graphical neovim applications
|
||||
background = "dark", -- 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
|
||||
|
@ -48,6 +48,7 @@ wk.register({
|
||||
name = "+File",
|
||||
p = { ":Telescope projects<CR>", "Open project" },
|
||||
r = { ":Telescope oldfiles<CR>", "Recent files" },
|
||||
f = { ":Telescope file_browser<CR>", "File browser" },
|
||||
n = { ":enew<CR>", "New file" },
|
||||
},
|
||||
})
|
||||
@ -84,7 +85,7 @@ map("v", "<", "<gv", opt)
|
||||
map("v", ">", ">gv", opt)
|
||||
|
||||
-- nvimTree
|
||||
map("n", "n", ":NvimTreeToggle<CR>", opt)
|
||||
map("n", "T", ":NvimTreeToggle<CR>", opt)
|
||||
|
||||
-- Packer
|
||||
wk.register({
|
||||
@ -102,9 +103,8 @@ wk.register({
|
||||
name = "+Buffer",
|
||||
k = { ":bd!<CR>", "Kill buffer" },
|
||||
o = { ":BufferLineCloseRight<CR>:BufferLineCloseLeft<CR>", "Close other buffer" },
|
||||
b = { ":bp<CR>", "Last buffer" },
|
||||
b = { ":JABSOpen<CR>", "Open buffers" },
|
||||
n = { ":ls<CR>", "Buffer numbers" },
|
||||
t = { ":b ", "To buffer" },
|
||||
c = { ":noh<CR>", "Cancel highlight" },
|
||||
},
|
||||
})
|
||||
|
@ -1,6 +1,5 @@
|
||||
local lspkind = require("lspkind")
|
||||
local cmp = require("cmp")
|
||||
|
||||
cmp.setup({
|
||||
-- 指定 snippet 引擎
|
||||
snippet = {
|
||||
@ -78,3 +77,6 @@ require("lsp_signature").setup(signature_config)
|
||||
local cmp_autopairs = require("nvim-autopairs.completion.cmp")
|
||||
|
||||
cmp.event:on("confirm_done", cmp_autopairs.on_confirm_done({ map_char = { tex = "" } }))
|
||||
|
||||
-- use friendly snippet
|
||||
require("luasnip.loaders.from_vscode").lazy_load()
|
||||
|
21
lua/lsp/config/gopls.lua
Normal file
21
lua/lsp/config/gopls.lua
Normal file
@ -0,0 +1,21 @@
|
||||
return {
|
||||
on_setup = function(server)
|
||||
server.setup({
|
||||
flags = {
|
||||
debounce_text_changes = 150,
|
||||
},
|
||||
on_attach = function(client, bufnr)
|
||||
-- 禁用格式化功能,交给专门插件插件处理
|
||||
client.server_capabilities.document_formatting = false
|
||||
client.server_capabilities.document_range_formatting = false
|
||||
|
||||
-- local function buf_set_keymap(...)
|
||||
-- vim.api.nvim_buf_set_keymap(bufnr, ...)
|
||||
-- end
|
||||
-- local function buf_set_option(...) vim.api.nvim_buf_set_option(bufnr, ...) end
|
||||
-- 绑定快捷键
|
||||
-- require("keybindings").mapLSP(buf_set_keymap)
|
||||
end,
|
||||
})
|
||||
end,
|
||||
}
|
@ -7,6 +7,7 @@ local lspconfig = require("lspconfig")
|
||||
local servers = {
|
||||
sumneko_lua = require("lsp.config.lua"), -- lua/lsp/config/lua.lua
|
||||
clangd = require("lsp.config.clangd"),
|
||||
gopls = require("lsp.config.gopls"),
|
||||
-- bashls = require("lsp.config.bash"),
|
||||
pyright = require("lsp.config.pyright"),
|
||||
-- html = require("lsp.config.html"),
|
||||
|
@ -14,6 +14,7 @@ require("null-ls").setup({
|
||||
sources = {
|
||||
require("null-ls").builtins.formatting.stylua,
|
||||
require("null-ls").builtins.formatting.clang_format,
|
||||
require("null-ls").builtins.formatting.gofmt,
|
||||
},
|
||||
-- you can reuse a shared lspconfig on_attach callback here
|
||||
on_attach = function(client, bufnr)
|
||||
|
1
lua/plugin-config/JABS.lua
Normal file
1
lua/plugin-config/JABS.lua
Normal file
@ -0,0 +1 @@
|
||||
require("jabs").setup({})
|
@ -1,4 +1,4 @@
|
||||
require('telescope').setup{
|
||||
require("telescope").setup({
|
||||
defaults = {
|
||||
-- Default configuration for telescope goes here:
|
||||
-- config_key = value,
|
||||
@ -7,9 +7,9 @@ require('telescope').setup{
|
||||
-- map actions.which_key to <C-h> (default: <C-/>)
|
||||
-- actions.which_key shows the mappings for your picker,
|
||||
-- e.g. git_{create, delete, ...}_branch for the git_branches picker
|
||||
["<C-h>"] = "which_key"
|
||||
}
|
||||
}
|
||||
["<C-h>"] = "which_key",
|
||||
},
|
||||
},
|
||||
},
|
||||
pickers = {
|
||||
-- Default configuration for builtin pickers goes here:
|
||||
@ -21,12 +21,26 @@ require('telescope').setup{
|
||||
-- builtin picker
|
||||
},
|
||||
extensions = {
|
||||
file_browser = {
|
||||
theme = "ivy",
|
||||
-- disables netrw and use telescope-file-browser in its place
|
||||
hijack_netrw = true,
|
||||
mappings = {
|
||||
["i"] = {
|
||||
-- your custom insert mode mappings
|
||||
},
|
||||
["n"] = {
|
||||
-- your custom normal mode mappings
|
||||
},
|
||||
-- Your extension configuration goes here:
|
||||
-- extension_name = {
|
||||
-- extension_config_key = value,
|
||||
-- }
|
||||
-- please take a look at the readme of the extension you want to configure
|
||||
}
|
||||
}
|
||||
},
|
||||
},
|
||||
},
|
||||
})
|
||||
|
||||
require('telescope').load_extension('projects')
|
||||
require("telescope").load_extension("projects")
|
||||
require("telescope").load_extension("file_browser")
|
||||
|
@ -60,6 +60,9 @@ return require("packer").startup(function()
|
||||
-- 顶部状态栏
|
||||
use({ "akinsho/bufferline.nvim", requires = "kyazdani42/nvim-web-devicons" })
|
||||
|
||||
-- 更方便的切换buffer
|
||||
use({ "matbme/JABS.nvim" })
|
||||
|
||||
-- treesitter
|
||||
use({
|
||||
"nvim-treesitter/nvim-treesitter",
|
||||
@ -68,15 +71,18 @@ return require("packer").startup(function()
|
||||
end,
|
||||
})
|
||||
|
||||
--------------------- file related -------------------------------
|
||||
-- telescope
|
||||
use({
|
||||
"nvim-telescope/telescope.nvim",
|
||||
requires = { { "nvim-lua/plenary.nvim" } },
|
||||
})
|
||||
|
||||
-- telescope-file-browser
|
||||
use({ "nvim-telescope/telescope-file-browser.nvim" })
|
||||
|
||||
-- project
|
||||
-- 项目管理
|
||||
-- Lua
|
||||
use({
|
||||
"ahmedkhalf/project.nvim",
|
||||
})
|
||||
|
16
readme.md
16
readme.md
@ -35,7 +35,7 @@
|
||||
### 常用
|
||||
| key | function |
|
||||
|----------------|-------------------------------------------|
|
||||
| n | 打开nvim-tree文件浏览 |
|
||||
| T | 打开nvim-tree文件浏览 |
|
||||
| f | 打开telescope进行文件查找 |
|
||||
| Ctrl-h | 切换到左标签栏 |
|
||||
| Ctrl-l | 切换到右标签栏 |
|
||||
@ -75,10 +75,16 @@
|
||||
| \<Ctrl-n> | step into |
|
||||
| \<Ctrl-o> | step over |
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
### buffer
|
||||
| key | function |
|
||||
|-------------|----------------|
|
||||
| \<leader>bb | 打开某个buffer |
|
||||
| \<leader>bk | 关闭当前buffer |
|
||||
|
||||
## 问题
|
||||
|
||||
### 根据文件类型启动某些功能
|
||||
可以在ftplugin文件夹中放入对应文件类型的lua文件,如markdown.lua对应markdown文件.写入要执行的命令即可.例子可见ftplugin/markdown中启动markdown table mode
|
||||
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user