├── config ├── nvim │ ├── after │ │ └── ftplugin │ │ │ ├── astro.lua │ │ │ ├── json.lua │ │ │ ├── toml.lua │ │ │ ├── yaml.lua │ │ │ ├── javascript.lua │ │ │ ├── gitcommit.lua │ │ │ └── markdown.lua │ ├── snippets │ │ ├── _.snippets │ │ ├── python.snippets │ │ └── make.snippets │ ├── init.lua │ ├── templates │ │ ├── markdown │ │ │ ├── base-readme.md │ │ │ └── base-post.md │ │ ├── make │ │ │ ├── base-commands.make │ │ │ ├── snip-helm.make │ │ │ ├── snip-docker-compose.make │ │ │ └── snip-docker.make │ │ └── python │ │ │ ├── snip-arg.py │ │ │ └── base-kaggle-run.py │ ├── lua │ │ ├── imokuri │ │ │ ├── plugin │ │ │ │ ├── treesitter.lua │ │ │ │ ├── terminal.lua │ │ │ │ ├── filetype.lua │ │ │ │ ├── edit.lua │ │ │ │ ├── lsp.lua │ │ │ │ ├── snacks.lua │ │ │ │ ├── ui.lua │ │ │ │ └── completion.lua │ │ │ ├── lazy.lua │ │ │ ├── rc │ │ │ │ ├── autocmd.lua │ │ │ │ ├── option.lua │ │ │ │ └── mapping.lua │ │ │ └── util.lua │ │ └── ftplugin │ │ │ └── gitcommit.lua │ └── filetype.lua ├── git │ ├── config.proxy.template │ ├── config.ghe │ ├── config.github_hpeprod │ ├── ignore │ ├── message │ └── config ├── pip │ └── pip.conf ├── ssh │ └── github.conf ├── inputrc ├── profile.d │ ├── proxy.sh.template │ └── local.sh ├── starship.toml ├── mise │ └── config.toml └── bashrc ├── .gitignore ├── .stylua.toml ├── bin └── git_clone.sh ├── README.md ├── LICENSE ├── vimrc ├── .github └── workflows │ └── e2e_test.yml ├── Makefile └── install /config/nvim/after/ftplugin/astro.lua: -------------------------------------------------------------------------------- 1 | vim.bo.tabstop = 2 2 | vim.bo.softtabstop = 2 3 | vim.bo.shiftwidth = 2 4 | -------------------------------------------------------------------------------- /config/nvim/after/ftplugin/json.lua: -------------------------------------------------------------------------------- 1 | vim.bo.tabstop = 2 2 | vim.bo.softtabstop = 2 3 | vim.bo.shiftwidth = 2 4 | -------------------------------------------------------------------------------- /config/nvim/after/ftplugin/toml.lua: -------------------------------------------------------------------------------- 1 | vim.bo.tabstop = 2 2 | vim.bo.softtabstop = 2 3 | vim.bo.shiftwidth = 2 4 | -------------------------------------------------------------------------------- /config/nvim/after/ftplugin/yaml.lua: -------------------------------------------------------------------------------- 1 | vim.bo.tabstop = 2 2 | vim.bo.softtabstop = 2 3 | vim.bo.shiftwidth = 2 4 | -------------------------------------------------------------------------------- /config/git/config.proxy.template: -------------------------------------------------------------------------------- 1 | [http] 2 | proxy = write_proxy_here 3 | [https] 4 | proxy = write_proxy_here 5 | -------------------------------------------------------------------------------- /config/nvim/after/ftplugin/javascript.lua: -------------------------------------------------------------------------------- 1 | vim.bo.tabstop = 2 2 | vim.bo.softtabstop = 2 3 | vim.bo.shiftwidth = 2 4 | -------------------------------------------------------------------------------- /config/nvim/after/ftplugin/gitcommit.lua: -------------------------------------------------------------------------------- 1 | vim.keymap.set("n", "", require("ftplugin.gitcommit").select_type) 2 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Git 2 | config/git/config.proxy 3 | 4 | # Bash 5 | config/profile.d/proxy.sh 6 | 7 | # Neovim 8 | lazy-lock.json 9 | -------------------------------------------------------------------------------- /config/git/config.ghe: -------------------------------------------------------------------------------- 1 | [user] 2 | name = Yoshio Sugiyama 3 | email = yoshio.sugiyama@hpe.com 4 | signingkey = ~/.ssh/id_ed25519_ghe.pub 5 | -------------------------------------------------------------------------------- /config/git/config.github_hpeprod: -------------------------------------------------------------------------------- 1 | [user] 2 | name = Yoshio Sugiyama 3 | email = yoshio.sugiyama@hpe.com 4 | signingkey = ~/.ssh/id_ed25519.pub 5 | -------------------------------------------------------------------------------- /config/pip/pip.conf: -------------------------------------------------------------------------------- 1 | [install] 2 | trusted-host = 3 | pypi.org 4 | files.pythonhosted.org 5 | download.pytorch.org 6 | data.pyg.org 7 | -------------------------------------------------------------------------------- /config/nvim/snippets/_.snippets: -------------------------------------------------------------------------------- 1 | snippet todo "todo" 2 | TODO を解決するコードを書いて。 3 | ${0} 4 | 5 | snippet refactor "refactor" 6 | コードをリファクタリングして、可読性と保守性を向上させて。 7 | ${0} 8 | -------------------------------------------------------------------------------- /config/nvim/init.lua: -------------------------------------------------------------------------------- 1 | vim.loader.enable() 2 | 3 | require("imokuri.rc.option") 4 | require("imokuri.rc.mapping") 5 | require("imokuri.rc.autocmd") 6 | 7 | require("imokuri.lazy") 8 | -------------------------------------------------------------------------------- /config/nvim/after/ftplugin/markdown.lua: -------------------------------------------------------------------------------- 1 | vim.wo.foldmethod = "marker" 2 | vim.wo.foldmarker = "
,
" 3 | 4 | vim.api.nvim_create_user_command("DocToc", "!doctoc %:p", { bang = true }) 5 | -------------------------------------------------------------------------------- /.stylua.toml: -------------------------------------------------------------------------------- 1 | column_width = 120 2 | line_endings = "Unix" 3 | indent_type = "Spaces" 4 | indent_width = 4 5 | quote_style = "AutoPreferDouble" 6 | call_parentheses = "Always" 7 | collapse_simple_statement = "FunctionOnly" 8 | -------------------------------------------------------------------------------- /config/git/ignore: -------------------------------------------------------------------------------- 1 | # ansible 2 | *.retry 3 | 4 | # (neo)vim 5 | .nvimlog 6 | tags 7 | 8 | # python 9 | .venv 10 | .mypy_cache 11 | .dmypy.json 12 | .ipynb_checkpoints/ 13 | __pycache__ 14 | *.egg-info 15 | 16 | # sugi 17 | sugi 18 | -------------------------------------------------------------------------------- /config/nvim/templates/markdown/base-readme.md: -------------------------------------------------------------------------------- 1 |
2 | 3 | # {{_input_:title}} 4 | 5 |
6 | 7 | ## Features 8 | {{_cursor_}} 9 | 10 | ## Requirements 11 | 12 | 13 | ## Installation 14 | 15 | 16 | ## Configurations 17 | 18 | 19 | -------------------------------------------------------------------------------- /config/nvim/snippets/python.snippets: -------------------------------------------------------------------------------- 1 | snippet comment "comment" 2 | ####################################################################################################################### 3 | # ${0} 4 | ####################################################################################################################### 5 | -------------------------------------------------------------------------------- /config/nvim/lua/imokuri/plugin/treesitter.lua: -------------------------------------------------------------------------------- 1 | return { 2 | { 3 | "nvim-treesitter/nvim-treesitter", 4 | lazy = false, 5 | branch = "main", 6 | build = ":TSUpdate", 7 | config = function() require("nvim-treesitter").install(require("imokuri.util").treesitter_filetypes) end, 8 | }, 9 | } 10 | -------------------------------------------------------------------------------- /config/nvim/templates/make/base-commands.make: -------------------------------------------------------------------------------- 1 | .DEFAULT_GOAL := help 2 | 3 | .PHONY: help 4 | help: ## Show this help 5 | @awk 'BEGIN {FS = ":.*?## "} /^[a-zA-Z0-9_-]+:.*?## / \ 6 | {printf "\033[38;2;98;209;150m%-15s\033[0m %s\n", $$1, $$2}' $(MAKEFILE_LIST) 7 | 8 | export 9 | NOW = $(shell date '+%Y%m%d-%H%M%S') 10 | 11 | {{_cursor_}} 12 | -------------------------------------------------------------------------------- /config/nvim/templates/markdown/base-post.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: {{_cursor_}} 3 | slug: template-page 4 | date: {{_expr_:strftime('%Y-%m-%d', localtime())}} 5 | updated: 6 | tags: 7 | - Template 8 | cover_image: /blog/xxx.jpg 9 | description: "This is template page." 10 | --- 11 | 12 | ## Contents 13 | 14 | ## Overview 15 | 16 | This is template page. 17 | -------------------------------------------------------------------------------- /config/ssh/github.conf: -------------------------------------------------------------------------------- 1 | Host github 2 | Hostname github.com 3 | User git 4 | IdentityFile "~/.ssh/id_ed25519_github" 5 | 6 | Host github_hpeprod 7 | Hostname github.com 8 | User git 9 | IdentityFile "~/.ssh/id_ed25519" 10 | 11 | Host ghe 12 | Hostname github.hpe.com 13 | User git 14 | IdentityFile "~/.ssh/id_ed25519_ghe" 15 | -------------------------------------------------------------------------------- /config/nvim/filetype.lua: -------------------------------------------------------------------------------- 1 | vim.filetype.add({ 2 | extension = { 3 | ["mdx"] = "markdown", 4 | }, 5 | filename = { 6 | ["install"] = "bash", 7 | }, 8 | pattern = { 9 | [".*Dockerfile.*"] = "dockerfile", 10 | [".*git/config.*"] = "gitconfig", 11 | [".*git/ignore.*"] = "gitignore", 12 | [".*.make"] = "make", 13 | }, 14 | }) 15 | -------------------------------------------------------------------------------- /config/inputrc: -------------------------------------------------------------------------------- 1 | $if Bash 2 | set completion-ignore-case on 3 | 4 | set visible-stats on 5 | 6 | set bell-style none 7 | set bell-style visible 8 | 9 | "\C-j": menu-complete 10 | "\C-k": menu-complete-backward 11 | 12 | "\C-y": shell-kill-word 13 | 14 | # Keyboard Macro 15 | # start-kbd-macro (C-x () 16 | # end-kbd-macro (C-x )) 17 | # call-last-kbd-macro (C-x e) 18 | $endif 19 | -------------------------------------------------------------------------------- /config/nvim/snippets/make.snippets: -------------------------------------------------------------------------------- 1 | snippet comment "comment" 2 | ####################################################################################################################### 3 | # ${0} 4 | ####################################################################################################################### 5 | 6 | snippet command "command" 7 | .PHONY: ${1} 8 | ${1}: ## ${1} 9 | ${0} 10 | -------------------------------------------------------------------------------- /config/nvim/lua/imokuri/plugin/terminal.lua: -------------------------------------------------------------------------------- 1 | return { 2 | { 3 | "nvzone/floaterm", 4 | dependencies = "nvzone/volt", 5 | keys = { 6 | { "", "FloatermToggle", mode = "n" }, 7 | { "", "FloatermToggle", mode = "t" }, 8 | }, 9 | opts = { 10 | border = true, 11 | size = { h = 60, w = 80 }, 12 | }, 13 | }, 14 | } 15 | -------------------------------------------------------------------------------- /config/nvim/lua/imokuri/lazy.lua: -------------------------------------------------------------------------------- 1 | local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim" 2 | if not vim.loop.fs_stat(lazypath) then 3 | vim.fn.system({ 4 | "git", 5 | "clone", 6 | "--filter=blob:none", 7 | "--single-branch", 8 | "https://github.com/folke/lazy.nvim.git", 9 | lazypath, 10 | }) 11 | end 12 | vim.opt.runtimepath:prepend(lazypath) 13 | 14 | require("lazy").setup("imokuri.plugin", { rocks = { enabled = false } }) 15 | -------------------------------------------------------------------------------- /config/profile.d/proxy.sh.template: -------------------------------------------------------------------------------- 1 | function proxy_on { 2 | export http_proxy=write_proxy_here 3 | export https_proxy=write_proxy_here 4 | export no_proxy=127.0.0.1,localhost 5 | } 6 | 7 | function proxy_off { 8 | unset http_proxy 9 | unset https_proxy 10 | unset no_proxy 11 | } 12 | 13 | export proxy_on=proxy_on 14 | export proxy_off=proxy_off 15 | 16 | export http_proxy=write_proxy_here 17 | export https_proxy=write_proxy_here 18 | export no_proxy=127.0.0.1,localhost 19 | -------------------------------------------------------------------------------- /config/profile.d/local.sh: -------------------------------------------------------------------------------- 1 | # .config/profile.d/local.sh 2 | 3 | ##### Get proxy setting ####################################################### 4 | 5 | if [ -f ~/.config/profile.d/proxy.sh ]; then 6 | . ~/.config/profile.d/proxy.sh 7 | fi 8 | 9 | ##### User specific environment ############################################### 10 | 11 | export LANG="en_US.UTF-8" 12 | 13 | export LESS="-i -M -R -W -z-3 -x4 -F -X" 14 | 15 | export EDITOR="nvim" 16 | 17 | if [ -f ~/.hosts ]; then 18 | export HOSTALIASES=~/.hosts 19 | fi 20 | -------------------------------------------------------------------------------- /bin/git_clone.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | if [ $# -lt 1 ]; then 4 | echo "Usage: $0 " 5 | exit 1 6 | fi 7 | 8 | REPO_NAME=$1 9 | 10 | SSH_HOSTS=("github" "github_hpeprod" "ghe") 11 | 12 | echo "Select SSH host for cloning:" 13 | select HOST in "${SSH_HOSTS[@]}"; do 14 | if [ -n "$HOST" ]; then 15 | echo "You selected: $HOST" 16 | break 17 | else 18 | echo "Invalid selection. Try again." 19 | fi 20 | done 21 | 22 | echo "Cloning repository: $REPO_NAME from $HOST ..." 23 | git clone "git@$HOST:$REPO_NAME.git" 24 | -------------------------------------------------------------------------------- /config/nvim/templates/make/snip-helm.make: -------------------------------------------------------------------------------- 1 | show-version-{{_input_:app_name}}: ## Show chart version for {{_input_:app_name}}. 2 | helm search repo {{_input_:chart_name_or_dir}} 3 | 4 | save-values-{{_input_:app_name}}: ## Save default values for {{_input_:app_name}}. 5 | helm show values {{_input_:chart_name_or_dir}} > values.yaml 6 | 7 | up-{{_input_:app_name}}: ## Start {{_input_:app_name}}. 8 | helm upgrade --install {{_input_:app_name}} {{_input_:chart_name_or_dir}} \ 9 | -f values.yaml 10 | 11 | down-{{_input_:app_name}}: ## Stop {{_input_:app_name}}. 12 | helm uninstall {{_input_:app_name}} || : 13 | 14 | {{_cursor_}} 15 | -------------------------------------------------------------------------------- /config/nvim/lua/ftplugin/gitcommit.lua: -------------------------------------------------------------------------------- 1 | local M = {} 2 | 3 | function M.select_type() 4 | local _, _, type = string.find(vim.api.nvim_get_current_line(), "# (%w+) ") 5 | 6 | vim.api.nvim_cmd({ 7 | cmd = "normal", 8 | args = { '"_dip' }, 9 | bang = true, 10 | mods = { 11 | emsg_silent = true, 12 | }, 13 | }, {}) 14 | vim.api.nvim_buf_set_lines(0, 0, 1, true, { string.format("%s: ", type) }) 15 | vim.api.nvim_cmd({ 16 | cmd = "normal", 17 | args = { "gg" }, 18 | }, {}) 19 | vim.api.nvim_cmd({ 20 | cmd = "startinsert", 21 | bang = true, 22 | }, {}) 23 | end 24 | 25 | return M 26 | -------------------------------------------------------------------------------- /config/git/message: -------------------------------------------------------------------------------- 1 | 2 | 3 | # feat Add new feature. 4 | # fix Fix bug. 5 | # deps Update dependencies. 6 | # style Formatting, missing semi colons, etc. 7 | # refactor Refactoring. 8 | # docs Documentation. 9 | # test Adding missing tests. 10 | # chore Maintain. 11 | 12 | # [optional body] 13 | 14 | # [optional footer] 15 | 16 | # BREAKING CHANGE: xxx 17 | 18 | # Referencing issues 19 | # Closes #xxx, #xxx 20 | 21 | # ================================================================================ 22 | # Conventional Commits 23 | # - https://www.conventionalcommits.org/ja/v1.0.0/ 24 | # AngularJS Git Commit Message Conventions 25 | # - https://gist.github.com/stephenparish/9941e89d80e2bc58a153#allowed-type 26 | -------------------------------------------------------------------------------- /config/nvim/lua/imokuri/plugin/filetype.lua: -------------------------------------------------------------------------------- 1 | return { 2 | -- Filetype: python 3 | { "Vimjas/vim-python-pep8-indent", ft = { "python" }, event = "InsertEnter" }, 4 | 5 | { 6 | "roobert/f-string-toggle.nvim", 7 | ft = "python", 8 | event = "VeryLazy", 9 | opts = { key_binding = "F" }, 10 | }, 11 | 12 | -- Filetype: csv 13 | { "mechatroner/rainbow_csv", ft = { "csv" } }, 14 | 15 | -- Filetype: markdown 16 | { 17 | "dhruvasagar/vim-table-mode", 18 | ft = { "markdown" }, 19 | event = "VeryLazy", 20 | init = function() 21 | vim.g.table_mode_always_active = 1 22 | vim.keymap.set("n", "A", "TableModeRealign") 23 | end, 24 | }, 25 | } 26 | -------------------------------------------------------------------------------- /config/nvim/templates/python/snip-arg.py: -------------------------------------------------------------------------------- 1 | import argparse 2 | 3 | 4 | def get_args(): 5 | parser = argparse.ArgumentParser( 6 | description=""" 7 | This is great script! 8 | """ 9 | ) 10 | 11 | parser.add_argument("-s", "--single-args", nargs=1, required=True, help="Help message.") 12 | parser.add_argument("-m", "--multiple-args", nargs="+", required=True, help="Help message.") 13 | parser.add_argument("-S", "--optional-single-args", nargs="?", default="default value", help="Help message.") 14 | parser.add_argument("-M", "--optional-multiple-args", nargs="*", default=[1, 2, 3], help="Help message.") 15 | parser.add_argument("-f", "--enable-flag", action="store_true", help="Help message.") 16 | 17 | return parser.parse_args() 18 | -------------------------------------------------------------------------------- /config/starship.toml: -------------------------------------------------------------------------------- 1 | [hostname] 2 | style = "bold green" 3 | 4 | [character] 5 | success_symbol = '[](bold green) ' 6 | error_symbol = '[](bold red) ' 7 | # format = "$symbol" 8 | 9 | [directory] 10 | truncation_length = 5 11 | truncation_symbol = ".../" 12 | read_only = " " 13 | 14 | [git_branch] 15 | symbol = " " 16 | 17 | [git_status] 18 | conflicted = " " 19 | deleted = " " 20 | renamed = "" 21 | modified = "" 22 | untracked = "" 23 | staged = " " 24 | stashed = "" 25 | ahead = "" 26 | behind = "" 27 | diverged = "" 28 | # up_to_date = " " 29 | 30 | [sudo] 31 | disabled = false 32 | 33 | [kubernetes] 34 | disabled = false 35 | symbol = "☸ " 36 | 37 | [kubernetes.context_aliases] 38 | ".*/(?P[\\w-]+).*/.*" = "$cluster" 39 | 40 | [gcloud] 41 | disabled = true 42 | -------------------------------------------------------------------------------- /config/nvim/templates/python/base-kaggle-run.py: -------------------------------------------------------------------------------- 1 | import logging 2 | 3 | import hydra 4 | import numpy as np 5 | import torch 6 | from hydra.core.hydra_config import HydraConfig 7 | from omegaconf import DictConfig 8 | 9 | import src.utils as utils 10 | 11 | log = logging.getLogger(__name__) 12 | 13 | 14 | @hydra.main(config_path="config", config_name="main", version_base=None) 15 | def main(c: DictConfig): 16 | log.info("Let's go!") 17 | log.info(f"Params: {c.params}") 18 | 19 | utils.fix_seed(c.params.seed) 20 | 21 | run_dir = HydraConfig.get().run.dir 22 | log.info(f"Run dir: {run_dir}") 23 | 24 | np.set_printoptions(precision=3) 25 | torch.set_printoptions(precision=3) 26 | torch.set_float32_matmul_precision("medium") 27 | 28 | # TODO 29 | 30 | log.info(f"Well done. Run dir: {run_dir}") 31 | 32 | 33 | if __name__ == "__main__": 34 | main() 35 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 |
2 | 3 | # :computer: dotfiles 4 | 5 | [![E2E Test](https://github.com/IMOKURI/dotfiles/actions/workflows/e2e_test.yml/badge.svg)](https://github.com/IMOKURI/dotfiles/actions/workflows/e2e_test.yml) 6 | 7 |
8 | 9 | Dotfiles that can be installed by one command 10 | 11 | ## Features 12 | 13 | - Clone dotfiles repository. 14 | - Create symbolic links to dotfile. 15 | - Install Neovim and development tools via Mise. 16 | 17 | ## Platforms 18 | 19 | - Ubuntu 22.04, 24.04 20 | 21 | ## Requirements 22 | 23 | - Packages 24 | 25 | ```bash 26 | sudo apt install -y curl gcc git gnupg make tar 27 | ``` 28 | 29 | - Set environment variables if use proxy. 30 | 31 | ```bash 32 | export http_proxy= 33 | export https_proxy= 34 | ``` 35 | 36 | ## Installation 37 | 38 | ```bash 39 | bash -c "$(curl -fsSL https://git.io/imokuri)" 40 | ``` 41 | -------------------------------------------------------------------------------- /config/nvim/templates/make/snip-docker-compose.make: -------------------------------------------------------------------------------- 1 | ####################################################################################################################### 2 | # {{_input_:project_name}} 3 | ####################################################################################################################### 4 | PROJECT_NAME = {{_input_:project_name}} 5 | 6 | build-{{_input_:project_name}}: ## Build {{_input_:project_name}}. 7 | docker compose build 8 | 9 | pull-{{_input_:project_name}}: ## Pull {{_input_:project_name}}. 10 | docker compose pull 11 | 12 | up-{{_input_:project_name}}: ## Start {{_input_:project_name}}. 13 | docker compose -p $(PROJECT_NAME) up -d 14 | 15 | down-{{_input_:project_name}}: ## Stop {{_input_:project_name}}. 16 | docker compose -p $(PROJECT_NAME) down 17 | 18 | ps-{{_input_:project_name}}: ## Status {{_input_:project_name}}. 19 | docker compose -p $(PROJECT_NAME) ps 20 | 21 | log-{{_input_:project_name}}: ## Log {{_input_:project_name}}. 22 | docker compose -p $(PROJECT_NAME) logs -f 23 | 24 | {{_cursor_}} 25 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2015 IMOKURI 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | 23 | -------------------------------------------------------------------------------- /config/mise/config.toml: -------------------------------------------------------------------------------- 1 | [settings.npm] 2 | bun = true 3 | 4 | [settings.pipx] 5 | uvx = true 6 | 7 | [tools] 8 | bat = "latest" 9 | bun = "latest" 10 | fd = "latest" 11 | fzf = "latest" 12 | github-cli = "latest" 13 | helm = "latest" 14 | jq = "latest" 15 | kubectl = "latest" 16 | lazygit = "latest" 17 | lua-language-server = "latest" 18 | node = "lts" 19 | pnpm = "latest" 20 | python = "3.11" 21 | ripgrep = "latest" 22 | shfmt = "latest" 23 | stylua = "latest" 24 | terraform = "latest" 25 | uv = "latest" 26 | yarn = "latest" 27 | yq = "latest" 28 | 29 | "asdf:richin13/asdf-neovim" = "latest" 30 | 31 | "npm:bash-language-server" = "latest" 32 | "npm:dockerfile-language-server-nodejs" = "latest" 33 | "npm:doctoc" = "latest" 34 | "npm:mcp-hub" = "latest" 35 | "npm:prettier" = "latest" 36 | "npm:tree-sitter-cli" = "latest" 37 | "npm:@astrojs/language-server" = "latest" 38 | "npm:@github/copilot" = "latest" 39 | 40 | "pipx:ansible-core" = { version = "latest", uvx_args = "--with ansible --with cryptography --with kubernetes --with passlib" } 41 | "pipx:huggingface_hub[cli]" = "latest" 42 | "pipx:kaggle" = "latest" 43 | "pipx:ruff" = "latest" 44 | "pipx:ty" = "latest" 45 | "pipx:wandb" = "latest" 46 | -------------------------------------------------------------------------------- /vimrc: -------------------------------------------------------------------------------- 1 | " Skip initialization for vim-tiny or vim-small. 2 | if !1 | finish | endif 3 | 4 | " Only use default plugin 5 | set packpath= 6 | set runtimepath=$VIMRUNTIME 7 | 8 | " View options 9 | set number 10 | set relativenumber 11 | set cursorline 12 | set showmatch 13 | set scrolloff=3 14 | 15 | " Edit options 16 | set expandtab 17 | set tabstop=4 18 | set softtabstop=4 19 | set shiftwidth=4 20 | set shiftround 21 | set smartindent 22 | set hidden 23 | 24 | " Search options 25 | set ignorecase 26 | set smartcase 27 | set wrapscan 28 | set fileignorecase 29 | 30 | " Leader key mapping 31 | nnoremap 32 | let g:mapleader = "\" 33 | 34 | " File mappings 35 | nnoremap w :write 36 | nnoremap w :wall 37 | nnoremap qq :close 38 | nnoremap QQ :bdelete! 39 | nnoremap q :qall 40 | nnoremap Q :qall! 41 | nnoremap f :Explore 42 | 43 | " Move mappings 44 | nnoremap j v:count ? 'j' : 'gj' 45 | nnoremap k v:count ? 'k' : 'gk' 46 | xnoremap j v:count ? 'j' : 'gj' 47 | xnoremap k v:count ? 'k' : 'gk' 48 | nnoremap H ^ 49 | xnoremap H ^ 50 | nnoremap L $ 51 | xnoremap L $ 52 | inoremap 53 | inoremap 54 | inoremap 55 | inoremap 56 | nnoremap 57 | -------------------------------------------------------------------------------- /config/nvim/lua/imokuri/plugin/edit.lua: -------------------------------------------------------------------------------- 1 | return { 2 | -- Comment 3 | { 4 | "folke/ts-comments.nvim", 5 | keys = { 6 | { "c", "gcc", remap = true, desc = "Comment line" }, 7 | { "c", "gc", mode = "x", remap = true, desc = "Comment selection" }, 8 | }, 9 | }, 10 | 11 | -- Sandwich 12 | { 13 | "machakann/vim-sandwich", 14 | event = "VeryLazy", 15 | init = function() vim.keymap.set({ "n", "x" }, "s", "") end, 16 | }, 17 | 18 | -- Operator 19 | { 20 | "kana/vim-operator-replace", 21 | dependencies = { 22 | "kana/vim-operator-user", 23 | }, 24 | keys = { 25 | { "S", "(operator-replace)", mode = { "n", "x", "o" } }, 26 | }, 27 | }, 28 | 29 | -- Text Objects 30 | { 31 | "kana/vim-textobj-line", 32 | dependencies = { 33 | "kana/vim-textobj-user", 34 | }, 35 | event = "VeryLazy", 36 | }, 37 | 38 | -- Clever-f 39 | { 40 | "rhysd/clever-f.vim", 41 | keys = "f", 42 | }, 43 | 44 | -- Suda 45 | { 46 | "lambdalisue/suda.vim", 47 | init = function() vim.g.suda_smart_edit = 1 end, 48 | }, 49 | 50 | -- LineDiff 51 | { 52 | "AndrewRadev/linediff.vim", 53 | cmd = "Linediff", 54 | }, 55 | 56 | -- Auto Indent 57 | { 58 | "vidocqh/auto-indent.nvim", 59 | event = "InsertEnter", 60 | }, 61 | } 62 | -------------------------------------------------------------------------------- /config/nvim/templates/make/snip-docker.make: -------------------------------------------------------------------------------- 1 | ####################################################################################################################### 2 | # {{_input_:container_name}} 3 | ####################################################################################################################### 4 | IMAGE_NAME = imokuri123/{{_input_:container_name}} 5 | IMAGE_TAG = v0.0.1 6 | 7 | build-{{_input_:container_name}}: ## Build {{_input_:container_name}}. 8 | docker build -t $(IMAGE_NAME):$(IMAGE_TAG) -f Dockerfile . 9 | 10 | push-{{_input_:container_name}}: ## Push {{_input_:container_name}}. 11 | docker push $(IMAGE_NAME):$(IMAGE_TAG) 12 | 13 | run-{{_input_:container_name}}: ## Run shell in {{_input_:container_name}}. 14 | docker run -it --rm \ 15 | --shm-size=16g \ 16 | -v $(shell pwd):/work \ 17 | -w /work \ 18 | $(IMAGE_NAME):$(IMAGE_TAG) \ 19 | sh 20 | 21 | up-{{_input_:container_name}}: ## Start {{_input_:container_name}}. 22 | docker run -d --name {{_input_:container_name}} -p 10000:8000 \ 23 | --shm-size=16g \ 24 | --gpus '"device=0,1"' \ 25 | -v $(XDG_CACHE_HOME):/root/.cache \ 26 | $(IMAGE_NAME):$(IMAGE_TAG) 27 | 28 | down-{{_input_:container_name}}: ## Stop {{_input_:container_name}}. 29 | docker stop {{_input_:container_name}} || : 30 | docker rm {{_input_:container_name}} || : 31 | 32 | ps-{{_input_:container_name}}: ## Status {{_input_:container_name}}. 33 | docker ps -a -f name={{_input_:container_name}} || : 34 | 35 | log-{{_input_:container_name}}: ## Log {{_input_:container_name}}. 36 | docker logs -f {{_input_:container_name}} || : 37 | 38 | {{_cursor_}} 39 | -------------------------------------------------------------------------------- /config/nvim/lua/imokuri/rc/autocmd.lua: -------------------------------------------------------------------------------- 1 | local u = require("imokuri.util") 2 | local group_name = "UserRuntimeConfig" 3 | 4 | vim.api.nvim_create_augroup(group_name, {}) 5 | 6 | vim.api.nvim_create_autocmd("TextYankPost", { 7 | group = group_name, 8 | callback = function() vim.highlight.on_yank() end, 9 | }) 10 | vim.api.nvim_create_autocmd("BufReadPost", { 11 | group = group_name, 12 | callback = function() 13 | local mark = vim.api.nvim_buf_get_mark(0, '"') 14 | local lcount = vim.api.nvim_buf_line_count(0) 15 | if mark[1] > 0 and mark[1] <= lcount then 16 | pcall(vim.api.nvim_win_set_cursor, 0, mark) 17 | end 18 | end, 19 | }) 20 | vim.api.nvim_create_autocmd("BufEnter", { 21 | group = group_name, 22 | pattern = "COMMIT_EDITMSG", 23 | command = "normal! 5G", 24 | }) 25 | vim.api.nvim_create_autocmd("BufWritePre", { 26 | group = group_name, 27 | callback = function() u.auto_mkdir(vim.fn.expand(":p:h:s?suda://??"), vim.api.nvim_eval("v:cmdbang")) end, 28 | }) 29 | vim.api.nvim_create_autocmd("BufWritePost", { 30 | group = group_name, 31 | pattern = "catppuccin.lua", 32 | callback = function() 33 | vim.api.nvim_cmd({ 34 | cmd = "CatppuccinCompile", 35 | }, {}) 36 | end, 37 | }) 38 | vim.api.nvim_create_autocmd("TermOpen", { 39 | group = group_name, 40 | callback = function() 41 | vim.wo.number = false 42 | vim.wo.relativenumber = false 43 | end, 44 | }) 45 | vim.api.nvim_create_autocmd("FileType", { 46 | pattern = u.treesitter_filetypes, 47 | callback = function() 48 | vim.treesitter.start() 49 | vim.wo.foldmethod = "expr" 50 | vim.wo.foldexpr = "v:lua.vim.treesitter.foldexpr()" 51 | end, 52 | }) 53 | -------------------------------------------------------------------------------- /.github/workflows/e2e_test.yml: -------------------------------------------------------------------------------- 1 | # This is a basic workflow to help you get started with Actions 2 | name: E2E Test 3 | 4 | on: 5 | push: 6 | pull_request: 7 | branches: [ master ] 8 | schedule: 9 | - cron: '26 9 * * *' 10 | 11 | # A workflow run is made up of one or more jobs that can run sequentially or in parallel 12 | jobs: 13 | ubuntu: 14 | strategy: 15 | fail-fast: true 16 | matrix: 17 | os_name: 18 | - ubuntu 19 | os_version: 20 | - 22.04 21 | - 24.04 22 | 23 | runs-on: ubuntu-latest 24 | container: ${{ matrix.os_name }}:${{ matrix.os_version }} 25 | 26 | steps: 27 | - name: Install requirements 28 | run: | 29 | apt-get update 30 | apt-get install -y curl gcc git gnupg make tar 31 | 32 | - name: Install dotfiles 33 | run: | 34 | env LANG=en_US.utf8 HOME=/root bash -c "$(curl -fsSL https://git.io/imokuri)" 35 | 36 | ubuntu_proxy: 37 | strategy: 38 | fail-fast: true 39 | matrix: 40 | os_name: 41 | - ubuntu 42 | os_version: 43 | - 22.04 44 | - 24.04 45 | 46 | runs-on: ubuntu-latest 47 | container: ${{ matrix.os_name }}:${{ matrix.os_version }} 48 | 49 | services: 50 | squid: 51 | image: wernight/squid 52 | ports: 53 | - 3128:3128 54 | 55 | steps: 56 | - name: Install requirements 57 | run: | 58 | env https_proxy=http://squid:3128 http_proxy=http://squid:3128 apt-get update 59 | env https_proxy=http://squid:3128 http_proxy=http://squid:3128 apt-get install -y curl gcc git gnupg make tar 60 | 61 | - name: Install dotfiles 62 | run: | 63 | env https_proxy=http://squid:3128 http_proxy=http://squid:3128 LANG=en_US.utf8 HOME=/root bash -c "$(curl -fsSL https://git.io/imokuri)" 64 | -------------------------------------------------------------------------------- /config/git/config: -------------------------------------------------------------------------------- 1 | [user] 2 | name = Yoshio Sugiyama 3 | email = nenegi.01mo@gmail.com 4 | signingkey = ~/.ssh/id_ed25519_github.pub 5 | 6 | [gpg] 7 | format = ssh 8 | 9 | [includeIf "gitdir:~/ghe/"] 10 | path = ~/.config/git/config.ghe 11 | 12 | [includeIf "gitdir:~/github_hpeprod/"] 13 | path = ~/.config/git/config.github_hpeprod 14 | 15 | [include] 16 | path = ~/.config/git/config.proxy 17 | 18 | [core] 19 | editor = nvim 20 | pager = "LESSCHARSET=utf-8 less" 21 | fscache = true 22 | preloadindex = true 23 | quotepath = false 24 | 25 | [color] 26 | ui = auto 27 | 28 | [column] 29 | ui = auto 30 | 31 | [grep] 32 | lineNumber = true 33 | 34 | [init] 35 | defaultBranch = main 36 | 37 | [status] 38 | showUntrackedFiles = all 39 | 40 | [commit] 41 | gpgsign = true 42 | template = ~/.config/git/message 43 | 44 | [tag] 45 | gpgsign = true 46 | sort = version:refname 47 | 48 | [fetch] 49 | prune = true 50 | pruneTags = true 51 | all = true 52 | 53 | [push] 54 | default = current 55 | autoSetupRemote = true 56 | followTags = true 57 | 58 | [pull] 59 | rebase = true 60 | 61 | [rebase] 62 | autoSquash = true 63 | autoStash = true 64 | updateRefs = true 65 | 66 | [transfer] 67 | fsckobjects = true 68 | 69 | [credential] 70 | helper = store 71 | 72 | [diff] 73 | tool = nvimdiff 74 | algorithm = histogram 75 | colorMoved = plain 76 | mnemonicPrefix = true 77 | noprefix = true 78 | renames = true 79 | 80 | [diff "ansible-vault"] 81 | textconv = ansible-vault view 82 | 83 | [difftool] 84 | prompt = false 85 | 86 | [difftool "nvimdiff"] 87 | cmd = nvim -d $LOCAL $REMOTE 88 | 89 | [merge] 90 | tool = nvimdiff 91 | conflictstyle = diff3 92 | 93 | [mergetool] 94 | keepBackup = false 95 | prompt = false 96 | 97 | [mergetool "nvimdiff"] 98 | cmd = "nvim -d -c \"wincmd l\" -c \"norm ]c\" \"$LOCAL\" \"$MERGED\" \"$REMOTE\"" 99 | 100 | [rerere] 101 | enabled = true 102 | autoupdate = true 103 | 104 | [alias] 105 | commend = commit --amend --no-edit 106 | graph = log --graph --all --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit --date=relative 107 | ignore = "!gi() { curl -L -s https://www.gitignore.io/api/$@ >> .gitignore ;}; gi" 108 | it = !git init && git commit -m "init" --allow-empty 109 | please = push --force-with-lease --force-if-includes 110 | 111 | [lfs] 112 | locksverify = false 113 | 114 | [filter "lfs"] 115 | clean = git-lfs clean -- %f 116 | smudge = git-lfs smudge -- %f 117 | process = git-lfs filter-process 118 | required = true 119 | -------------------------------------------------------------------------------- /Makefile: -------------------------------------------------------------------------------- 1 | .PHONY: install 2 | .DEFAULT_GOAL := help 3 | 4 | SHELL := /bin/bash 5 | 6 | # List up dotfiles 7 | DOTFILES_EXCLUDES := README.md LICENSE Makefile bin config install $(wildcard .??*) 8 | DOTFILES_TARGET := $(shell ls) 9 | DOTFILES_FILES := $(filter-out $(DOTFILES_EXCLUDES), $(DOTFILES_TARGET)) 10 | DOTFILES_XDG_CONFIG := $(shell ls config) 11 | 12 | # Define path 13 | DOTPATH := $(HOME)/.dotfiles 14 | BASHMARKS := $(HOME)/src/bashmarks 15 | CAT_BAT := $(HOME)/src/cat-bat 16 | 17 | # Proxy settings 18 | PROXY_TEMPLATE := $(DOTPATH)/config/profile.d/proxy.sh.template 19 | PROXY_SETTING := $(DOTPATH)/config/profile.d/proxy.sh 20 | GIT_PROXY_TEMPLATE := $(DOTPATH)/config/git/config.proxy.template 21 | GIT_PROXY_SETTING := $(DOTPATH)/config/git/config.proxy 22 | 23 | define repo 24 | if [[ -d "$1" ]]; then \ 25 | cd $1 && git pull && git submodule update --init --recursive; \ 26 | else \ 27 | git clone --depth 1 --recursive https://github.com/$2 "$1"; \ 28 | fi 29 | endef 30 | 31 | list: ## Show file/directory list for deployment 32 | @$(foreach val, $(DOTFILES_FILES), ls -dF $(val);) 33 | @$(foreach val, $(DOTFILES_XDG_CONFIG), ls -dF config/$(val);) 34 | 35 | install: proxy deploy ## Do proxy, deploy 36 | 37 | proxy: ## Set proxy 38 | ifdef http_proxy 39 | sed -e 's|write_proxy_here|$(http_proxy)|g' $(PROXY_TEMPLATE) > $(PROXY_SETTING) 40 | sed -e 's|write_proxy_here|$(http_proxy)|g' $(GIT_PROXY_TEMPLATE) > $(GIT_PROXY_SETTING) 41 | 42 | source $(PROXY_SETTING) 43 | endif 44 | 45 | deploy: ## Create symlink 46 | @mkdir -p $(HOME)/{.config,ghe,github,github_hpeprod,work,docker,namespace} 47 | @mkdir -p $(HOME)/ghe/{hpe,yoshio-sugiyama} 48 | @mkdir -p $(HOME)/github/{HPE-TA,IMOKURI} 49 | @mkdir -p $(HOME)/github_hpeprod/yoshio-sugiyama_hpeprod 50 | @$(foreach val, $(DOTFILES_FILES), ln -sfnv $(abspath $(val)) $(HOME)/.$(val);) 51 | @$(foreach val, $(DOTFILES_XDG_CONFIG), ln -sfnv $(abspath config/$(val)) $(HOME)/.config/$(val);) 52 | 53 | mise: ## Get Mise 54 | if [[ -f $(HOME)/.local/bin/mise ]]; then \ 55 | mise self-update -y; \ 56 | mise upgrade; \ 57 | else \ 58 | curl https://mise.run | sh; \ 59 | fi 60 | 61 | bashmarks: update-bashmarks build-bashmarks ## Get Bashmarks 62 | 63 | update-bashmarks: ## Update bashmarks repository 64 | $(call repo,$(BASHMARKS),huyng/bashmarks) 65 | 66 | build-bashmarks: ## Build bashmarks 67 | cd $(BASHMARKS) && \ 68 | make install && \ 69 | sed -i 's/^alias l=/# &/' $(HOME)/.bashrc 70 | 71 | bat-theme: update-bat-theme build-bat-theme ## Get bat theme 72 | 73 | update-bat-theme: ## Update bat theme repository 74 | $(call repo,$(CAT_BAT),catppuccin/bat) 75 | 76 | build-bat-theme: ## Build bat theme 77 | cd $(CAT_BAT) && \ 78 | mkdir -p "$(shell bat --config-dir)/themes" && \ 79 | cp -f themes/*.tmTheme "$(shell bat --config-dir)/themes" && \ 80 | bat cache --build 81 | 82 | help: ## Show this help 83 | @awk 'BEGIN {FS = ":.*?## "} /^[a-zA-Z_-]+:.*?## / \ 84 | {printf "\033[38;2;98;209;150m%-20s\033[0m %s\n", $$1, $$2}' \ 85 | $(MAKEFILE_LIST) 86 | -------------------------------------------------------------------------------- /install: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | set -e 4 | 5 | ##### Variables ############################################################### 6 | 7 | export PATH=${HOME}/.local/bin:${HOME}/bin:${HOME}/.local/share/mise/shims:/usr/local/bin:${PATH} 8 | 9 | # Defind Colors 10 | BANNER="\033[38;2;101;178;255m" # BLUE 11 | DEBUG="\033[38;2;144;108;255m" # MAGENTA 12 | INFO="\033[38;2;98;209;150m" # GREEN 13 | WARN="\033[38;2;255;179;120m" # YELLOW 14 | ERROR="\033[38;2;255;84;88m" # RED 15 | CODE="\033[38;2;99;242;241m" # CYAN 16 | CLEAR_COLOR="\033[0m" 17 | 18 | # Define path 19 | DOTPATH="$HOME/.dotfiles" 20 | 21 | ##### Functions ############################################################### 22 | 23 | COL=120 24 | 25 | function _banner() { 26 | sep=$(for ((i = 1; i < COL; i++)); do echo -n =; done) 27 | printf "\n${BANNER}%s %s${CLEAR_COLOR}\n\n" "${1}" "${sep:${#1}}" 28 | } 29 | 30 | function _logger() { 31 | LOG_LEVEL="${1}" 32 | printf "${!LOG_LEVEL}%s${CLEAR_COLOR}\n" "${1}: ${2}" 33 | } 34 | 35 | ##### Clone Dotfiles ########################################################## 36 | 37 | _banner "Clone Dotfiles..." 38 | 39 | if [[ ! -d "${DOTPATH}" ]]; then 40 | _logger INFO "Clone dotfiles repository" 41 | git clone --recursive https://github.com/IMOKURI/dotfiles.git "${DOTPATH}" 42 | fi 43 | 44 | ##### Install dotfiles ######################################################## 45 | 46 | _banner "Deploy dotfiles..." 47 | 48 | pushd "$(pwd)" 49 | cd "${DOTPATH}" 50 | 51 | make install 52 | 53 | if ! grep -q '.config/bashrc' "${HOME}/.bashrc"; then 54 | echo -e "\nif [[ -f ~/.config/bashrc ]]; then\n . ~/.config/bashrc\nfi" >>"${HOME}/.bashrc" 55 | fi 56 | 57 | if ! grep -q '.config/profile.d/local.sh' "${HOME}/.profile"; then 58 | echo -e "\nif [[ -f ~/.config/profile.d/local.sh ]]; then\n . ~/.config/profile.d/local.sh\nfi" >>"${HOME}/.profile" 59 | fi 60 | 61 | mkdir -p -m 700 ~/.ssh 62 | if ! grep -q 'Include ~/.config/ssh/' "${HOME}/.ssh/config"; then 63 | echo -e "\nInclude ~/.config/ssh/*.conf" >>"${HOME}/.ssh/config" 64 | fi 65 | 66 | popd 67 | 68 | ##### Install starship ######################################################## 69 | 70 | _banner "Install Starship..." 71 | mkdir -p "${HOME}/.local/bin" 72 | sh -c "$(curl -fsSL https://starship.rs/install.sh)" dollar_zero --yes --bin-dir "${HOME}/.local/bin" 73 | 74 | ##### Install Mise ############################################################ 75 | 76 | _banner "Install Mise..." 77 | pushd "$(pwd)" 78 | cd "${DOTPATH}" 79 | make mise 80 | popd 81 | 82 | ##### Install bashmarks ####################################################### 83 | 84 | _banner "Install Bashmarks..." 85 | pushd "$(pwd)" 86 | cd "${DOTPATH}" 87 | make bashmarks 88 | popd 89 | 90 | ##### Instruct next steps ##################################################### 91 | 92 | _banner "Please follow the instructions below to finish the installation." 93 | 94 | _logger INFO "Restart your shell session." 95 | _logger INFO "Run following commands to install development tools." 96 | _logger CODE " mise install" 97 | _logger CODE " make bat-theme" 98 | _logger INFO "Restart your shell session." 99 | 100 | _banner "Well done!" 101 | -------------------------------------------------------------------------------- /config/nvim/lua/imokuri/rc/option.lua: -------------------------------------------------------------------------------- 1 | local g = vim.g 2 | local o = vim.opt 3 | 4 | -- ----------------------------------------------------------------------------- 5 | -- Environment Variables {{{ 6 | 7 | vim.env.PATH = vim.env.HOME .. "/.local/share/mise/shims:" .. vim.env.PATH 8 | 9 | -- }}} 10 | 11 | -- ----------------------------------------------------------------------------- 12 | -- Disable builtin {{{ 13 | 14 | g.did_install_default_menus = 1 15 | g.did_install_syntax_menu = 1 16 | g.loaded_2html_plugin = 1 17 | g.loaded_getscript = 1 18 | g.loaded_getscriptPlugin = 1 19 | g.loaded_gzip = 1 20 | g.loaded_logiPat = 1 21 | g.loaded_man = 1 22 | g.loaded_matchit = 1 23 | g.loaded_matchparen = 1 24 | g.loaded_rrhelper = 1 25 | g.loaded_tar = 1 26 | g.loaded_tarPlugin = 1 27 | g.loaded_tutor_mode_plugin = 1 28 | g.loaded_vimball = 1 29 | g.loaded_vimballPlugin = 1 30 | g.loaded_zip = 1 31 | g.loaded_zipPlugin = 1 32 | g.skip_loading_mswin = 1 33 | 34 | -- g.loaded_netrw = 1 35 | -- g.loaded_netrwPlugin = 1 36 | -- g.loaded_netrwSettings = 1 37 | 38 | -- }}} 39 | 40 | -- ----------------------------------------------------------------------------- 41 | -- NetRW {{{ 42 | 43 | g.netrw_liststyle = 1 44 | g.netrw_banner = 0 45 | g.netrw_sizestyle = "H" 46 | g.netrw_timefmt = "%Y/%m/%d(%a) %H:%M:%S" 47 | g.netrw_home = os.getenv("HOME") 48 | g.netrw_bufsettings = "noma nomod nu rnu nowrap ro nobl" 49 | 50 | -- }}} 51 | 52 | -- ----------------------------------------------------------------------------- 53 | -- Neovim provider {{{ 54 | 55 | g.loaded_python3_provider = 0 56 | g.loaded_node_provider = 0 57 | g.loaded_perl_provider = 0 58 | g.loaded_ruby_provider = 0 59 | 60 | -- }}} 61 | 62 | -- ----------------------------------------------------------------------------- 63 | -- View {{{ 64 | 65 | o.number = true 66 | o.relativenumber = true 67 | o.list = true 68 | o.listchars = { 69 | tab = "< >", 70 | trail = "-", 71 | extends = "»", 72 | precedes = "«", 73 | } 74 | o.showmatch = true 75 | o.breakindent = true 76 | o.showbreak = "↳" 77 | o.breakindentopt = "sbr" 78 | o.foldenable = false 79 | o.foldmethod = "indent" 80 | o.foldtext = "v:lua.require'imokuri.util'.foldtext()" 81 | o.scrolloff = 5 82 | o.showmode = false 83 | o.updatetime = 250 84 | o.pumblend = 20 85 | o.pumheight = 10 86 | o.diffopt:append({ "algorithm:patience", "indent-heuristic" }) 87 | o.termguicolors = true 88 | o.shortmess:append("c") 89 | o.equalalways = false 90 | o.cmdheight = 0 91 | o.cursorline = true 92 | o.cursorlineopt = "number" 93 | 94 | -- }}} 95 | 96 | -- ----------------------------------------------------------------------------- 97 | -- Edit {{{ 98 | 99 | o.undofile = true 100 | o.swapfile = true 101 | o.backup = false 102 | o.expandtab = true 103 | o.tabstop = 4 104 | o.softtabstop = 4 105 | o.shiftwidth = 4 106 | o.shiftround = true 107 | o.smartindent = true 108 | o.virtualedit:append({ "block" }) 109 | o.completeopt = { "menu", "menuone", "noselect" } 110 | o.mouse = "" 111 | 112 | -- }}} 113 | 114 | -- ----------------------------------------------------------------------------- 115 | -- Search {{{ 116 | 117 | o.ignorecase = true 118 | o.smartcase = true 119 | o.wrapscan = true 120 | o.fileignorecase = true 121 | o.inccommand = "split" 122 | o.keywordprg = ":help" 123 | 124 | -- }}} 125 | 126 | -- ----------------------------------------------------------------------------- 127 | -- Completion {{{ 128 | 129 | o.wildmode = { "longest", "full" } 130 | 131 | -- }}} 132 | 133 | -- vim:foldmethod=marker 134 | -------------------------------------------------------------------------------- /config/nvim/lua/imokuri/util.lua: -------------------------------------------------------------------------------- 1 | local M = {} 2 | 3 | M.treesitter_filetypes = { 4 | "astro", 5 | "bash", 6 | "css", 7 | "diff", 8 | "dockerfile", 9 | "git_config", 10 | "git_rebase", 11 | "gitattributes", 12 | "gitcommit", 13 | "gitignore", 14 | "javascript", 15 | "json", 16 | "lua", 17 | "make", 18 | "markdown", 19 | "python", 20 | "regex", 21 | "typescript", 22 | "xml", 23 | "yaml", 24 | } 25 | 26 | function M.get_proxy() 27 | if os.getenv("http_proxy") ~= nil then 28 | return os.getenv("http_proxy") 29 | else 30 | return nil 31 | end 32 | end 33 | 34 | function M.auto_mkdir(dir, force) 35 | if vim.fn.isdirectory(dir) == 0 then 36 | if force == 1 then 37 | vim.fn.mkdir(dir, "p") 38 | else 39 | local is_create = vim.fn.input(string.format('"%s" does not exist. Create? [y/N]', dir)) 40 | if string.match(is_create, "^[Yy]") ~= nil then 41 | vim.fn.mkdir(dir, "p") 42 | end 43 | end 44 | end 45 | end 46 | 47 | function M.foldtext() 48 | local pos = vim.v.foldstart 49 | local line = vim.api.nvim_buf_get_lines(0, pos - 1, pos, false)[1] 50 | local lang = vim.treesitter.language.get_lang(vim.bo.filetype) 51 | local parser = vim.treesitter.get_parser(0, lang) 52 | local query = vim.treesitter.query.get(parser:lang(), "highlights") 53 | 54 | if query == nil then 55 | return vim.fn.foldtext() 56 | end 57 | 58 | local tree = parser:parse({ pos - 1, pos })[1] 59 | local result = {} 60 | 61 | local line_pos = 0 62 | 63 | local prev_range = nil 64 | 65 | for id, node, _ in query:iter_captures(tree:root(), 0, pos - 1, pos) do 66 | local name = query.captures[id] 67 | local start_row, start_col, end_row, end_col = node:range() 68 | if start_row == pos - 1 and end_row == pos - 1 then 69 | local range = { start_col, end_col } 70 | if start_col > line_pos then 71 | table.insert(result, { line:sub(line_pos + 1, start_col), "Folded" }) 72 | end 73 | line_pos = end_col 74 | local text = vim.treesitter.get_node_text(node, 0) 75 | if prev_range ~= nil and range[1] == prev_range[1] and range[2] == prev_range[2] then 76 | result[#result] = { text, "@" .. name } 77 | else 78 | table.insert(result, { text, "@" .. name }) 79 | end 80 | prev_range = range 81 | end 82 | end 83 | 84 | return result 85 | end 86 | 87 | function M.close_fold() 88 | if vim.fn.foldlevel(".") == 0 then 89 | vim.api.nvim_cmd({ 90 | cmd = "normal", 91 | args = { "zM" }, 92 | bang = true, 93 | }, {}) 94 | return 95 | end 96 | 97 | local foldc_lnum = vim.fn.foldclosed(".") 98 | vim.api.nvim_cmd({ 99 | cmd = "normal", 100 | args = { "zc" }, 101 | bang = true, 102 | }, {}) 103 | if foldc_lnum == -1 then 104 | return 105 | end 106 | 107 | if vim.fn.foldclosed(".") ~= foldc_lnum then 108 | return 109 | end 110 | vim.api.nvim_cmd({ 111 | cmd = "normal", 112 | args = { "zM" }, 113 | bang = true, 114 | }, {}) 115 | end 116 | 117 | function M.move_win(key) 118 | local curwin = vim.fn.winnr() or 0 119 | vim.api.nvim_cmd({ 120 | cmd = "wincmd", 121 | args = { key }, 122 | }, {}) 123 | 124 | if curwin == (vim.fn.winnr() or 0) then 125 | if string.match("jk", key) ~= nil then 126 | vim.api.nvim_cmd({ 127 | cmd = "wincmd", 128 | args = { "s" }, 129 | }, {}) 130 | else 131 | vim.api.nvim_cmd({ 132 | cmd = "wincmd", 133 | args = { "v" }, 134 | }, {}) 135 | end 136 | vim.api.nvim_cmd({ 137 | cmd = "wincmd", 138 | args = { key }, 139 | }, {}) 140 | end 141 | end 142 | 143 | return M 144 | -------------------------------------------------------------------------------- /config/nvim/lua/imokuri/rc/mapping.lua: -------------------------------------------------------------------------------- 1 | -- ----------------------------------------------------------------------------- 2 | -- Leader {{{ 3 | 4 | vim.keymap.set("n", "", "") 5 | vim.g.mapleader = " " 6 | 7 | -- }}} 8 | 9 | -- ----------------------------------------------------------------------------- 10 | -- File {{{ 11 | 12 | vim.keymap.set("n", "w", "update") 13 | vim.keymap.set("n", "w", "wall") 14 | 15 | vim.keymap.set("n", "qq", "close") 16 | vim.keymap.set("n", "QQ", "bdelete!") 17 | 18 | vim.keymap.set("n", "q", "qall") 19 | vim.keymap.set("n", "Q", "qall!") 20 | 21 | -- }}} 22 | 23 | -- ----------------------------------------------------------------------------- 24 | -- Tab {{{ 25 | 26 | vim.keymap.set("n", "gt", "tabnew") 27 | 28 | vim.keymap.set("n", "gn", "tabnext") 29 | vim.keymap.set("n", "gp", "tabprevious") 30 | 31 | -- }}} 32 | 33 | -- ----------------------------------------------------------------------------- 34 | -- Terminal {{{ 35 | 36 | vim.keymap.set("n", "te", "terminali") 37 | 38 | vim.keymap.set("t", "", "") 39 | 40 | -- }}} 41 | 42 | -- ----------------------------------------------------------------------------- 43 | -- Move {{{ 44 | 45 | vim.keymap.set({ "n", "x" }, "j", "v:count ? 'j' : 'gj'", { expr = true }) 46 | vim.keymap.set({ "n", "x" }, "k", "v:count ? 'k' : 'gk'", { expr = true }) 47 | 48 | vim.keymap.set({ "n", "x" }, "H", "^") 49 | -- Fold との複合マッピング 50 | -- vim.keymap.set("n", "L", "$") 51 | vim.keymap.set("x", "L", "$") 52 | 53 | vim.keymap.set({ "c", "i" }, "", "") 54 | vim.keymap.set({ "c", "i" }, "", "") 55 | vim.keymap.set({ "c", "i" }, "", "U") 56 | vim.keymap.set({ "c", "i" }, "", "U") 57 | 58 | vim.keymap.set("n", "gf", "gF") 59 | 60 | -- }}} 61 | 62 | -- ----------------------------------------------------------------------------- 63 | -- Buffer, Window {{{ 64 | 65 | vim.keymap.set("n", "", "lua require('imokuri.util').move_win('j')") 66 | vim.keymap.set("n", "", "lua require('imokuri.util').move_win('k')") 67 | vim.keymap.set("n", "", "lua require('imokuri.util').move_win('l')") 68 | vim.keymap.set("n", "", "lua require('imokuri.util').move_win('h')") 69 | 70 | vim.keymap.set("t", "", "lua require('imokuri.util').move_win('j')") 71 | vim.keymap.set("t", "", "lua require('imokuri.util').move_win('k')") 72 | vim.keymap.set("t", "", "lua require('imokuri.util').move_win('l')") 73 | vim.keymap.set("t", "", "lua require('imokuri.util').move_win('h')") 74 | 75 | vim.keymap.set("n", "", "") 76 | 77 | -- }}} 78 | 79 | -- ----------------------------------------------------------------------------- 80 | -- Fold {{{ 81 | 82 | vim.keymap.set("n", "l", "foldclosed('.') != -1 ? 'zo' : 'l'", { expr = true }) 83 | vim.keymap.set("n", "L", "foldclosed('.') != -1 ? 'zO' : '$'", { expr = true }) 84 | 85 | vim.keymap.set("n", "zl", "zR") 86 | vim.keymap.set("n", "z,", "zMzv") 87 | 88 | vim.keymap.set("n", ",", require("imokuri.util").close_fold) 89 | 90 | -- }}} 91 | 92 | -- ----------------------------------------------------------------------------- 93 | -- Search, Replace {{{ 94 | 95 | vim.keymap.set("n", "", ":nohlsearch") 96 | 97 | vim.keymap.set("i", "", function() 98 | local line = vim.fn.getline(".") 99 | local col = vim.fn.getpos(".")[3] 100 | local substring = line:sub(1, col - 1) 101 | local result = vim.fn.matchstr(substring, [[\v<(\k(<)@!)*$]]) 102 | return "" .. result:upper() 103 | end, { expr = true }) 104 | 105 | -- }}} 106 | 107 | -- ----------------------------------------------------------------------------- 108 | -- Indent {{{ 109 | 110 | vim.keymap.set("n", "<", "<<") 111 | vim.keymap.set("n", ">", ">>") 112 | 113 | -- }}} 114 | 115 | -- ----------------------------------------------------------------------------- 116 | -- Yank, Paste {{{ 117 | 118 | -- 1文字削除を削除レジスタにいれる 119 | vim.keymap.set("n", "x", '"_x') 120 | 121 | -- }}} 122 | 123 | -- vim:foldmethod=marker 124 | -------------------------------------------------------------------------------- /config/bashrc: -------------------------------------------------------------------------------- 1 | # .config/bashrc 2 | 3 | ##### Environment variables ################################################### 4 | 5 | export XDG_CONFIG_HOME="${HOME}/.config" 6 | export XDG_CACHE_HOME="${HOME}/.cache" 7 | export XDG_DATA_HOME="${HOME}/.local/share" 8 | export XDG_STATE_HOME="${HOME}/.local/state" 9 | 10 | export INPUTRC="${XDG_CONFIG_HOME}/inputrc" 11 | 12 | export GPG_TTY=$(tty) 13 | 14 | export HISTCONTROL=ignoreboth:erasedups 15 | 16 | export BAT_THEME="Catppuccin Mocha" 17 | 18 | export PATH=${HOME}/.local/bin:${HOME}/bin:${HOME}/.local/share/mise/shims:${PATH} 19 | 20 | ##### Set bash options ######################################################## 21 | 22 | # ディレクトリ名を実行すると、そのディレクトリに移動する 23 | shopt -s autocd 24 | 25 | # dotで始まるファイルをワイルドカードのマッチ対象に含める 26 | shopt -s dotglob 27 | 28 | # ** を指定すると、該当ディレクトリ以下のディレクトリを再帰的にマッチにする 29 | shopt -s globstar 30 | 31 | # シェルスクリプト内でaliasを使えるようにする 32 | shopt -s expand_aliases 33 | 34 | ##### User specific alias ##################################################### 35 | 36 | # Neovim/Vim 37 | 38 | if [[ -x "$(command -v nvim)" ]]; then 39 | alias vi="nvim" 40 | fi 41 | 42 | function minimal-env() { 43 | cd "$(mktemp -d)" || exit 44 | export HOME=$PWD 45 | export XDG_CONFIG_HOME=$HOME/.config 46 | export XDG_CACHE_HOME=$HOME/.cache 47 | export XDG_DATA_HOME=$HOME/.local/share 48 | export XDG_STATE_HOME=$HOME/.local/state 49 | pwd 50 | } 51 | 52 | cdd() { 53 | cd ~/.dotfiles/ || exit 54 | } 55 | cds() { 56 | cd ~/.local/state/nvim/swap || exit 57 | } 58 | cdr() { 59 | cd "$(git rev-parse --show-toplevel)" || exit 60 | } 61 | 62 | docker-clean() { 63 | docker container prune -f 64 | docker volume prune -f 65 | docker image prune -f 66 | # docker system prune --volumes -f 67 | } 68 | 69 | tmp-clean() { 70 | find /tmp -mtime +60 -type f -delete 71 | find /tmp -empty -type d -delete 72 | } 73 | 74 | venv() { 75 | if [[ ! -d .venv ]]; then 76 | uv venv 77 | source .venv/bin/activate 78 | uv pip install -U pip setuptools 79 | else 80 | source .venv/bin/activate 81 | fi 82 | } 83 | 84 | alias sudo='sudo ' 85 | 86 | alias clone='bash ~/.dotfiles/bin/git_clone.sh' 87 | alias ga='git add' 88 | alias gaa='git add -A' 89 | alias gb='git branch' 90 | alias gbd='git branch --merged | grep -vE "^\*| master$| main$| develop$" | xargs git branch -d' 91 | alias gc='git commit --signoff' 92 | alias gca='git commend' 93 | alias gcm='git commit -m' 94 | alias gco='git checkout' 95 | alias gcob='git checkout $(basename $(git symbolic-ref refs/remotes/origin/HEAD))' 96 | alias gd='git diff' 97 | alias gdc='git diff --cached' 98 | alias gdd='git difftool' 99 | alias gf='git fetch' 100 | alias gg='git graph' 101 | alias gi='git it' 102 | alias gm='git merge' 103 | alias gmt='git mergetool' 104 | alias gp='git pull' 105 | alias gpf='git please' 106 | alias gpu='git push' 107 | alias gs='git status' 108 | alias gsf='git submodule foreach' 109 | alias gsu='git submodule update --recursive' 110 | 111 | alias k='kubectl' 112 | alias ka='kubectl apply' 113 | alias kc='kubectl create' 114 | alias kd='kubectl delete' 115 | alias ke='kubectl exec' 116 | alias kg='kubectl get' 117 | alias kga='kubectl get all' 118 | alias kl='kubectl logs' 119 | alias ks='kubectl describe' 120 | 121 | kn() { 122 | if [[ ${#} -eq 0 ]]; then 123 | kubectl config view | grep namespace: 124 | else 125 | kubectl config set-context $(kubectl config current-context) --namespace=${1} 126 | fi 127 | } 128 | 129 | alias m='microk8s' 130 | alias ms='microk8s status' 131 | 132 | alias dp='docker ps -a' 133 | alias dl='docker logs' 134 | alias di='docker images' 135 | alias dv='docker volume ls' 136 | alias dn='docker network ls' 137 | 138 | alias a='ansible' 139 | alias ap='ansible-playbook' 140 | alias av='ansible-vault' 141 | 142 | alias e='explorer.exe .' 143 | 144 | alias rg="rg --smart-case --hidden --glob '!.git'" 145 | 146 | alias b="bat" 147 | 148 | alias fd="fdfind" 149 | 150 | alias python="python3" 151 | 152 | ##### Load bashmarks ########################################################## 153 | 154 | if [ -f ~/.local/bin/bashmarks.sh ]; then 155 | . ~/.local/bin/bashmarks.sh 156 | fi 157 | 158 | ##### Activate Starship ####################################################### 159 | 160 | eval "$(starship init bash)" 161 | 162 | ##### Activate Mise ########################################################### 163 | 164 | eval "$(mise activate bash --shims)" 165 | -------------------------------------------------------------------------------- /config/nvim/lua/imokuri/plugin/lsp.lua: -------------------------------------------------------------------------------- 1 | return { 2 | { 3 | "rachartier/tiny-inline-diagnostic.nvim", 4 | event = "VeryLazy", 5 | opts = {}, 6 | }, 7 | { 8 | "Wansmer/symbol-usage.nvim", 9 | event = "VeryLazy", 10 | opts = { 11 | vt_position = "end_of_line", 12 | }, 13 | }, 14 | { 15 | "nvimtools/none-ls.nvim", 16 | event = "VeryLazy", 17 | config = function() 18 | local null_ls = require("null-ls") 19 | null_ls.setup() 20 | 21 | null_ls.register(null_ls.builtins.formatting.prettier) 22 | null_ls.register(null_ls.builtins.formatting.shfmt.with({ extra_args = { "-i", vim.bo.softtabstop } })) 23 | null_ls.register(null_ls.builtins.formatting.stylua) 24 | end, 25 | }, 26 | { 27 | "smjonas/inc-rename.nvim", 28 | event = "VeryLazy", 29 | opts = {}, 30 | }, 31 | { 32 | "neovim/nvim-lspconfig", 33 | dependencies = { 34 | "hrsh7th/cmp-nvim-lsp", 35 | }, 36 | event = "VeryLazy", 37 | config = function() 38 | vim.diagnostic.config({ 39 | update_in_insert = true, 40 | severity_sort = true, 41 | }) 42 | 43 | vim.api.nvim_create_autocmd("LspAttach", { 44 | group = vim.api.nvim_create_augroup("UserLspConfig", {}), 45 | callback = function(event) 46 | local client = vim.lsp.get_client_by_id(event.data.client_id) 47 | 48 | vim.keymap.set("n", "K", vim.lsp.buf.hover) 49 | vim.keymap.set("n", "[", function() Snacks.picker.lsp_references() end) 50 | vim.keymap.set("n", "]", function() Snacks.picker.lsp_definitions() end) 51 | vim.keymap.set("n", "j", function() vim.diagnostic.jump({ count = 1 }) end) 52 | vim.keymap.set("n", "k", function() vim.diagnostic.jump({ count = -1 }) end) 53 | vim.keymap.set("n", "r", ":IncRename ") 54 | vim.keymap.set("n", "x", vim.lsp.buf.code_action) 55 | vim.keymap.set("n", "z", function() vim.lsp.buf.format({ async = true }) end) 56 | 57 | local signs = { Error = " ", Warn = " ", Hint = " ", Info = " " } 58 | for type, icon in pairs(signs) do 59 | local hl = "DiagnosticSign" .. type 60 | vim.fn.sign_define(hl, { text = icon, texthl = hl, numhl = hl }) 61 | end 62 | 63 | if client.supports_method(vim.lsp.protocol.Methods.textDocument_inlayHint) then 64 | vim.lsp.inlay_hint.enable(true) 65 | vim.keymap.set( 66 | "n", 67 | "I", 68 | function() vim.lsp.inlay_hint.enable(not vim.lsp.inlay_hint.is_enabled()) end 69 | ) 70 | else 71 | vim.notify( 72 | ("%s(%d) does not support textDocument/inlayHint"):format(client.name, client.id), 73 | vim.log.levels.DEBUG 74 | ) 75 | end 76 | end, 77 | }) 78 | 79 | local capabilities = require("cmp_nvim_lsp").default_capabilities() 80 | vim.lsp.config("*", { capabilities = capabilities }) 81 | 82 | vim.lsp.config.astro = { 83 | init_options = { 84 | typescript = { 85 | tsdk = vim.fn.expand( 86 | "~/.local/share/mise/installs/npm-astrojs-language-server/latest/node_modules/typescript/lib" 87 | ), 88 | }, 89 | }, 90 | } 91 | 92 | vim.lsp.config.ruff = { 93 | init_options = { 94 | settings = { 95 | lineLength = 120, 96 | }, 97 | }, 98 | } 99 | 100 | vim.lsp.config.ty = { 101 | settings = { 102 | ty = { 103 | experimental = { 104 | rename = true, 105 | }, 106 | }, 107 | }, 108 | } 109 | 110 | vim.lsp.config.lua_ls = { 111 | settings = { 112 | -- https://github.com/LuaLS/lua-language-server/wiki/Settings 113 | Lua = { 114 | runtime = { 115 | version = "LuaJIT", 116 | path = vim.split(package.path, ";"), 117 | }, 118 | diagnostics = { 119 | globals = vim.list_extend({ 120 | "Snacks", 121 | "vim", 122 | }, {}), 123 | }, 124 | completion = { 125 | callSnippet = "Replace", 126 | }, 127 | hint = { 128 | enable = true, 129 | }, 130 | format = { 131 | enable = false, 132 | }, 133 | }, 134 | }, 135 | } 136 | 137 | vim.lsp.enable({ "astro", "bashls", "dockerls", "lua_ls", "ruff", "ty" }) 138 | end, 139 | }, 140 | } 141 | -------------------------------------------------------------------------------- /config/nvim/lua/imokuri/plugin/snacks.lua: -------------------------------------------------------------------------------- 1 | local header = [[ 2 | ( ・ ´`(●) .oO( Neovim, IMOKURI, Zzz... ) 3 | ]] 4 | 5 | return { 6 | -- A collection of small QoL plugins for Neovim. 7 | { 8 | "folke/snacks.nvim", 9 | dependencies = { 10 | "IMOKURI/snacks-picker-sonictemplate.nvim", 11 | "mattn/vim-sonictemplate", 12 | "nvim-lua/plenary.nvim", 13 | }, 14 | priority = 1000, 15 | lazy = false, 16 | keys = { 17 | { "/", function() Snacks.picker.search_history() end, desc = "Search History" }, 18 | { ":", function() Snacks.picker.command_history() end, desc = "Command History" }, 19 | { "D", function() Snacks.picker.diagnostics() end, desc = "Diagnostics" }, 20 | { "E", function() Snacks.picker.icons() end, desc = "Emoji" }, 21 | { "H", function() Snacks.picker.notifications() end, desc = "Notification History" }, 22 | { "b", function() Snacks.picker.buffers() end, desc = "Buffers" }, 23 | { "d", function() Snacks.picker.diagnostics_buffer() end, desc = "Buffer Diagnostics" }, 24 | { "e", function() Snacks.explorer() end, desc = "File Explorer" }, 25 | { "f", function() Snacks.picker.smart() end, desc = "Smart Find Files" }, 26 | { "g", function() Snacks.picker.grep() end, desc = "Grep" }, 27 | { "o", function() Snacks.picker.recent() end, desc = "Recent" }, 28 | { "p", function() Snacks.picker.keymaps() end, desc = "Keymaps" }, 29 | { "s", function() require("snacks_picker").sonictemplate() end, desc = "Sonictemplate" }, 30 | }, 31 | init = function() 32 | vim.g.sonictemplate_vim_template_dir = { string.format("%s/templates", vim.fn.stdpath("config")) } 33 | end, 34 | opts = { 35 | bigfile = {}, 36 | dashboard = { 37 | preset = { 38 | header = header, 39 | keys = { 40 | { 41 | icon = " ", 42 | key = "o", 43 | desc = "Recent Files", 44 | action = ":lua Snacks.dashboard.pick('recent')", 45 | }, 46 | { 47 | icon = " ", 48 | key = "f", 49 | desc = "Find File", 50 | action = ":lua Snacks.dashboard.pick('smart')", 51 | }, 52 | { 53 | icon = " ", 54 | key = "g", 55 | desc = "Find Text", 56 | action = ":lua Snacks.dashboard.pick('grep')", 57 | }, 58 | { icon = " ", key = "n", desc = "New File", action = ":ene | startinsert" }, 59 | { 60 | icon = " ", 61 | key = "U", 62 | desc = "Update Plugins", 63 | action = "Lazy sync", 64 | enabled = package.loaded.lazy ~= nil, 65 | }, 66 | { icon = " ", key = "q", desc = "Quit", action = ":qa" }, 67 | }, 68 | }, 69 | sections = { 70 | { section = "header" }, 71 | { section = "keys", gap = 1, padding = 1 }, 72 | }, 73 | }, 74 | explorer = {}, 75 | indent = {}, 76 | notifier = { level = vim.log.levels.INFO }, 77 | picker = { 78 | layout = { 79 | preset = function() return vim.o.columns >= 200 and "default" or "wide_vertical" end, 80 | }, 81 | layouts = { 82 | wide_vertical = { 83 | layout = { 84 | backdrop = false, 85 | width = 0.8, 86 | min_width = 80, 87 | height = 0.8, 88 | min_height = 30, 89 | box = "vertical", 90 | border = "rounded", 91 | title = "{title} {live} {flags}", 92 | title_pos = "center", 93 | { win = "input", height = 1, border = "bottom" }, 94 | { win = "list", border = "none" }, 95 | { win = "preview", title = "{preview}", height = 0.7, border = "top" }, 96 | }, 97 | }, 98 | }, 99 | formatters = { 100 | file = { 101 | filename_first = true, 102 | }, 103 | }, 104 | sources = { 105 | explorer = { 106 | auto_close = true, 107 | hidden = true, 108 | exclude = { ".git" }, 109 | }, 110 | files = { 111 | cmd = "fd", 112 | args = { "--type", "f", "--hidden", "--exclude", ".git" }, 113 | }, 114 | grep = { 115 | cmd = "rg", 116 | hidden = true, 117 | exclude = { ".git" }, 118 | }, 119 | }, 120 | win = { 121 | input = { 122 | keys = { 123 | [""] = { "history_forward", mode = { "i", "n" } }, 124 | [""] = { "history_back", mode = { "i", "n" } }, 125 | [""] = { "close", mode = { "n", "i" } }, 126 | [""] = { "toggle_preview", mode = { "i", "n" } }, 127 | }, 128 | }, 129 | }, 130 | }, 131 | quickfile = {}, 132 | }, 133 | }, 134 | } 135 | -------------------------------------------------------------------------------- /config/nvim/lua/imokuri/plugin/ui.lua: -------------------------------------------------------------------------------- 1 | return { 2 | -- Color scheme 3 | { 4 | "catppuccin/nvim", 5 | name = "catppuccin", 6 | build = function() require("catppuccin").compile() end, 7 | dependencies = { 8 | "IMOKURI/line-number-interval.nvim", 9 | "nvim-lualine/lualine.nvim", 10 | "nvim-tree/nvim-web-devicons", 11 | }, 12 | config = function() 13 | local catppuccin = require("catppuccin") 14 | 15 | vim.g.catppuccin_flavour = "macchiato" -- latte, frappe, macchiato, mocha 16 | 17 | catppuccin.setup({ 18 | transparent_background = true, 19 | integrations = { 20 | cmp = true, 21 | native_lsp = { 22 | enabled = true, 23 | virtual_text = { 24 | errors = {}, 25 | hints = {}, 26 | warnings = {}, 27 | information = {}, 28 | }, 29 | underlines = { 30 | errors = { "underline" }, 31 | hints = { "underline" }, 32 | warnings = { "underline" }, 33 | information = { "underline" }, 34 | }, 35 | }, 36 | telescope = { enabled = true }, 37 | treesitter = true, 38 | }, 39 | custom_highlights = function(colors) 40 | return { 41 | CursorLineNr = { fg = colors.red }, 42 | Folded = { bg = colors.none }, 43 | HighlightedLineNr = { fg = colors.lavender }, 44 | HighlightedLineNr1 = { fg = colors.peach }, 45 | HighlightedLineNr2 = { fg = colors.yellow }, 46 | DimLineNr = { fg = colors.surface1 }, 47 | } 48 | end, 49 | }) 50 | 51 | vim.api.nvim_cmd({ 52 | cmd = "colorscheme", 53 | args = { "catppuccin" }, 54 | }, {}) 55 | 56 | vim.g.line_number_interval_enable_at_startup = 1 57 | vim.g["line_number_interval#use_custom"] = 1 58 | vim.g["line_number_interval#custom_interval"] = { 1, 2, 10, 20, 30, 40, 50, 60, 70, 80, 90 } 59 | 60 | vim.api.nvim_cmd({ 61 | cmd = "LineNumberIntervalEnable", 62 | }, {}) 63 | 64 | vim.opt.fillchars = { 65 | stl = "─", 66 | stlnc = "─", 67 | } 68 | 69 | local C = require("catppuccin.palettes").get_palette(vim.g.catppuccin_flavour) 70 | local O = require("catppuccin").options 71 | local transparent_bg = O.transparent_background and "NONE" or C.base 72 | 73 | require("lualine").setup({ 74 | options = { 75 | theme = { 76 | normal = { 77 | a = { bg = transparent_bg, fg = C.blue, gui = "bold" }, 78 | b = { bg = transparent_bg, fg = C.text }, 79 | c = { bg = transparent_bg, fg = C.blue }, 80 | }, 81 | insert = { 82 | a = { bg = transparent_bg, fg = C.green, gui = "bold" }, 83 | b = { bg = transparent_bg, fg = C.text }, 84 | c = { bg = transparent_bg, fg = C.green }, 85 | }, 86 | terminal = { 87 | a = { bg = transparent_bg, fg = C.green, gui = "bold" }, 88 | b = { bg = transparent_bg, fg = C.text }, 89 | c = { bg = transparent_bg, fg = C.green }, 90 | }, 91 | command = { 92 | a = { bg = transparent_bg, fg = C.peach, gui = "bold" }, 93 | b = { bg = transparent_bg, fg = C.text }, 94 | c = { bg = transparent_bg, fg = C.peach }, 95 | }, 96 | visual = { 97 | a = { bg = transparent_bg, fg = C.mauve, gui = "bold" }, 98 | b = { bg = transparent_bg, fg = C.text }, 99 | c = { bg = transparent_bg, fg = C.mauve }, 100 | }, 101 | replace = { 102 | a = { bg = transparent_bg, fg = C.red, gui = "bold" }, 103 | b = { bg = transparent_bg, fg = C.text }, 104 | c = { bg = transparent_bg, fg = C.red }, 105 | }, 106 | inactive = { 107 | a = { bg = transparent_bg, fg = C.blue }, 108 | b = { bg = transparent_bg, fg = C.surface1, gui = "bold" }, 109 | c = { bg = transparent_bg, fg = C.overlay0 }, 110 | }, 111 | }, 112 | globalstatus = true, 113 | component_separators = { left = "", right = "" }, 114 | section_separators = { left = "", right = "" }, 115 | }, 116 | sections = { 117 | lualine_a = { { "branch", icon = " " } }, 118 | lualine_b = {}, 119 | lualine_c = {}, 120 | lualine_x = {}, 121 | lualine_y = { { "diagnostics", sources = { "nvim_lsp" } } }, 122 | lualine_z = { "location" }, 123 | }, 124 | winbar = { 125 | lualine_a = {}, 126 | lualine_b = {}, 127 | lualine_c = { "%=", { "filetype", icon_only = true }, { "filename", path = 1 }, "%=" }, 128 | lualine_x = {}, 129 | lualine_y = {}, 130 | lualine_z = {}, 131 | }, 132 | inactive_winbar = { 133 | lualine_a = {}, 134 | lualine_b = {}, 135 | lualine_c = { "%=", { "filetype", icon_only = true }, "filename", "%=" }, 136 | lualine_x = {}, 137 | lualine_y = {}, 138 | lualine_z = {}, 139 | }, 140 | }) 141 | end, 142 | }, 143 | 144 | { 145 | "rachartier/tiny-devicons-auto-colors.nvim", 146 | dependencies = { 147 | "nvim-tree/nvim-web-devicons", 148 | }, 149 | event = "VeryLazy", 150 | opts = {}, 151 | }, 152 | 153 | -- UI 154 | { 155 | "folke/noice.nvim", 156 | dependencies = { 157 | "MunifTanjim/nui.nvim", 158 | }, 159 | event = "VeryLazy", 160 | config = function() 161 | require("noice").setup({ 162 | presets = { 163 | command_palette = true, 164 | inc_rename = true, 165 | long_message_to_split = true, 166 | lsp_doc_border = true, 167 | }, 168 | routes = { 169 | { 170 | view = "notify", 171 | filter = { event = "msg_showmode" }, 172 | }, 173 | }, 174 | }) 175 | end, 176 | }, 177 | 178 | -- Smart color column 179 | { 180 | "m4xshen/smartcolumn.nvim", 181 | event = "BufRead", 182 | opts = { colorcolumn = "120" }, 183 | }, 184 | 185 | -- Quick Highlight 186 | { 187 | "t9md/vim-quickhl", 188 | keys = { 189 | { "m", "(quickhl-manual-this)", mode = { "n", "x" }, desc = "Quick Highlight" }, 190 | { "M", "(quickhl-manual-reset)", mode = { "n", "x" }, desc = "Reset Quick Highlight" }, 191 | }, 192 | }, 193 | 194 | { 195 | "nacro90/numb.nvim", 196 | event = "VeryLazy", 197 | opts = {}, 198 | }, 199 | } 200 | -------------------------------------------------------------------------------- /config/nvim/lua/imokuri/plugin/completion.lua: -------------------------------------------------------------------------------- 1 | return { 2 | { 3 | "hrsh7th/nvim-cmp", 4 | dependencies = { 5 | "dcampos/cmp-snippy", 6 | "dcampos/nvim-snippy", 7 | "honza/vim-snippets", 8 | "hrsh7th/cmp-buffer", 9 | "hrsh7th/cmp-cmdline", 10 | "hrsh7th/cmp-nvim-lsp", 11 | "hrsh7th/cmp-nvim-lsp-document-symbol", 12 | "hrsh7th/cmp-nvim-lsp-signature-help", 13 | "hrsh7th/cmp-nvim-lua", 14 | "hrsh7th/cmp-path", 15 | "lukas-reineke/cmp-rg", 16 | "lukas-reineke/cmp-under-comparator", 17 | "onsails/lspkind.nvim", 18 | }, 19 | event = { 20 | "CmdlineEnter", 21 | "InsertEnter", 22 | }, 23 | config = function() 24 | local cmp = require("cmp") 25 | local compare = require("cmp.config.compare") 26 | local mapping = require("cmp.config.mapping") 27 | local types = require("cmp.types") 28 | local snippy = require("snippy") 29 | 30 | local feedkey = function(key, mode) 31 | vim.api.nvim_feedkeys(vim.api.nvim_replace_termcodes(key, true, true, true), mode, true) 32 | end 33 | 34 | cmp.setup({ 35 | window = { 36 | completion = cmp.config.window.bordered(), 37 | documentation = cmp.config.window.bordered(), 38 | }, 39 | formatting = { 40 | format = require("lspkind").cmp_format({ 41 | mode = "symbol_text", 42 | maxwidth = 50, 43 | before = function(entry, vim_item) 44 | local alias = { 45 | buffer = "[Buffer]", 46 | nvim_lsp = "[LSP]", 47 | nvim_lsp_signature_help = "[LSP]", 48 | nvim_lua = "[Lua]", 49 | path = "[Path]", 50 | rg = "[Rg]", 51 | snippy = "[Snippet]", 52 | } 53 | 54 | if entry.source.name == "nvim_lsp" then 55 | vim_item.menu = entry.source.source.client.name 56 | else 57 | vim_item.menu = alias[entry.source.name] or entry.source.name 58 | end 59 | 60 | return vim_item 61 | end, 62 | }), 63 | }, 64 | snippet = { 65 | expand = function(args) snippy.expand_snippet(args.body) end, 66 | }, 67 | mapping = { 68 | [""] = mapping(mapping.scroll_docs(-4), { "i", "c" }), 69 | [""] = mapping(mapping.scroll_docs(4), { "i", "c" }), 70 | [""] = mapping( 71 | mapping.select_prev_item({ behavior = types.cmp.SelectBehavior.Insert }), 72 | { "i", "c" } 73 | ), 74 | [""] = mapping( 75 | mapping.select_next_item({ behavior = types.cmp.SelectBehavior.Insert }), 76 | { "i", "c" } 77 | ), 78 | [""] = mapping(mapping.complete(), { "i", "c" }), 79 | [""] = mapping({ 80 | i = mapping.abort(), 81 | c = mapping.close(), 82 | }), 83 | [""] = mapping.confirm({ select = false }), 84 | [""] = mapping({ 85 | c = function() 86 | if cmp.visible() then 87 | cmp.select_next_item() 88 | else 89 | cmp.complete() 90 | end 91 | end, 92 | }), 93 | [""] = mapping({ 94 | c = function() 95 | if cmp.visible() then 96 | cmp.select_prev_item() 97 | else 98 | cmp.complete() 99 | end 100 | end, 101 | }), 102 | [""] = function(fallback) 103 | if snippy.can_expand_or_advance() then 104 | snippy.expand_or_advance() 105 | elseif cmp.visible() then 106 | feedkey("", "") 107 | else 108 | fallback() 109 | end 110 | end, 111 | [""] = function(fallback) 112 | if snippy.can_jump(-1) then 113 | snippy.previous() 114 | else 115 | fallback() 116 | end 117 | end, 118 | }, 119 | sources = cmp.config.sources({ 120 | { name = "snippy" }, 121 | { name = "nvim_lsp" }, 122 | { name = "nvim_lsp_signature_help" }, 123 | { name = "path" }, 124 | { name = "nvim_lua" }, 125 | }, { 126 | { name = "cmdline" }, 127 | { name = "buffer" }, 128 | { name = "rg" }, 129 | }), 130 | sorting = { 131 | comparators = { 132 | compare.offset, 133 | compare.exact, 134 | compare.score, 135 | require("cmp-under-comparator").under, 136 | compare.recently_used, 137 | compare.locality, 138 | compare.kind, 139 | compare.sort_text, 140 | compare.length, 141 | compare.order, 142 | }, 143 | }, 144 | performance = { 145 | debounce = 1, -- default is 60ms 146 | throttle = 1, -- default is 30ms 147 | }, 148 | }) 149 | 150 | -- Use buffer source for `/`. 151 | cmp.setup.cmdline("/", { 152 | sources = cmp.config.sources({ 153 | { name = "nvim_lsp_document_symbol" }, 154 | }, { 155 | { name = "buffer" }, 156 | }), 157 | }) 158 | 159 | -- Use cmdline & path source for ':'. 160 | cmp.setup.cmdline(":", { 161 | sources = cmp.config.sources({ 162 | { name = "path" }, 163 | }, { 164 | { name = "cmdline" }, 165 | }), 166 | }) 167 | end, 168 | }, 169 | 170 | { 171 | "github/copilot.vim", 172 | event = { 173 | "CmdlineEnter", 174 | "InsertEnter", 175 | }, 176 | init = function() 177 | if os.getenv("http_proxy") ~= nil then 178 | local u = require("imokuri.util") 179 | local proxy_url = u.get_proxy() --[[@as string]] 180 | proxy_url = string.gsub(proxy_url, "^[^:]+://", "") 181 | proxy_url = string.gsub(proxy_url, "/$", "") 182 | 183 | vim.g.copilot_proxy = proxy_url 184 | end 185 | 186 | vim.g.copilot_no_tab_map = true 187 | end, 188 | config = function() 189 | vim.keymap.set("i", "", 'copilot#Accept("")', { expr = true, replace_keycodes = false }) 190 | end, 191 | }, 192 | 193 | { 194 | "olimorris/codecompanion.nvim", 195 | dependencies = { 196 | "nvim-lua/plenary.nvim", 197 | "nvim-treesitter/nvim-treesitter", 198 | "ravitemer/codecompanion-history.nvim", 199 | }, 200 | event = "VeryLazy", 201 | keys = { 202 | { "a", "CodeCompanionActions", mode = { "n", "x" } }, 203 | { "h", "CodeCompanionHistory", mode = "n" }, 204 | }, 205 | opts = { 206 | ignore_warnings = true, 207 | opts = { 208 | language = "Japanese", 209 | }, 210 | display = { 211 | chat = { 212 | intro_message = "( ・ ´`(●) .oO( Zzz... )", 213 | }, 214 | }, 215 | extensions = { 216 | history = { 217 | enabled = true, 218 | }, 219 | }, 220 | }, 221 | }, 222 | 223 | { 224 | "windwp/nvim-autopairs", 225 | event = { 226 | "CmdlineEnter", 227 | "InsertEnter", 228 | }, 229 | config = function() 230 | local npairs = require("nvim-autopairs") 231 | local Rule = require("nvim-autopairs.rule") 232 | 233 | npairs.setup() 234 | 235 | -- Jinja2 236 | npairs.add_rules({ 237 | Rule("%", "%"):with_pair(function(opts) 238 | local pair = opts.line:sub(opts.col - 1, opts.col) 239 | return vim.tbl_contains({ "{}" }, pair) 240 | end), 241 | Rule(" ", " "):with_pair(function(opts) 242 | local pair = opts.line:sub(opts.col - 2, opts.col + 1) 243 | return vim.tbl_contains({ "{%%}" }, pair) 244 | end), 245 | }) 246 | 247 | npairs.add_rules({ 248 | Rule(" ", " "):with_pair(function(opts) 249 | local pair = opts.line:sub(opts.col - 1, opts.col) 250 | return vim.tbl_contains({ "()", "[]", "{}" }, pair) 251 | end), 252 | Rule("( ", " )") 253 | :with_pair(function() return false end) 254 | :with_move(function(opts) return opts.prev_char:match(".%)") ~= nil end) 255 | :use_key(")"), 256 | Rule("{ ", " }") 257 | :with_pair(function() return false end) 258 | :with_move(function(opts) return opts.prev_char:match(".%}") ~= nil end) 259 | :use_key("}"), 260 | Rule("[ ", " ]") 261 | :with_pair(function() return false end) 262 | :with_move(function(opts) return opts.prev_char:match(".%]") ~= nil end) 263 | :use_key("]"), 264 | }) 265 | end, 266 | }, 267 | } 268 | --------------------------------------------------------------------------------