Compare commits
14 Commits
e29a422a57
...
e2ae192ffb
Author | SHA1 | Date | |
---|---|---|---|
e2ae192ffb | |||
28016cd063 | |||
bc06d78d18 | |||
1a6fe3ab86 | |||
7a1aecf89c | |||
192e7cc48f | |||
4aa9f05ffa | |||
2211a8f2e9 | |||
6fc2db442f | |||
8089b4d42d | |||
75aeb8c5f5 | |||
a8797860e1 | |||
3e138a5f5e | |||
fe668d4424 |
@ -81,3 +81,7 @@ neomap('i', '<S-TAB>', '<C-d>', { noremap = true, silent = true }) -- Insert Mod
|
|||||||
-- 透過 v 選取整行縮排後,不取消選取整行
|
-- 透過 v 選取整行縮排後,不取消選取整行
|
||||||
neomap('v', '<', '<gv', { noremap = true, silent = true })
|
neomap('v', '<', '<gv', { noremap = true, silent = true })
|
||||||
neomap('v', '>', '>gv', { noremap = true, silent = true })
|
neomap('v', '>', '>gv', { noremap = true, silent = true })
|
||||||
|
|
||||||
|
-- 自動折行開關切換
|
||||||
|
map("n", "<A-z>", "<cmd>set wrap!<CR>", { noremap = true, silent = true, desc = "Toggle Auto Wrap Line" })
|
||||||
|
map("i", "<A-z>", "<Esc><cmd>set wrap!<CR>a", { noremap = true, silent = true, desc = "Toggle Auto Wrap Line" })
|
||||||
|
@ -1,10 +1,10 @@
|
|||||||
-- 編輯器行為設定
|
-- 編輯器行為設定
|
||||||
vim.api.nvim_set_option("clipboard", "unnamedplus") -- 使用系統剪貼簿(Wayland有直接支援,不須依賴vim-wayland-clipboard)
|
vim.api.nvim_set_option("clipboard", "unnamedplus") -- 使用系統剪貼簿(nvim Wayland有直接支援,不須依賴vim-wayland-clipboard)
|
||||||
vim.opt.confirm = true -- 操作過程有衝突時,以明確的文字來詢問
|
vim.opt.confirm = true -- 操作過程有衝突時,以明確的文字來詢問
|
||||||
vim.opt.history = 10000 -- 設定命令歷史記錄數量為 10000
|
vim.opt.history = 10000 -- 設定命令歷史記錄數量為 10000
|
||||||
-- vim.opt.directory = "." -- 將暫存檔存放在當前資料夾中
|
-- vim.opt.directory = "." -- 將暫存檔存放在當前資料夾中
|
||||||
-- require("config.swap") -- 將暫存檔存放置位置另外做邏輯
|
-- require("tools.swap") -- 將暫存檔存放置位置另外做邏輯
|
||||||
vim.opt.mouse = "a" -- 啟用滑鼠支援
|
vim.opt.mouse = "a" -- 啟用滑鼠支援
|
||||||
|
|
||||||
-- 編碼設定
|
-- 編碼設定
|
||||||
vim.opt.encoding = "utf-8"
|
vim.opt.encoding = "utf-8"
|
||||||
@ -12,15 +12,16 @@ vim.opt.fileencodings = { "utf-8", "cp950" }
|
|||||||
vim.opt.enc = "utf-8"
|
vim.opt.enc = "utf-8"
|
||||||
|
|
||||||
-- 設定編輯選項
|
-- 設定編輯選項
|
||||||
vim.opt.number = true -- 顯示行號
|
vim.opt.number = true -- 顯示行號
|
||||||
vim.opt.relativenumber = false -- 相對行號
|
vim.opt.relativenumber = false -- 相對行號
|
||||||
vim.opt.tabstop = 4 -- tab鍵寬度
|
vim.opt.tabstop = 4 -- tab鍵寬度
|
||||||
vim.opt.shiftwidth = 4 -- 自動縮排寬度
|
vim.opt.shiftwidth = 4 -- 自動縮排寬度
|
||||||
vim.opt.expandtab = true -- 使用空格代替tab
|
vim.opt.expandtab = true -- 使用空格代替tab
|
||||||
vim.opt.termguicolors = true -- 支持真彩色
|
vim.opt.termguicolors = true -- 支持真彩色
|
||||||
|
vim.opt.wrap = true -- 不自動換折行
|
||||||
vim.opt.colorcolumn = "80,120" -- 顯示編輯器建議寬度
|
vim.opt.colorcolumn = "80,120" -- 顯示編輯器建議寬度
|
||||||
vim.opt.scrolloff = 3 -- 捲動時保留 n 行彈性
|
vim.opt.scrolloff = 3 -- 捲動時保留 n 行彈性
|
||||||
require("config.listchars") -- 顯示行尾符號
|
require("config.listchars") -- 顯示行尾符號
|
||||||
vim.opt.list = true
|
vim.opt.list = true
|
||||||
|
|
||||||
-- 設定正確的檔案類型對應
|
-- 設定正確的檔案類型對應
|
||||||
|
@ -0,0 +1,39 @@
|
|||||||
|
return {
|
||||||
|
{
|
||||||
|
"folke/trouble.nvim",
|
||||||
|
opts = {}, -- for default options, refer to the configuration section for custom setup.
|
||||||
|
cmd = "Trouble",
|
||||||
|
keys = {
|
||||||
|
{
|
||||||
|
"<leader>xx",
|
||||||
|
"<cmd>Trouble diagnostics toggle<cr>",
|
||||||
|
desc = "Diagnostics (Trouble)",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"<leader>xX",
|
||||||
|
"<cmd>Trouble diagnostics toggle filter.buf=0<cr>",
|
||||||
|
desc = "Buffer Diagnostics (Trouble)",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"<leader>cs",
|
||||||
|
"<cmd>Trouble symbols toggle focus=false<cr>",
|
||||||
|
desc = "Symbols (Trouble)",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"<leader>cl",
|
||||||
|
"<cmd>Trouble lsp toggle focus=false win.position=right<cr>",
|
||||||
|
desc = "LSP Definitions / references / ... (Trouble)",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"<leader>xL",
|
||||||
|
"<cmd>Trouble loclist toggle<cr>",
|
||||||
|
desc = "Location List (Trouble)",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"<leader>xQ",
|
||||||
|
"<cmd>Trouble qflist toggle<cr>",
|
||||||
|
desc = "Quickfix List (Trouble)",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}
|
@ -5,24 +5,46 @@ return {
|
|||||||
-- 'lewis6991/gitsigns.nvim', -- OPTIONAL: for git status
|
-- 'lewis6991/gitsigns.nvim', -- OPTIONAL: for git status
|
||||||
'nvim-tree/nvim-web-devicons', -- OPTIONAL: for file icons
|
'nvim-tree/nvim-web-devicons', -- OPTIONAL: for file icons
|
||||||
},
|
},
|
||||||
|
lazy = false,
|
||||||
init = function() vim.g.barbar_auto_setup = false end,
|
init = function() vim.g.barbar_auto_setup = false end,
|
||||||
-- opts = {
|
opts = {
|
||||||
-- -- lazy.nvim will automatically call setup for you. put your options here, anything missing will use the default:
|
-- lazy.nvim will automatically call setup for you. put your options here, anything missing will use the default:
|
||||||
-- -- animation = false,
|
auto_hide = -1,
|
||||||
-- -- insert_at_start = true,
|
clickable = true,
|
||||||
-- -- …etc.
|
icons = {
|
||||||
-- },
|
buffer_index = false,
|
||||||
config = function(_, opts)
|
buffer_number = false,
|
||||||
require'bufferline'.setup {
|
button = '',
|
||||||
-- animation = false, -- 禁用動畫效果
|
diagnostics = {{enabled = true}, {enabled = true}},
|
||||||
sidebar_filetypes = {
|
filetype = {enabled = true},
|
||||||
['neo-tree'] = {event = 'BufWipeout'},
|
separator = {left = '▎', right = ''},
|
||||||
undotree = {
|
-- separator = {left = '', right = ''},
|
||||||
text = 'undotree',
|
},
|
||||||
align = 'center', -- *optionally* specify an alignment (either 'left', 'center', or 'right')
|
sidebar_filetypes = {
|
||||||
},
|
['neo-tree'] = {event = 'BufWipeout'},
|
||||||
|
undotree = {
|
||||||
|
text = 'undotree',
|
||||||
|
align = 'center', -- *optionally* specify an alignment (either 'left', 'center', or 'right')
|
||||||
},
|
},
|
||||||
}
|
},
|
||||||
|
-- icons = {current = {filetype = {enabled = false}}},
|
||||||
|
-- maximum_padding = math.huge,
|
||||||
|
-- animation = false,
|
||||||
|
-- insert_at_start = true,
|
||||||
|
-- …etc.
|
||||||
|
},
|
||||||
|
config = function(_, opts)
|
||||||
|
-- require'bufferline'.setup {
|
||||||
|
-- -- animation = false, -- 禁用動畫效果
|
||||||
|
-- sidebar_filetypes = {
|
||||||
|
-- ['neo-tree'] = {event = 'BufWipeout'},
|
||||||
|
-- undotree = {
|
||||||
|
-- text = 'undotree',
|
||||||
|
-- align = 'center', -- *optionally* specify an alignment (either 'left', 'center', or 'right')
|
||||||
|
-- },
|
||||||
|
-- },
|
||||||
|
-- }
|
||||||
|
require('barbar').setup(opts)
|
||||||
|
|
||||||
-- 重定義 :q 命令為僅關閉當前 Buffer
|
-- 重定義 :q 命令為僅關閉當前 Buffer
|
||||||
vim.api.nvim_create_user_command('Q', function()
|
vim.api.nvim_create_user_command('Q', function()
|
||||||
|
@ -12,6 +12,7 @@ return {
|
|||||||
build = ":TSUpdate",
|
build = ":TSUpdate",
|
||||||
config = function()
|
config = function()
|
||||||
require("nvim-treesitter.configs").setup({
|
require("nvim-treesitter.configs").setup({
|
||||||
|
-- <https://github.com/nvim-treesitter/nvim-treesitter#supported-languages>
|
||||||
ensure_installed = {
|
ensure_installed = {
|
||||||
"regex",
|
"regex",
|
||||||
"lua",
|
"lua",
|
||||||
|
@ -43,8 +43,20 @@ return {
|
|||||||
{ "hrsh7th/nvim-cmp" },
|
{ "hrsh7th/nvim-cmp" },
|
||||||
|
|
||||||
-- " For luasnip users.
|
-- " For luasnip users.
|
||||||
{ "L3MON4D3/LuaSnip" },
|
{
|
||||||
|
"L3MON4D3/LuaSnip",
|
||||||
|
dependencies = {
|
||||||
|
"rafamadriz/friendly-snippets",
|
||||||
|
},
|
||||||
|
config = function()
|
||||||
|
require("luasnip.loaders.from_vscode").lazy_load()
|
||||||
|
end,
|
||||||
|
},
|
||||||
{ "saadparwaiz1/cmp_luasnip" },
|
{ "saadparwaiz1/cmp_luasnip" },
|
||||||
|
|
||||||
{ "rafamadriz/friendly-snippets" },
|
-- { "rafamadriz/friendly-snippets" },
|
||||||
|
|
||||||
|
{ "onsails/lspkind.nvim",
|
||||||
|
lazy = true,
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -5,7 +5,7 @@ cmp.setup({
|
|||||||
snippet = {
|
snippet = {
|
||||||
-- REQUIRED - you must specify a snippet engine
|
-- REQUIRED - you must specify a snippet engine
|
||||||
expand = function(args)
|
expand = function(args)
|
||||||
vim.fn["vsnip#anonymous"](args.body) -- For `vsnip` users.
|
-- vim.fn["vsnip#anonymous"](args.body) -- For `vsnip` users.
|
||||||
require('luasnip').lsp_expand(args.body) -- For `luasnip` users.
|
require('luasnip').lsp_expand(args.body) -- For `luasnip` users.
|
||||||
-- require('snippy').expand_snippet(args.body) -- For `snippy` users.
|
-- require('snippy').expand_snippet(args.body) -- For `snippy` users.
|
||||||
-- vim.fn["UltiSnips#Anon"](args.body) -- For `ultisnips` users.
|
-- vim.fn["UltiSnips#Anon"](args.body) -- For `ultisnips` users.
|
||||||
@ -18,22 +18,8 @@ cmp.setup({
|
|||||||
-- require("cmp.config").set_onetime({ sources = {} })
|
-- require("cmp.config").set_onetime({ sources = {} })
|
||||||
end,
|
end,
|
||||||
},
|
},
|
||||||
window = {
|
-- 設定來源
|
||||||
-- completion = cmp.config.window.bordered(),
|
-- <https://github.com/hrsh7th/nvim-cmp/wiki/Menu-Appearance#how-to-add-custom-icons-for-any-source>
|
||||||
-- documentation = cmp.config.window.bordered(),
|
|
||||||
},
|
|
||||||
mapping = cmp.mapping.preset.insert({
|
|
||||||
['<C-b>'] = cmp.mapping.scroll_docs(-4),
|
|
||||||
['<C-f>'] = cmp.mapping.scroll_docs(4),
|
|
||||||
['<C-Space>'] = cmp.mapping.complete(),
|
|
||||||
['<C-e>'] = cmp.mapping.abort(),
|
|
||||||
['<CR>'] = cmp.mapping.confirm({ select = true }), -- Accept currently selected item. Set `select` to `false` to only confirm explicitly selected items.
|
|
||||||
|
|
||||||
-- AI範例:
|
|
||||||
-- ["<Tab>"] = cmp.mapping.select_next_item(),
|
|
||||||
-- ["<S-Tab>"] = cmp.mapping.select_prev_item(),
|
|
||||||
-- ["<CR>"] = cmp.mapping.confirm({ select = true }),
|
|
||||||
}),
|
|
||||||
sources = cmp.config.sources({
|
sources = cmp.config.sources({
|
||||||
{ name = 'nvim_lsp' },
|
{ name = 'nvim_lsp' },
|
||||||
-- { name = 'vsnip' }, -- For vsnip users.
|
-- { name = 'vsnip' }, -- For vsnip users.
|
||||||
@ -42,7 +28,78 @@ cmp.setup({
|
|||||||
-- { name = 'snippy' }, -- For snippy users.
|
-- { name = 'snippy' }, -- For snippy users.
|
||||||
}, {
|
}, {
|
||||||
{ name = 'buffer' },
|
{ name = 'buffer' },
|
||||||
})
|
{ name = 'path' },
|
||||||
|
}),
|
||||||
|
|
||||||
|
-- 按鍵對應
|
||||||
|
mapping = cmp.mapping.preset.insert({
|
||||||
|
["<C-p>"] = cmp.mapping.select_prev_item(),
|
||||||
|
["<C-n>"] = cmp.mapping.select_next_item(),
|
||||||
|
-- ["<C-d>"] = cmp.mapping.scroll_docs(-4), --已知會衝到,先關閉
|
||||||
|
-- ["<C-f>"] = cmp.mapping.scroll_docs(4), --已知會衝到,先關閉
|
||||||
|
['<C-Space>'] = cmp.mapping.complete(),
|
||||||
|
['<C-e>'] = cmp.mapping.abort(),
|
||||||
|
-- ['<CR>'] = cmp.mapping.confirm({ select = true }), -- Accept currently selected item. Set `select` to `false` to only confirm explicitly selected items.
|
||||||
|
["<CR>"] = cmp.mapping.confirm {
|
||||||
|
behavior = cmp.ConfirmBehavior.Insert,
|
||||||
|
select = true,
|
||||||
|
},
|
||||||
|
-- ["<Tab>"] = cmp.mapping.confirm {
|
||||||
|
-- behavior = cmp.ConfirmBehavior.Insert,
|
||||||
|
-- select = true,
|
||||||
|
-- },
|
||||||
|
|
||||||
|
-- -- 取自 <https://github.com/NvChad/NvChad/blob/v2.5/lua/nvchad/configs/cmp.lua>
|
||||||
|
["<Tab>"] = cmp.mapping(function(fallback)
|
||||||
|
if cmp.visible() then
|
||||||
|
cmp.confirm {
|
||||||
|
behavior = cmp.ConfirmBehavior.Insert,
|
||||||
|
select = true,
|
||||||
|
}
|
||||||
|
-- cmp.select_next_item() -- NvChad原始作用
|
||||||
|
elseif require("luasnip").expand_or_jumpable() then
|
||||||
|
require("luasnip").expand_or_jump()
|
||||||
|
else
|
||||||
|
fallback()
|
||||||
|
end
|
||||||
|
end, { "i", "s" }),
|
||||||
|
|
||||||
|
["<S-Tab>"] = cmp.mapping(function(fallback)
|
||||||
|
if cmp.visible() then
|
||||||
|
fallback()
|
||||||
|
-- cmp.select_prev_item() -- NvChad原始作用
|
||||||
|
elseif require("luasnip").jumpable(-1) then
|
||||||
|
require("luasnip").jump(-1)
|
||||||
|
else
|
||||||
|
fallback()
|
||||||
|
end
|
||||||
|
end, { "i", "s" }),
|
||||||
|
|
||||||
|
-- AI範例:
|
||||||
|
-- ["<Tab>"] = cmp.mapping.select_next_item(),
|
||||||
|
-- ["<S-Tab>"] = cmp.mapping.select_prev_item(),
|
||||||
|
-- ["<CR>"] = cmp.mapping.confirm({ select = true }),
|
||||||
|
}),
|
||||||
|
|
||||||
|
-- 外觀設定
|
||||||
|
window = {
|
||||||
|
completion = {
|
||||||
|
winhighlight = "Normal:Pmenu,FloatBorder:Pmenu,Search:None",
|
||||||
|
col_offset = -3,
|
||||||
|
side_padding = 0,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
formatting = {
|
||||||
|
fields = { "kind", "abbr", "menu" },
|
||||||
|
format = function(entry, vim_item)
|
||||||
|
local kind = require("lspkind").cmp_format({ mode = "symbol_text", maxwidth = 50 })(entry, vim_item)
|
||||||
|
local strings = vim.split(kind.kind, "%s", { trimempty = true })
|
||||||
|
kind.kind = " " .. (strings[1] or "") .. " "
|
||||||
|
kind.menu = " (" .. (strings[2] or "") .. ")"
|
||||||
|
|
||||||
|
return kind
|
||||||
|
end,
|
||||||
|
},
|
||||||
})
|
})
|
||||||
|
|
||||||
-- To use git you need to install the plugin petertriho/cmp-git and uncomment lines below
|
-- To use git you need to install the plugin petertriho/cmp-git and uncomment lines below
|
||||||
|
@ -11,6 +11,7 @@ Name=Breath2
|
|||||||
Parent=FALLBACK/
|
Parent=FALLBACK/
|
||||||
ShowTerminalSizeHint=true
|
ShowTerminalSizeHint=true
|
||||||
TerminalCenter=false
|
TerminalCenter=false
|
||||||
|
TerminalMargin=0
|
||||||
|
|
||||||
[Interaction Options]
|
[Interaction Options]
|
||||||
OpenLinksByDirectClickEnabled=true
|
OpenLinksByDirectClickEnabled=true
|
||||||
|
Loading…
x
Reference in New Issue
Block a user