Skip to content

Commit

Permalink
Merge pull request #21 from nomutin/nvim-refactor
Browse files Browse the repository at this point in the history
Nvim refactor
  • Loading branch information
nomutin authored Jul 26, 2024
2 parents 94f3e71 + 8075a22 commit 4e866c5
Show file tree
Hide file tree
Showing 6 changed files with 47 additions and 91 deletions.
3 changes: 0 additions & 3 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,6 @@ jobs:
env:
SHELLCHECK_OPTS: -e SC2016 -e SC1090

- name: Run actionlint
uses: raven-actions/actionlint@v1

- uses: JohnnyMorganz/stylua-action@v4
with:
token: ${{ secrets.GITHUB_TOKEN }}
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
Dotfiles for my host `macOS` and guest `Linux`.

![platform](https://img.shields.io/badge/platform-macOS%20|%20Linux-blue)
[![Lint](https://github.com/nomutin/dotfiles/actions/workflows/lint.yaml/badge.svg)](https://github.com/nomutin/dotfiles/actions/workflows/lint.yaml)
[![ci](https://github.com/nomutin/dotfiles/actions/workflows/ci.yaml/badge.svg)](https://github.com/nomutin/dotfiles/actions/workflows/ci.yaml)

</div>

Expand Down
2 changes: 1 addition & 1 deletion xdg_config/alacritty/alacritty.toml
Original file line number Diff line number Diff line change
Expand Up @@ -47,5 +47,5 @@ white = '#ECEFF4'

[keyboard]
bindings = [
{ key = "j", mods = "Control", action = "ToggleViMode" }
{ key = "f", mods = "Control", action = "ToggleViMode" }
]
12 changes: 7 additions & 5 deletions xdg_config/mise/config.toml
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
[tools]
jq = "latest"
lazygit = "latest"
neovim = "nightly"
node = "20"
ripgrep = "latest"
neovim = "nightly"
zellij = "latest"
rust = "latest"
rye = "latest"
vim = "latest"
jq = "latest"
lazygit = "latest"
shfmt = "latest"
stylua = "latest"
zellij = "latest"
117 changes: 37 additions & 80 deletions xdg_config/nvim/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -3,40 +3,41 @@
-- ====== OPTIONS ======
vim.loader.enable()
vim.g.mapleader = " "
vim.opt.title = true -- ウィンドウのタイトルを現在開いているファイル名で更新
vim.opt.termguicolors = true -- ターミナルの色を24ビットカラーに設定
vim.opt.clipboard = "unnamedplus" -- システムのクリップボードを使用
vim.opt.completeopt = { "menuone", "noselect" } -- 補完メニューを表示し、自動で選択しない
vim.opt.ignorecase = true -- 検索時に大文字小文字を区別しない
vim.opt.pumheight = 10 -- ポップアップメニューの高さを10行に設定
vim.opt.showtabline = 2 -- タブラインを常に表示
vim.opt.ignorecase = true -- 検索時に大文字小文字を区別しない
vim.opt.smartcase = true -- 検索パターンに大文字が含まれている場合は大文字小文字を区別
vim.opt.smartindent = true -- 自動インデントを有効に
vim.opt.undofile = true -- アンドゥ情報をファイルに保存
vim.opt.expandtab = true -- タブをスペースに展開
vim.opt.cursorline = true -- カーソル行をハイライト
vim.opt.number = true -- 行番号を表示
vim.opt.wrap = false -- 折り返しを無効に
vim.opt.scrolloff = 8 -- スクロール時に画面の端から8行分余裕を持たせる
vim.opt.sidescrolloff = 8 -- スクロール時に画面の端から8列分余裕を持たせる
vim.opt.laststatus = 3 -- 最後のウィンドウのステータスラインを常に表示
vim.opt.list = true -- 制御文字を表示
vim.g.netrw_banner = 0
vim.g.netrw_liststyle = 3
vim.g.netrw_browse_split = 4
vim.g.showhide = 1
vim.g.netrw_altv = 1
vim.g.netrw_winsize = -28
vim.g.netrw_keepdir = 1
vim.opt.title = true
vim.opt.termguicolors = true
vim.opt.clipboard = "unnamedplus"
vim.opt.completeopt = { "menuone", "noselect" }
vim.opt.ignorecase = true
vim.opt.pumheight = 10
vim.opt.showtabline = 2
vim.opt.ignorecase = true
vim.opt.smartcase = true
vim.opt.smartindent = true
vim.opt.undofile = true
vim.opt.expandtab = true
vim.opt.cursorline = true
vim.opt.number = true
vim.opt.wrap = false
vim.opt.scrolloff = 8
vim.opt.sidescrolloff = 8
vim.opt.laststatus = 3
vim.opt.list = true
vim.api.nvim_set_hl(0, "Function", { fg = "NvimLightBlue" })

-- ====== KEYMAP ======
vim.keymap.set("i", "jk", "<ESC>") -- インサートモード時 jk でノーマルモードに戻る
vim.keymap.set("t", "fd", [[<C-\><C-n>]]) -- Terminal Mode 時 fd でノーマルモードに戻る
vim.keymap.set("x", "<M-k>", ":move '<-2<CR>gv=gv") -- 選択範囲を上に移動
vim.keymap.set("x", "<M-j>", ":move '>+1<CR>gv=gv") -- 選択範囲を下に移動

-- ====== COLORS ======
vim.api.nvim_set_hl(0, "Function", { fg = "NvimLightBlue" })
vim.api.nvim_set_hl(0, "Identifier", { fg = "NvimLightBlue" })
vim.api.nvim_set_hl(0, "Constant", { fg = "NvimLightCyan" })
vim.api.nvim_set_hl(0, "Statement", { fg = "NvimLightBlue", bold = true })
vim.api.nvim_set_hl(0, "Special", { link = "Constant" })
vim.api.nvim_set_hl(0, "@string.documentation", { fg = "NvimLightGreen", bold = true })
vim.api.nvim_set_hl(0, "@variable.parameter", { fg = "NvimLightCyan", italic = true })
vim.keymap.set("i", "jk", "<ESC>", { desc = "Return to normal mode" })
vim.keymap.set("t", "fd", [[<C-\><C-n>]], { desc = "Return to normal mode" })
vim.keymap.set("n", "<leader>n", "<cmd>Lexplore<cr>", { desc = "Open file explorer" })
vim.keymap.set("n", "<leader>e", "<cmd>Telescope find_files<cr>", { desc = "Find files" })
vim.keymap.set({ "n", "x", "o" }, "s", "<cmd>lua require('flash').jump()<cr>", { desc = "Jump" })
vim.keymap.set({ "n", "x", "o" }, "S", "<cmd>lua require('flash').treesitter()<cr>", { desc = "Select" })

-- ====== PLUGIN ======
local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim"
Expand All @@ -48,46 +49,21 @@ vim.opt.rtp:prepend(lazypath)

require("lazy").setup({
{ "github/copilot.vim", event = "BufRead" },
{
"folke/flash.nvim",
keys = {
{ "s", mode = { "n", "x", "o" }, "<cmd>lua require('flash').jump()<cr>" },
{ "S", mode = { "n", "x", "o" }, "<cmd>lua require('flash').treesitter()<cr>" },
},
},
{
"lewis6991/gitsigns.nvim",
event = "BufRead",
keys = {
{ "<leader>hd", mode = "n", "<cmd>Gitsigns diffthis<cr>" },
{ "<leader>hp", mode = "n", "<cmd>Gitsigns preview_hunk<cr>" },
},
opts = {},
},
{
"nvim-tree/nvim-tree.lua",
dependencies = { "kyazdani42/nvim-web-devicons" },
keys = { { "<leader>n", mode = "n", "<cmd>NvimTreeToggle<cr>" } },
opts = {},
},
{ "folke/flash.nvim" },
{ "lewis6991/gitsigns.nvim", event = "BufRead", opts = {} },
{ "nvim-lualine/lualine.nvim", event = "BufRead", opts = {} },
{
"williamboman/mason.nvim",
event = "BufRead",
dependencies = {
"williamboman/mason-lspconfig.nvim",
"jay-babu/mason-null-ls.nvim",
"nvimtools/none-ls.nvim",
"neovim/nvim-lspconfig",
"hrsh7th/nvim-cmp",
"hrsh7th/cmp-nvim-lsp",
"hrsh7th/cmp-path",
},
config = function()
require("mason").setup()
require("mason-lspconfig").setup()
require("mason-null-ls").setup({ handlers = {} })
require("null-ls").setup()
require("mason-lspconfig").setup_handlers({
function(server_name)
require("lspconfig")[server_name].setup({
Expand All @@ -98,10 +74,7 @@ require("lazy").setup({
local cmp = require("cmp")
cmp.setup({
mapping = cmp.mapping.preset.insert({}),
sources = cmp.config.sources({
{ name = "nvim_lsp" },
{ name = "path" },
}),
sources = cmp.config.sources({ { name = "nvim_lsp" } }),
})
end,
},
Expand All @@ -111,22 +84,6 @@ require("lazy").setup({
main = "nvim-treesitter.configs",
opts = { highlight = { enable = true }, indent = { enable = true } },
},
{
"nvim-telescope/telescope.nvim",
dependencies = { "nvim-lua/plenary.nvim" },
keys = {
{ "<leader>ff", mode = "n", "<cmd>Telescope find_files<cr>" },
{ "<leader>fg", mode = "n", "<cmd>Telescope live_grep<cr>" },
{ "<leader>fb", mode = "n", "<cmd>Telescope buffers<cr>" },
},
},
{
"akinsho/toggleterm.nvim",
keys = {
{ "<leader>tt", "<cmd>ToggleTerm direction=float<cr>" },
{ "<leader>tj", "<cmd>ToggleTerm direction=horizontal<cr>" },
},
opts = {},
},
{ "nvim-telescope/telescope.nvim", dependencies = { "nvim-lua/plenary.nvim" } },
defaults = { lazy = true },
})
2 changes: 1 addition & 1 deletion xdg_config/zellij/config.kdl
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,7 @@ plugins {
// - true
// - false (Default)
//
// simplified_ui true
simplified_ui true

// Choose the path to the default shell that zellij will use for opening new panes
// Default: $SHELL
Expand Down

0 comments on commit 4e866c5

Please sign in to comment.