Skip to content

Commit

Permalink
Update .config/nvim/init.lua
Browse files Browse the repository at this point in the history
Update .config/nvim/lua/plugins/barbar.lua
Update .config/nvim/lua/plugins/fidget.lua
Update .config/nvim/lua/plugins/fzf.lua
Update .config/nvim/lua/plugins/lexima.lua
Update .config/nvim/lua/plugins/memolist.lua
Update .config/nvim/lua/plugins/nvim-lspconfig.lua
Update .config/nvim/lua/plugins/nvim-tree.lua
Update .config/nvim/lua/plugins/nvim-treesitter.lua
Update .config/nvim/lua/plugins/slimline.lua
  • Loading branch information
Hyuga-Tsukui committed Nov 13, 2024
1 parent a6e7531 commit caff6f5
Show file tree
Hide file tree
Showing 10 changed files with 244 additions and 225 deletions.
29 changes: 14 additions & 15 deletions dot_config/nvim/init.lua
Original file line number Diff line number Diff line change
@@ -1,19 +1,18 @@
if not vim.g.vscode then
require("core.options")
require("core.keymaps")
-- disable netrw at the very start of your init.lua
vim.g.loaded_netrw = 1
vim.g.loaded_netrwPlugin = 1
require("core.options")
require("core.keymaps")
-- disable netrw at the very start of your init.lua
vim.g.loaded_netrw = 1
vim.g.loaded_netrwPlugin = 1
vim.opt.laststatus = 0 -- status-line系のpluginへの切り替え時のちらつきを防ぐためにデフォルトは表示しないようにする.

vim.opt.laststatus = 3
require("config.lazy")

require("config.lazy")

vim.diagnostic.config({
virtual_text = {
format = function(diagnostic)
return string.format("%s (%s: %s)", diagnostic.message, diagnostic.source, diagnostic.code)
end,
},
})
vim.diagnostic.config({
virtual_text = {
format = function(diagnostic)
return string.format("%s (%s: %s)", diagnostic.message, diagnostic.source, diagnostic.code)
end,
},
})
end
82 changes: 43 additions & 39 deletions dot_config/nvim/lua/plugins/barbar.lua
Original file line number Diff line number Diff line change
@@ -1,42 +1,46 @@
return {
"romgrk/barbar.nvim",
dependencies = {
"lewis6991/gitsigns.nvim",
"nvim-tree/nvim-web-devicons",
},
event = { "BufEnter" },
config = function()
require("barbar").setup({
sidebar_filetypes = {
-- Use the default values: {event = 'BufWinLeave', text = '', align = 'left'}
NvimTree = true,
-- Or, specify the text used for the offset:
undotree = {
text = "undotree",
align = "center", -- *optionally* specify an alignment (either 'left', 'center', or 'right')
},
-- Or, specify the event which the sidebar executes when leaving:
["neo-tree"] = { event = "BufWipeout" },
-- Or, specify all three
Outline = { event = "BufWinLeave", text = "symbols-outline", align = "right" },
},
animation = false,
})
vim.keymap.set("n", "<TAB>", "<Cmd>BufferPrevious<CR>", { noremap = true, silent = true })
vim.keymap.set("n", "<S-TAB>", "<Cmd>BufferNext<CR>", { noremap = true, silent = true })
vim.keymap.set("n", "<leader>p", "<Cmd>BufferPick<CR>", { noremap = true, silent = true })
vim.keymap.set("n", "<leader>w", "<Cmd>BufferClose<CR>", { noremap = true, silent = true })
vim.keymap.set("n", "<leader>ac", "<Cmd>BufferCloseAllButCurrent<CR>", { noremap = true, silent = true })
"romgrk/barbar.nvim",
dependencies = {
"lewis6991/gitsigns.nvim",
"nvim-tree/nvim-web-devicons",
},
event = { "BufRead", "BufNewFile" },
cond = function()
local exclude_filetypes = { "NvimTree" }
return not vim.tbl_contains(exclude_filetypes, vim.bo.filetype)
end,
config = function()
require("barbar").setup({
sidebar_filetypes = {
-- Use the default values: {event = 'BufWinLeave', text = '', align = 'left'}
NvimTree = true,
-- Or, specify the text used for the offset:
undotree = {
text = "undotree",
align = "center", -- *optionally* specify an alignment (either 'left', 'center', or 'right')
},
-- Or, specify the event which the sidebar executes when leaving:
["neo-tree"] = { event = "BufWipeout" },
-- Or, specify all three
Outline = { event = "BufWinLeave", text = "symbols-outline", align = "right" },
},
animation = false,
})
vim.keymap.set("n", "<TAB>", "<Cmd>BufferPrevious<CR>", { noremap = true, silent = true })
vim.keymap.set("n", "<S-TAB>", "<Cmd>BufferNext<CR>", { noremap = true, silent = true })
vim.keymap.set("n", "<leader>p", "<Cmd>BufferPick<CR>", { noremap = true, silent = true })
vim.keymap.set("n", "<leader>w", "<Cmd>BufferClose<CR>", { noremap = true, silent = true })
vim.keymap.set("n", "<leader>ac", "<Cmd>BufferCloseAllButCurrent<CR>", { noremap = true, silent = true })

local max_buf = 6
local function close_buffer()
local buffer_count = vim.fn.len(vim.fn.getbufinfo({ buflisted = 1 }))
if buffer_count >= max_buf then
vim.cmd("BufferCloseAllButCurrent")
end
end
vim.api.nvim_create_autocmd("BufEnter", {
callback = close_buffer,
})
end,
local max_buf = 6
local function close_buffer()
local buffer_count = vim.fn.len(vim.fn.getbufinfo({ buflisted = 1 }))
if buffer_count >= max_buf then
vim.cmd("BufferCloseAllButCurrent")
end
end
vim.api.nvim_create_autocmd("BufEnter", {
callback = close_buffer,
})
end,
}
9 changes: 5 additions & 4 deletions dot_config/nvim/lua/plugins/fidget.lua
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
return {
"j-hui/fidget.nvim",
opts = {
-- options
},
"j-hui/fidget.nvim",
event = "BufRead",
opts = {
-- options
},
}
33 changes: 17 additions & 16 deletions dot_config/nvim/lua/plugins/fzf.lua
Original file line number Diff line number Diff line change
@@ -1,18 +1,19 @@
return {
"ibhagwan/fzf-lua",
keys = {
"<C-p>",
"<C-r>",
},
config = function()
require("fzf-lua").setup({
keymap = {
fzf = {
["ctrl-q"] = "select-all+accept", -- send quick fix to quickfix list
},
},
})
vim.keymap.set("n", "<C-p>", ":FzfLua files<CR>", { noremap = true })
vim.keymap.set("c", "<C-r>", "<C-c>:FzfLua command_history<CR>", { noremap = true, silent = true })
end,
"ibhagwan/fzf-lua",
keys = {
"<C-p>",
"<C-r>",
},
cmd = "FzfLua",
config = function()
require("fzf-lua").setup({
keymap = {
fzf = {
["ctrl-q"] = "select-all+accept", -- send quick fix to quickfix list
},
},
})
vim.keymap.set("n", "<C-p>", ":FzfLua files<CR>", { noremap = true })
vim.keymap.set("c", "<C-r>", "<C-c>:FzfLua command_history<CR>", { noremap = true, silent = true })
end,
}
3 changes: 2 additions & 1 deletion dot_config/nvim/lua/plugins/lexima.lua
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
return {
"cohama/lexima.vim",
"cohama/lexima.vim",
event = "InsertEnter",
}
15 changes: 11 additions & 4 deletions dot_config/nvim/lua/plugins/memolist.lua
Original file line number Diff line number Diff line change
@@ -1,6 +1,13 @@
return {
"glidenote/memolist.vim",
config = function()
vim.g.memolist_path = vim.fn.expand("~/.config/memo/_posts")
end,
"glidenote/memolist.vim",
cmd = {
"MemoList",
"MemoNew",
"MemoGrep",
"MemoNewWithMeta",
"MemoNewCopyingMeta",
},
config = function()
vim.g.memolist_path = vim.fn.expand("~/.config/memo/_posts")
end,
}
170 changes: 85 additions & 85 deletions dot_config/nvim/lua/plugins/nvim-lspconfig.lua
Original file line number Diff line number Diff line change
@@ -1,93 +1,93 @@
return {
{
"williamboman/mason.nvim",
config = function()
require("mason").setup({})
end,
cmd = { "Mason" },
lazy = true,
},
{
"williamboman/mason-lspconfig.nvim",
config = function()
require("mason-lspconfig").setup({})
end,
lazy = true,
},
{
"neovim/nvim-lspconfig",
event = { "BufReadPre", "BufNewFile" },
cond = function()
-- 現在のバッファのファイルタイプが特定のもの (例: NvimTree) でないことを確認
local exclude_filetypes = { "NvimTree" }
return not vim.tbl_contains(exclude_filetypes, vim.bo.filetype)
end,
config = function()
local lspconfig = require("lspconfig")
require("mason-lspconfig").setup_handlers({
-- 1. デフォルトのハンドラー
-- すべてのサーバーに対して共通の設定を適用
function(server_name)
lspconfig[server_name].setup({})
end,
{
"williamboman/mason.nvim",
config = function()
require("mason").setup({})
end,
cmd = { "Mason" },
lazy = true,
},
{
"williamboman/mason-lspconfig.nvim",
config = function()
require("mason-lspconfig").setup({})
end,
lazy = true,
},
{
"neovim/nvim-lspconfig",
event = { "BufReadPre", "BufNewFile" },
cond = function()
-- 現在のバッファのファイルタイプが特定のもの (例: NvimTree) でないことを確認
local exclude_filetypes = { "NvimTree" }
return not vim.tbl_contains(exclude_filetypes, vim.bo.filetype)
end,
config = function()
local lspconfig = require("lspconfig")
require("mason-lspconfig").setup_handlers({
-- 1. デフォルトのハンドラー
-- すべてのサーバーに対して共通の設定を適用
function(server_name)
lspconfig[server_name].setup({})
end,

-- 2. 特定のサーバーに対するカスタム設定
-- 例:rust_analyzer の場合、rust-tools を使用した設定
-- ["rust_analyzer"] = function()
-- require("rust-tools").setup({})
-- end,
["lua_ls"] = function()
lspconfig.lua_ls.setup({
settings = {
Lua = {
diagnostics = {
globals = {
"vim",
},
},
},
},
})
end,
-- 2. 特定のサーバーに対するカスタム設定
-- 例:rust_analyzer の場合、rust-tools を使用した設定
-- ["rust_analyzer"] = function()
-- require("rust-tools").setup({})
-- end,
["lua_ls"] = function()
lspconfig.lua_ls.setup({
settings = {
Lua = {
diagnostics = {
globals = {
"vim",
},
},
},
},
})
end,

-- ["terraformls"] = function()
-- lspconfig.terraformls.setup({
-- on_attach = function(client, _)
-- client.server_capabilities.semanticTokensProvider = nil
-- end,
-- })
-- end,
["terraformls"] = function()
lspconfig.terraformls.setup({
on_attach = function(client, _)
client.server_capabilities.semanticTokensProvider = nil
end,
})
end,

["typos_lsp"] = function()
lspconfig.typos_lsp.setup({
init_options = {
config = "~/.config/typos/.typos.toml",
},
})
end,
})
["typos_lsp"] = function()
lspconfig.typos_lsp.setup({
init_options = {
config = "~/.config/typos/.typos.toml",
},
})
end,
})

-- Lsp Keymaps.
-- global.
-- vim.keymap.set("n", "<space>e", vim.diagnostic.open_float)
vim.keymap.set("n", "[d", vim.diagnostic.goto_prev)
vim.keymap.set("n", "]d", vim.diagnostic.goto_next)
vim.keymap.set("n", "<space>q", vim.diagnostic.setloclist)
-- Lsp Keymaps.
-- global.
-- vim.keymap.set("n", "<space>e", vim.diagnostic.open_float)
vim.keymap.set("n", "[d", vim.diagnostic.goto_prev)
vim.keymap.set("n", "]d", vim.diagnostic.goto_next)
vim.keymap.set("n", "<space>q", vim.diagnostic.setloclist)

-- after the language server attaches to the current buffer
vim.api.nvim_create_autocmd("LspAttach", {
group = vim.api.nvim_create_augroup("UserLspConfig", {}),
callback = function(ev)
vim.bo[ev.buf].omnifunc = "v:lua.vim.lsp.omnifunc"
-- after the language server attaches to the current buffer
vim.api.nvim_create_autocmd("LspAttach", {
group = vim.api.nvim_create_augroup("UserLspConfig", {}),
callback = function(ev)
vim.bo[ev.buf].omnifunc = "v:lua.vim.lsp.omnifunc"

local opts = { buffer = ev.buf }
vim.keymap.set("n", "gD", vim.lsp.buf.declaration, opts)
vim.keymap.set("n", "gd", vim.lsp.buf.definition, opts)
vim.keymap.set("n", "<space>k", vim.lsp.buf.hover, opts)
vim.keymap.set("n", "<space>rn", vim.lsp.buf.rename, opts)
vim.keymap.set("n", "gr", vim.lsp.buf.references, opts)
end,
})
end,
},
local opts = { buffer = ev.buf }
vim.keymap.set("n", "gD", vim.lsp.buf.declaration, opts)
vim.keymap.set("n", "gd", vim.lsp.buf.definition, opts)
vim.keymap.set("n", "<space>k", vim.lsp.buf.hover, opts)
vim.keymap.set("n", "<space>rn", vim.lsp.buf.rename, opts)
vim.keymap.set("n", "gr", vim.lsp.buf.references, opts)
end,
})
end,
},
}
14 changes: 7 additions & 7 deletions dot_config/nvim/lua/plugins/nvim-tree.lua
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
return {
"nvim-tree/nvim-tree.lua",
dependencies = "nvim-tree/nvim-web-devicons",
event = "VeryLazy",
config = function()
require("nvim-tree").setup({})
vim.keymap.set("n", "<leader>e", ":NvimTreeToggle<CR>")
end,
"nvim-tree/nvim-tree.lua",
dependencies = "nvim-tree/nvim-web-devicons",
-- event = "VeryLazy",
config = function()
require("nvim-tree").setup({})
vim.keymap.set("n", "<leader>e", ":NvimTreeToggle<CR>")
end,
}
Loading

0 comments on commit caff6f5

Please sign in to comment.