├── .gitignore ├── .tmux.conf ├── README.md ├── flake.lock ├── flake.nix ├── home.nix ├── karabiner.json ├── vim ├── coc │ ├── package.json │ └── settings.json ├── dict │ ├── haskell.dict │ └── javascript.dict ├── ftdetect │ └── tsx.vim ├── ftplugin │ ├── gitcommit.vim │ ├── haskell.vim │ ├── javascript.vim │ ├── json.vim │ ├── markdown.vim │ ├── ruby.vim │ └── typescript.vim ├── lua │ └── plugins.lua └── plugin │ ├── 00-basic_configurations.lua │ ├── 01-display.lua │ ├── 02-search.lua │ ├── 03-indentation.lua │ ├── 10-key_bindings.lua │ ├── 11-key_bindings_emacs.lua │ ├── 12-key_bindings_buffers.lua │ ├── 14-filetype_detection.lua │ ├── 21-lightline.lua │ ├── 24-ultisnips.lua │ ├── 25-coc-git.lua │ ├── 25-coc.lua │ ├── 25-emmet.lua │ ├── 25-fzf.lua │ ├── 25-nerdtree.lua │ └── 29-misc.lua └── zsh ├── aliases.zsh ├── completion.zsh ├── functions.zsh ├── functions ├── clean-up-swap-files ├── fzf-git-add ├── fzf-git-checkout-branch ├── fzf-git-ls-files-editor ├── fzf-git-unstage └── fzf-history-search ├── history.zsh ├── hooks.zsh ├── ls.zsh ├── options.zsh ├── prompt.zsh ├── words.zsh └── zmv.zsh /.gitignore: -------------------------------------------------------------------------------- 1 | /result 2 | -------------------------------------------------------------------------------- /.tmux.conf: -------------------------------------------------------------------------------- 1 | # session options 2 | 3 | set-option -g buffer-limit 20 4 | set-option -g detach-on-destroy off 5 | set-option -g renumber-windows on 6 | set-option -g mouse on 7 | set-option -g status-keys emacs 8 | set-option -g focus-events on 9 | 10 | 11 | # colors and appearances 12 | 13 | set-option -g status-left-length 18 14 | set-option -g status-left '#{?client_prefix,#[fg=black]#[bg=yellow],#[fg=yellow]#[bg=default]}[%Y-%m-%d %H:%M] #[default]' 15 | 16 | set-option -g status-right-length 50 17 | set-option -g status-right-style fg=brightblue,bg=default 18 | set-option -g status-right '[#S]' 19 | set-option -g status-style fg=white,bg=default 20 | set-option -g window-status-current-style fg=green,bg=default 21 | set-option -g message-style fg=yellow,bg=default 22 | set-option -g pane-active-border-style none 23 | set-option -g pane-border-style none 24 | set-option -g pane-border-status off 25 | set-option -g window-status-activity-style fg=white,bg=default,underscore 26 | 27 | 28 | # window options 29 | 30 | set-window-option -g automatic-rename on 31 | set-window-option -g mode-keys vi 32 | set-window-option -g monitor-activity on 33 | 34 | 35 | # key bindings 36 | 37 | bind-key c new-window -c '#{pane_current_path}' 38 | 39 | bind-key h split-window -v -c '#{pane_current_path}' 40 | bind-key v split-window -h -c '#{pane_current_path}' 41 | 42 | bind-key C-h select-pane -L 43 | bind-key C-j select-pane -D 44 | bind-key C-k select-pane -U 45 | bind-key C-l select-pane -R 46 | 47 | bind-key -r H resize-pane -L 48 | bind-key -r J resize-pane -D 49 | bind-key -r K resize-pane -U 50 | bind-key -r L resize-pane -R 51 | 52 | bind-key b break-pane 53 | 54 | bind-key N command-prompt 'rename-session %%' 55 | 56 | unbind d 57 | 58 | bind-key S new-session 59 | 60 | # copy mode 61 | 62 | bind-key -T copy-mode-vi v send-keys -X begin-selection 63 | bind-key -T copy-mode-vi y send-keys -X copy-pipe 'pbcopy' 64 | bind-key -T copy-mode-vi DoubleClick1Pane send-keys -X select-word 65 | bind-key -T root DoubleClick1Pane select-pane -t = \; if-shell -F '#{||:#{pane_in_mode},#{mouse_any_flag}}' 'send -M' 'copy-mode -H; send -X select-word' 66 | bind-key -T root TripleClick1Pane select-pane -t = \; if-shell -F '#{||:#{pane_in_mode},#{mouse_any_flag}}' 'send -M' 'copy-mode -H; send -X select-line' 67 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # dotfiles 2 | 3 | ## Requirements 4 | 5 | - [Nix](https://nixos.org/) with `experimental-features = nix-command flakes` 6 | 7 | ## Setting up 8 | 9 | ```sh 10 | $ git clone https://github.com/ryota-ka/dotfiles.git 11 | $ cd ./dotfiles 12 | $ nix run .#switch 13 | ``` 14 | -------------------------------------------------------------------------------- /flake.lock: -------------------------------------------------------------------------------- 1 | { 2 | "nodes": { 3 | "home-manager": { 4 | "inputs": { 5 | "nixpkgs": [ 6 | "nixpkgs" 7 | ] 8 | }, 9 | "locked": { 10 | "lastModified": 1704099619, 11 | "narHash": "sha256-QRVMkdxLmv+aKGjcgeEg31xtJEIsYq4i1Kbyw5EPS6g=", 12 | "owner": "nix-community", 13 | "repo": "home-manager", 14 | "rev": "7e398b3d76bc1503171b1364c9d4a07ac06f3851", 15 | "type": "github" 16 | }, 17 | "original": { 18 | "owner": "nix-community", 19 | "ref": "release-23.11", 20 | "repo": "home-manager", 21 | "type": "github" 22 | } 23 | }, 24 | "nixpkgs": { 25 | "locked": { 26 | "lastModified": 1703992652, 27 | "narHash": "sha256-C0o8AUyu8xYgJ36kOxJfXIroy9if/G6aJbNOpA5W0+M=", 28 | "owner": "nixos", 29 | "repo": "nixpkgs", 30 | "rev": "32f63574c85fbc80e4ba1fbb932cde9619bad25e", 31 | "type": "github" 32 | }, 33 | "original": { 34 | "owner": "nixos", 35 | "ref": "nixos-23.11", 36 | "repo": "nixpkgs", 37 | "type": "github" 38 | } 39 | }, 40 | "root": { 41 | "inputs": { 42 | "home-manager": "home-manager", 43 | "nixpkgs": "nixpkgs" 44 | } 45 | } 46 | }, 47 | "root": "root", 48 | "version": 7 49 | } 50 | -------------------------------------------------------------------------------- /flake.nix: -------------------------------------------------------------------------------- 1 | { 2 | inputs = { 3 | nixpkgs.url = "github:nixos/nixpkgs/nixos-23.11"; 4 | home-manager = { 5 | url = "github:nix-community/home-manager/release-23.11"; 6 | inputs.nixpkgs.follows = "nixpkgs"; 7 | }; 8 | }; 9 | 10 | outputs = { self, home-manager, nixpkgs }: 11 | let 12 | system = "aarch64-darwin"; 13 | pkgs = nixpkgs.legacyPackages.${system}; 14 | in { 15 | apps.${system} = 16 | let 17 | switch = pkgs.writeShellScript "build.sh" '' 18 | home-manager switch --flake . --impure 19 | nvim --headless -c 'autocmd User PackerComplete quitall' -c 'PackerSync' 20 | ''; 21 | in 22 | { 23 | switch = { 24 | type = "app"; 25 | program = "${switch}"; 26 | }; 27 | }; 28 | devShells.${system}.default = pkgs.mkShell { 29 | buildInputs = [ 30 | home-manager.packages.${system}.default 31 | ]; 32 | }; 33 | hmModule.${system} = import ./home.nix; 34 | homeConfigurations."ryota-ka" = home-manager.lib.homeManagerConfiguration { 35 | inherit pkgs; 36 | 37 | modules = [ ./home.nix ]; 38 | }; 39 | legacyPackages.${system} = pkgs; 40 | lib = { 41 | inherit (home-manager.lib) homeManagerConfiguration; 42 | }; 43 | }; 44 | } 45 | -------------------------------------------------------------------------------- /home.nix: -------------------------------------------------------------------------------- 1 | { config, lib, pkgs, ... }: 2 | 3 | { 4 | home.activation = 5 | let 6 | exec = cmd: lib.hm.dag.entryAfter [ "writeBoundary" ] cmd; 7 | link = src: dest: exec '' 8 | $DRY_RUN_CMD mkdir -p $VERBOSE_ARG ${builtins.dirOf dest} 9 | $DRY_RUN_CMD ln -fs $VERBOSE_ARG ${src} ${dest} 10 | ''; 11 | mkdirp = dir: exec '' 12 | $DRY_RUN_CMD mkdir -p $VERBOSE_ARG ${dir} 13 | ''; 14 | in 15 | { 16 | cocPackageJSON = link ./vim/coc/package.json "${config.xdg.configHome}/coc/extensions/package.json"; 17 | cocSettingsJSON = link ./vim/coc/settings.json "${config.xdg.configHome}/nvim/coc-settings.json"; 18 | karabinerJSON = link ./karabiner.json "${config.xdg.configHome}/karabiner/karabiner.json"; 19 | neovimBackupDir = mkdirp "${config.xdg.dataHome}/nvim/backup"; 20 | neovimUndoDir = mkdirp "${config.xdg.dataHome}/nvim/undo"; 21 | }; 22 | home.homeDirectory = builtins.getEnv "HOME"; 23 | home.language.base = "en_US.UTF-8"; 24 | home.packages = [ 25 | pkgs.delta 26 | pkgs.jetbrains-mono 27 | (pkgs.nerdfonts.overrideAttrs { fonts = ["JetBrainsMono"]; }) 28 | pkgs.niv 29 | pkgs.yarn 30 | ]; 31 | home.sessionPath = [ 32 | "$HOME/.local/bin" 33 | ]; 34 | home.sessionVariables = { 35 | EDITOR = "nvim"; 36 | }; 37 | home.stateVersion = "23.11"; 38 | home.username = builtins.getEnv "USER"; 39 | 40 | programs.alacritty = { 41 | enable = true; 42 | 43 | settings = { 44 | colors = { 45 | normal = { 46 | black = "#1b1d1e"; 47 | red = "#f92672"; 48 | green = "#a6e22e"; 49 | yellow = "#fd971f"; 50 | blue = "#66d9ef"; 51 | magenta = "#ce27db"; 52 | cyan = "#ae81ff"; 53 | white = "#eeeeee"; 54 | }; 55 | primary = { 56 | background = "#1c1d1e"; 57 | foreground = "#fafafa"; 58 | }; 59 | }; 60 | cursor = { 61 | style = { 62 | blinking = "On"; 63 | }; 64 | }; 65 | font = { 66 | size = 18; 67 | normal = { 68 | family = "JetBrainsMono Nerd Font"; 69 | style = "ExtraLight"; 70 | }; 71 | bold = { 72 | style = "Bold"; 73 | }; 74 | italic = { 75 | style = "ExtraLight Italic"; 76 | }; 77 | bold_italic = { 78 | style = "Bold Italic"; 79 | }; 80 | }; 81 | window = { 82 | blur = true; 83 | decorations = "buttonless"; 84 | opacity = 0.95; 85 | option_as_alt = "Both"; 86 | }; 87 | }; 88 | }; 89 | 90 | programs.direnv = { 91 | enable = true; 92 | 93 | nix-direnv.enable = true; 94 | }; 95 | 96 | programs.fzf = { 97 | enable = true; 98 | 99 | defaultOptions = [ 100 | "--bind=ctrl-k:kill-line" 101 | "--bind=ctrl-space:toggle" 102 | "--reverse" 103 | ]; 104 | enableZshIntegration = false; 105 | }; 106 | 107 | programs.gh = { 108 | enable = true; 109 | }; 110 | 111 | programs.git = { 112 | enable = true; 113 | 114 | aliases = { 115 | br = "branch"; 116 | cm = "commit -m"; 117 | cma = "commit --amend"; 118 | co = "checkout"; 119 | dfc = "diff --cached"; 120 | lg = "log --oneline --graph --decorate"; 121 | rs = "reset"; 122 | st = "status"; 123 | }; 124 | delta = { 125 | enable = true; 126 | options = { 127 | line-numbers = true; 128 | navigate = true; 129 | side-by-side = true; 130 | }; 131 | }; 132 | extraConfig = { 133 | advice = { 134 | skippedCherryPicks = false; 135 | }; 136 | color = { 137 | ui = "auto"; 138 | }; 139 | init = { 140 | defaultBranch = "master"; 141 | }; 142 | merge = { 143 | conflictStyle = "diff3"; 144 | ff = false; 145 | }; 146 | pull = { 147 | ff = "only"; 148 | }; 149 | push = { 150 | default = "current"; 151 | }; 152 | rebase = { 153 | autosquash = true; 154 | autostash = true; 155 | stat = true; 156 | }; 157 | rerere = { 158 | enabled = true; 159 | }; 160 | }; 161 | ignores = [ 162 | "*~" 163 | "*.swp" 164 | ".DS_Store" 165 | ".direnv" 166 | ]; 167 | signing = { 168 | key = "B3A90912D6C9D2AE"; 169 | }; 170 | userName = "Ryota Kameoka"; 171 | userEmail = "ok@ryota-ka.me"; 172 | }; 173 | 174 | programs.home-manager = { 175 | enable = true; 176 | }; 177 | 178 | programs.neovim = { 179 | enable = true; 180 | 181 | defaultEditor = true; 182 | extraLuaConfig = '' 183 | vim.opt.termguicolors = true 184 | vim.opt.runtimepath:append('${./vim}') 185 | require('plugins') 186 | ''; 187 | plugins = [ 188 | { 189 | optional = false; 190 | plugin = pkgs.vimPlugins.packer-nvim; 191 | } 192 | ]; 193 | vimAlias = true; 194 | vimdiffAlias = true; 195 | withNodeJs = true; 196 | }; 197 | 198 | programs.tmux = { 199 | enable = true; 200 | 201 | baseIndex = 1; 202 | clock24 = true; 203 | escapeTime = 1; 204 | extraConfig = '' 205 | source ${./.tmux.conf} 206 | ''; 207 | historyLimit = 5000; 208 | keyMode = "vi"; 209 | newSession = false; 210 | prefix = "C-j"; 211 | shell = pkgs.lib.getExe pkgs.zsh; 212 | terminal = "screen-256color"; 213 | }; 214 | 215 | programs.zsh = { 216 | enable = true; 217 | 218 | completionInit = "autoload -U compinit && compinit -u"; 219 | defaultKeymap = "emacs"; 220 | dotDir = ".config/zsh"; 221 | envExtra = '' 222 | export NIX_PATH=$HOME/.nix-defexpr/channels 223 | 224 | if [ -e ~/.nix-profile/etc/profile.d/nix.sh ]; then 225 | . ~/.nix-profile/etc/profile.d/nix.sh 226 | fi 227 | ''; 228 | history = { 229 | extended = true; 230 | path = "${config.xdg.dataHome}/zsh/.zsh_history"; 231 | save = 1000000; 232 | size = 1000000; 233 | }; 234 | loginExtra = '' 235 | FPATH=${./zsh/functions}:$FPATH 236 | 237 | export FPATH 238 | 239 | . ${./zsh/completion.zsh} 240 | . ${./zsh/functions.zsh} 241 | . ${./zsh/history.zsh} 242 | . ${./zsh/hooks.zsh} 243 | . ${./zsh/ls.zsh} 244 | . ${./zsh/options.zsh} 245 | . ${./zsh/prompt.zsh} 246 | . ${./zsh/words.zsh} 247 | . ${./zsh/zmv.zsh} 248 | ''; 249 | shellAliases = { 250 | cp = "cp -i"; 251 | grep = "grep --colour=auto"; 252 | la = "ls -A"; 253 | ll = "ls -lh"; 254 | mv = "mv -i"; 255 | p = "popd"; 256 | vim = "nvim"; 257 | }; 258 | syntaxHighlighting = { 259 | enable = true; 260 | }; 261 | }; 262 | } 263 | -------------------------------------------------------------------------------- /karabiner.json: -------------------------------------------------------------------------------- 1 | { 2 | "global": { 3 | "check_for_updates_on_startup": true, 4 | "show_in_menu_bar": true, 5 | "show_profile_name_in_menu_bar": false 6 | }, 7 | "profiles": [ 8 | { 9 | "complex_modifications": { 10 | "parameters": { 11 | "basic.simultaneous_threshold_milliseconds": 50, 12 | "basic.to_delayed_action_delay_milliseconds": 500, 13 | "basic.to_if_alone_timeout_milliseconds": 1000, 14 | "basic.to_if_held_down_threshold_milliseconds": 500, 15 | "mouse_motion_to_scroll.speed": 100 16 | }, 17 | "rules": [ 18 | { 19 | "description": "Toggle IME with command keys", 20 | "manipulators": [ 21 | { 22 | "from": { 23 | "key_code": "left_command", 24 | "modifiers": { 25 | "optional": [ 26 | "any" 27 | ] 28 | } 29 | }, 30 | "parameters": { 31 | "basic.to_if_held_down_threshold_milliseconds": 100 32 | }, 33 | "to": [ 34 | { 35 | "key_code": "left_command", 36 | "lazy": true 37 | } 38 | ], 39 | "to_if_alone": [ 40 | { 41 | "key_code": "japanese_eisuu" 42 | } 43 | ], 44 | "to_if_held_down": [ 45 | { 46 | "key_code": "left_command" 47 | } 48 | ], 49 | "type": "basic" 50 | }, 51 | { 52 | "from": { 53 | "key_code": "right_command", 54 | "modifiers": { 55 | "optional": [ 56 | "any" 57 | ] 58 | } 59 | }, 60 | "parameters": { 61 | "basic.to_if_held_down_threshold_milliseconds": 100 62 | }, 63 | "to": [ 64 | { 65 | "key_code": "right_command", 66 | "lazy": true 67 | } 68 | ], 69 | "to_if_alone": [ 70 | { 71 | "key_code": "japanese_kana" 72 | } 73 | ], 74 | "to_if_held_down": [ 75 | { 76 | "key_code": "right_command" 77 | } 78 | ], 79 | "type": "basic" 80 | } 81 | ] 82 | }, 83 | { 84 | "description": "ctrl + w to option + delete", 85 | "manipulators": [ 86 | { 87 | "conditions": [ 88 | { 89 | "bundle_identifiers": [ 90 | "^com\\.apple\\.Terminal$" 91 | ], 92 | "type": "frontmost_application_unless" 93 | } 94 | ], 95 | "from": { 96 | "key_code": "w", 97 | "modifiers": { 98 | "mandatory": [ 99 | "control" 100 | ] 101 | } 102 | }, 103 | "to": [ 104 | { 105 | "key_code": "delete_or_backspace", 106 | "modifiers": [ 107 | "option" 108 | ] 109 | } 110 | ], 111 | "type": "basic" 112 | } 113 | ] 114 | }, 115 | { 116 | "description": "option + f/b to option + arrows", 117 | "manipulators": [ 118 | { 119 | "from": { 120 | "key_code": "f", 121 | "modifiers": { 122 | "mandatory": [ 123 | "option" 124 | ] 125 | } 126 | }, 127 | "to": [ 128 | { 129 | "key_code": "right_arrow", 130 | "modifiers": [ 131 | "option" 132 | ] 133 | } 134 | ], 135 | "type": "basic" 136 | }, 137 | { 138 | "from": { 139 | "key_code": "b", 140 | "modifiers": { 141 | "mandatory": [ 142 | "option" 143 | ] 144 | } 145 | }, 146 | "to": [ 147 | { 148 | "key_code": "left_arrow", 149 | "modifiers": [ 150 | "option" 151 | ] 152 | } 153 | ], 154 | "type": "basic" 155 | } 156 | ] 157 | }, 158 | { 159 | "description": "ctrl + [ to escape", 160 | "manipulators": [ 161 | { 162 | "conditions": [ 163 | { 164 | "keyboard_types": [ 165 | "ansi", 166 | "iso" 167 | ], 168 | "type": "keyboard_type_if" 169 | } 170 | ], 171 | "from": { 172 | "key_code": "open_bracket", 173 | "modifiers": { 174 | "mandatory": [ 175 | "control" 176 | ] 177 | } 178 | }, 179 | "to": [ 180 | { 181 | "key_code": "escape" 182 | }, 183 | { 184 | "key_code": "japanese_eisuu" 185 | } 186 | ], 187 | "type": "basic" 188 | } 189 | ] 190 | } 191 | ] 192 | }, 193 | "devices": [ 194 | { 195 | "disable_built_in_keyboard_if_exists": false, 196 | "fn_function_keys": [], 197 | "identifiers": { 198 | "is_keyboard": true, 199 | "is_pointing_device": false, 200 | "product_id": 637, 201 | "vendor_id": 1452 202 | }, 203 | "ignore": false, 204 | "manipulate_caps_lock_led": true, 205 | "simple_modifications": [ 206 | { 207 | "from": { 208 | "key_code": "caps_lock" 209 | }, 210 | "to": { 211 | "key_code": "left_control" 212 | } 213 | } 214 | ] 215 | } 216 | ], 217 | "fn_function_keys": [ 218 | { 219 | "from": { 220 | "key_code": "f1" 221 | }, 222 | "to": { 223 | "consumer_key_code": "display_brightness_decrement" 224 | } 225 | }, 226 | { 227 | "from": { 228 | "key_code": "f2" 229 | }, 230 | "to": { 231 | "consumer_key_code": "display_brightness_increment" 232 | } 233 | }, 234 | { 235 | "from": { 236 | "key_code": "f3" 237 | }, 238 | "to": { 239 | "key_code": "mission_control" 240 | } 241 | }, 242 | { 243 | "from": { 244 | "key_code": "f4" 245 | }, 246 | "to": { 247 | "key_code": "launchpad" 248 | } 249 | }, 250 | { 251 | "from": { 252 | "key_code": "f5" 253 | }, 254 | "to": { 255 | "key_code": "illumination_decrement" 256 | } 257 | }, 258 | { 259 | "from": { 260 | "key_code": "f6" 261 | }, 262 | "to": { 263 | "key_code": "illumination_increment" 264 | } 265 | }, 266 | { 267 | "from": { 268 | "key_code": "f7" 269 | }, 270 | "to": { 271 | "consumer_key_code": "rewind" 272 | } 273 | }, 274 | { 275 | "from": { 276 | "key_code": "f8" 277 | }, 278 | "to": { 279 | "consumer_key_code": "play_or_pause" 280 | } 281 | }, 282 | { 283 | "from": { 284 | "key_code": "f9" 285 | }, 286 | "to": { 287 | "consumer_key_code": "fastforward" 288 | } 289 | }, 290 | { 291 | "from": { 292 | "key_code": "f10" 293 | }, 294 | "to": { 295 | "consumer_key_code": "mute" 296 | } 297 | }, 298 | { 299 | "from": { 300 | "key_code": "f11" 301 | }, 302 | "to": { 303 | "consumer_key_code": "volume_decrement" 304 | } 305 | }, 306 | { 307 | "from": { 308 | "key_code": "f12" 309 | }, 310 | "to": { 311 | "consumer_key_code": "volume_increment" 312 | } 313 | } 314 | ], 315 | "name": "Default profile", 316 | "parameters": { 317 | "delay_milliseconds_before_open_device": 1000 318 | }, 319 | "selected": true, 320 | "simple_modifications": [], 321 | "virtual_hid_keyboard": { 322 | "country_code": 0, 323 | "mouse_key_xy_scale": 100 324 | } 325 | } 326 | ] 327 | } 328 | -------------------------------------------------------------------------------- /vim/coc/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "dependencies": { 3 | "coc-dictionary": ">=1.2.2", 4 | "coc-eslint": ">=1.3.1", 5 | "coc-git": ">=2.0.1", 6 | "coc-json": ">=1.3.1", 7 | "coc-prettier": ">=1.1.17", 8 | "coc-snippets": ">=2.2.0", 9 | "coc-tsserver": ">=1.5.7", 10 | "coc-word": ">=1.2.2" 11 | } 12 | } -------------------------------------------------------------------------------- /vim/coc/settings.json: -------------------------------------------------------------------------------- 1 | { 2 | "coc.preferences.formatOnSaveFiletypes": [ 3 | "javascript", 4 | "markdown", 5 | "typescript", 6 | "typescriptreact" 7 | ], 8 | "diagnostic.virtualText": true, 9 | "eslint.autoFixOnSave": true, 10 | "git.addGBlameToBufferVar": true, 11 | "git.showCommitInFloating": true, 12 | "languageserver": { 13 | "haskell": { 14 | "command": "haskell-language-server-wrapper", 15 | "args": ["--lsp"], 16 | "rootPatterns": [ 17 | "*.cabal", 18 | "stack.yaml", 19 | "cabal.project", 20 | "package.yaml" 21 | ], 22 | "filetypes": [ 23 | "hs", 24 | "lhs", 25 | "haskell" 26 | ], 27 | "initializationOptions": { 28 | "haskell": { 29 | } 30 | } 31 | } 32 | }, 33 | "typescript.preferences.importModuleSpecifier": "relative" 34 | } 35 | -------------------------------------------------------------------------------- /vim/dict/haskell.dict: -------------------------------------------------------------------------------- 1 | AllowAmbiguousTypes 2 | ApplicativeDo 3 | Arrows 4 | BangPatterns 5 | BinaryLiterals 6 | BlockArguments 7 | CApiFFI 8 | COLUMN 9 | COMPLETE 10 | CONLIKE 11 | CPP 12 | CUSKs 13 | ConstrainedClassMethods 14 | ConstraintKinds 15 | DEPRECATED 16 | DataKinds 17 | DatatypeContexts 18 | DefaultSignatures 19 | DeriveAnyClass 20 | DeriveDataTypeable 21 | DeriveFoldable 22 | DeriveFunctor 23 | DeriveGeneric 24 | DeriveLift 25 | DeriveTraversable 26 | DerivingStrategies 27 | DerivingVia 28 | DisambiguateRecordFields 29 | DuplicateRecordFields 30 | EmptyCase 31 | EmptyDataDecls 32 | EmptyDataDeriving 33 | ExistentialQuantification 34 | ExplicitForAll 35 | ExplicitNamespaces 36 | ExtendedDefaultRules 37 | FlexibleContexts 38 | FlexibleInstances 39 | ForeignFunctionInterface 40 | FunctionalDependencies 41 | GADTSyntax 42 | GADTs 43 | GeneralisedNewtypeDeriving 44 | Haskell2010 45 | Haskell98 46 | HexFloatLiterals 47 | INCLUDE 48 | INCOHERENT 49 | INLINABLE 50 | INLINE 51 | ImplicitParams 52 | ImportQualifiedPost 53 | ImpredicativeTypes 54 | IncoherentInstances 55 | InstanceSigs 56 | InterruptibleFFI 57 | KindSignatures 58 | LANGUAGE 59 | LINE 60 | LambdaCase 61 | LiberalTypeSynonyms 62 | MINIMAL 63 | MagicHash 64 | MonadComprehensions 65 | MonadFailDesugaring 66 | MonoLocalBinds 67 | MultiParamTypeClasses 68 | MultiWayIf 69 | NOINLINE 70 | NOUNPACK 71 | NPlusKPatterns 72 | NamedFieldPuns 73 | NamedWildCards 74 | NegativeLiterals 75 | NoImplicitPrelude 76 | NoMonomorphismRestriction 77 | NoPatternGuards 78 | NoTraditionalRecordSyntax 79 | NullaryTypeClasses 80 | NumDecimals 81 | NumericUnderscores 82 | OPTIONS_GHC 83 | OVERLAPPABLE 84 | OVERLAPPING 85 | OVERLAPS 86 | OverlappingInstances 87 | OverloadedLabels 88 | OverloadedLists 89 | OverloadedStrings 90 | PackageImports 91 | ParallelListComp 92 | PartialTypeSignatures 93 | PatternSynonyms 94 | PolyKinds 95 | PostfixOperators 96 | QuantifiedConstraints 97 | QuasiQuotes 98 | RULES 99 | Rank2Types 100 | RankNTypes 101 | RebindableSyntax 102 | RecordWildCards 103 | RecursiveDo 104 | RoleAnnotations 105 | SOURCE 106 | SPECIALIZE 107 | Safe 108 | ScopedTypeVariables 109 | StandaloneDeriving 110 | StandaloneKindSignatures 111 | StarIsType 112 | StaticPointers 113 | Strict 114 | StrictData 115 | TemplateHaskell 116 | TemplateHaskellQuotes 117 | TransformListComp 118 | Trustworthy 119 | TupleSections 120 | TypeApplications 121 | TypeFamilies 122 | TypeFamilyDependencies 123 | TypeInType 124 | TypeOperators 125 | TypeSynonymInstances 126 | UNPACK 127 | UnboxedSums 128 | UnboxedTuples 129 | UndecidableInstances 130 | UndecidableSuperClasses 131 | UnicodeSyntax 132 | UnliftedFFITypes 133 | UnliftedNewtypes 134 | Unsafe 135 | ViewPatterns 136 | WARNING 137 | anyclass 138 | as 139 | by 140 | capi 141 | case 142 | ccall 143 | class 144 | data 145 | default 146 | dependency 147 | deriving 148 | do 149 | dynamic 150 | else 151 | export 152 | family 153 | forall 154 | foreign 155 | group 156 | hiding 157 | if 158 | import 159 | in 160 | infix 161 | infixl 162 | infixr 163 | instance 164 | interruptible 165 | javascript 166 | label 167 | let 168 | mdo 169 | module 170 | ndecreasingIndentation 171 | newtype 172 | nominal 173 | of 174 | pattern 175 | phantom 176 | prim 177 | proc 178 | qualified 179 | rec 180 | representational 181 | role 182 | safe 183 | signature 184 | static 185 | stdcall 186 | stock 187 | then 188 | type 189 | unit 190 | unsafe 191 | using 192 | via 193 | where 194 | -------------------------------------------------------------------------------- /vim/dict/javascript.dict: -------------------------------------------------------------------------------- 1 | boolean 2 | break 3 | case 4 | catch 5 | class 6 | const 7 | continue 8 | debugger 9 | default 10 | delete 11 | do 12 | else 13 | enum 14 | export 15 | extends 16 | finally 17 | for 18 | function 19 | if 20 | implements 21 | import 22 | in 23 | instanceof 24 | interface 25 | let 26 | new 27 | null 28 | number 29 | package 30 | private 31 | protected 32 | public 33 | return 34 | static 35 | string 36 | super 37 | switch 38 | this 39 | throw 40 | try 41 | typeof 42 | undefined 43 | var 44 | void 45 | while 46 | with 47 | -------------------------------------------------------------------------------- /vim/ftdetect/tsx.vim: -------------------------------------------------------------------------------- 1 | autocmd BufRead,BufNewFile *.tsx setlocal filetype=typescript.tsx 2 | -------------------------------------------------------------------------------- /vim/ftplugin/gitcommit.vim: -------------------------------------------------------------------------------- 1 | setlocal spell 2 | -------------------------------------------------------------------------------- /vim/ftplugin/haskell.vim: -------------------------------------------------------------------------------- 1 | setlocal dictionary+=~/.vim/dict/haskell.dict 2 | -------------------------------------------------------------------------------- /vim/ftplugin/javascript.vim: -------------------------------------------------------------------------------- 1 | setlocal path+=$PWD/node_modules 2 | setlocal dictionary+=~/.vim/dict/javascript.dict 3 | -------------------------------------------------------------------------------- /vim/ftplugin/json.vim: -------------------------------------------------------------------------------- 1 | setlocal conceallevel=0 2 | -------------------------------------------------------------------------------- /vim/ftplugin/markdown.vim: -------------------------------------------------------------------------------- 1 | setlocal wrap 2 | -------------------------------------------------------------------------------- /vim/ftplugin/ruby.vim: -------------------------------------------------------------------------------- 1 | setlocal iskeyword+=@-@ 2 | -------------------------------------------------------------------------------- /vim/ftplugin/typescript.vim: -------------------------------------------------------------------------------- 1 | setlocal path+=$PWD/node_modules 2 | setlocal suffixesadd+=.js,.d.ts 3 | setlocal dictionary+=~/.vim/dict/javascript.dict 4 | -------------------------------------------------------------------------------- /vim/lua/plugins.lua: -------------------------------------------------------------------------------- 1 | return require('packer').startup(function(use) 2 | use({ 'cespare/vim-toml', ft = { 'toml' } }) 3 | use({ 'digitaltoad/vim-pug' }) 4 | use({ 'easymotion/vim-easymotion' }) 5 | use({ 'editorconfig/editorconfig-vim' }) 6 | use({ 'hashivim/vim-terraform' }) 7 | use({ 'haskell/haskell-ide-engine', ft = { 'haskell' } }) 8 | use({ 'itchyny/lightline.vim' }) 9 | use({ 'itchyny/vim-cursorword' }) 10 | use({ 'itchyny/vim-parenmatch' }) 11 | use({ 'jghauser/mkdir.nvim' }) 12 | use({ 'junegunn/fzf' }) 13 | use({ 'junegunn/fzf.vim' }) 14 | use({ 'junegunn/vim-peekaboo' }) 15 | use({ 16 | 'kevinhwang91/nvim-bqf', 17 | ft = { 'qf' }, 18 | }) 19 | use({ 'kshenoy/vim-signature' }) 20 | use({ 21 | 'kwkarlwang/bufresize.nvim', 22 | config = function() 23 | require('bufresize').setup() 24 | end, 25 | }) 26 | use({ 27 | 'kylechui/nvim-surround', 28 | config = function() 29 | require('nvim-surround').setup({}) 30 | end 31 | }) 32 | use({ 'LnL7/vim-nix' }) 33 | use({ 34 | 'lukas-reineke/indent-blankline.nvim', 35 | config = function() 36 | local highlight = { 37 | 'Indent', 38 | } 39 | 40 | local hooks = require('ibl.hooks') 41 | hooks.register(hooks.type.HIGHLIGHT_SETUP, function() 42 | vim.api.nvim_set_hl(0, 'Indent', { fg = '#333333' }) 43 | end) 44 | 45 | require('ibl').setup { 46 | indent = { 47 | highlight = highlight, 48 | }, 49 | scope = { 50 | enabled = false, 51 | }, 52 | } 53 | end, 54 | }) 55 | use({ 'mattn/emmet-vim', ft = { 'html', 'typescript.tsx' } }) 56 | use({ 'metakirby5/codi.vim' }) 57 | use({ 58 | 'mvllow/modes.nvim', 59 | config = function() 60 | require('modes').setup() 61 | end 62 | }) 63 | use({ 'neoclide/coc.nvim', run = 'yarn install' }) 64 | use({ 'neovimhaskell/haskell-vim', ft = { 'haskell' } }) 65 | use({ 'nvim-tree/nvim-web-devicons' }) 66 | use({ 67 | 'nvim-treesitter/nvim-treesitter', 68 | config = function() 69 | require('nvim-treesitter.configs').setup({ 70 | autotag = { 71 | enable = true, 72 | }, 73 | highlight = { 74 | enable = true, 75 | additional_vim_regex_highlighting = true, 76 | }, 77 | incremental_selection = { 78 | enable = true, 79 | keymaps = { 80 | init_selection = '+', 81 | node_decremental = '-', 82 | node_incremental = '+', 83 | }, 84 | }, 85 | indent = { 86 | enable = true, 87 | }, 88 | sync_install = false, 89 | }) 90 | end, 91 | run = function() 92 | require('nvim-treesitter.install').update({ with_sync = true })() 93 | end, 94 | }) 95 | use({ 96 | 'numToStr/Comment.nvim', 97 | config = function() 98 | require('Comment').setup() 99 | end 100 | }) 101 | use({ 'othree/html5.vim', ft = { 'html' } }) 102 | use({ 'purescript-contrib/purescript-vim', ft = { 'purescript' } }) 103 | use({ 'rust-lang/rust.vim', ft = { 'rust' } }) 104 | use({ 'scrooloose/nerdtree', cmd = { 'NERDTreeFind', 'NERDTreeToggle' } }) 105 | use({ 106 | 'sainnhe/sonokai', 107 | config = function() 108 | vim.g.sonokai_enable_italic = 1 109 | vim.g.sonokai_float_style = 'dim' 110 | vim.g.sonokai_transparent_background = 1 111 | vim.cmd('colorscheme sonokai') 112 | end, 113 | }) 114 | use({ 'SirVer/ultisnips' }) 115 | use({ 116 | 'sQVe/sort.nvim', 117 | config = function() 118 | require('sort').setup({}) 119 | end, 120 | }) 121 | use({ 'thinca/vim-quickrun' }) 122 | use({ 'tpope/vim-fugitive' }) 123 | use({ 'vim-scripts/vim-stylus', ft = { 'stylus' } }) 124 | use({ 125 | 'windwp/nvim-autopairs', 126 | config = function() 127 | require('nvim-autopairs').setup({}) 128 | end, 129 | }) 130 | use({ 'windwp/nvim-ts-autotag' }) 131 | use({ 'wsdjeg/vim-fetch' }) 132 | use({ 'Xuyuanp/nerdtree-git-plugin', cmd = { 'NERDTreeToggle' } }) 133 | end) 134 | -------------------------------------------------------------------------------- /vim/plugin/00-basic_configurations.lua: -------------------------------------------------------------------------------- 1 | vim.opt.fileencoding = 'utf-8' 2 | 3 | -- save backup file 4 | vim.opt.backup = true 5 | vim.opt.backupdir:remove('.') 6 | 7 | -- persistent undo 8 | vim.opt.undofile = true 9 | 10 | -- don't insert a whitespace on joining lines with multi-byte characters 11 | vim.opt.formatoptions:append('mM') 12 | 13 | -- allow virtual editing only in Visual block mode 14 | vim.opt.virtualedit = 'block' 15 | 16 | -- ignore case on ex-mode completion 17 | vim.opt.wildignorecase = true 18 | 19 | -- display only part of long lines 20 | vim.opt.wrap = false 21 | 22 | -- recover cursor position on opening a file 23 | vim.api.nvim_exec( 24 | [[ 25 | augroup recover_cursor_position 26 | autocmd! 27 | autocmd BufReadPost * 28 | \ if &filetype != 'gitcommit' && line("'\"") > 1 && line("'\"") <= line('$') | 29 | \ exe "normal! g`\"" | 30 | \ endif 31 | augroup END 32 | ]], 33 | false 34 | ) 35 | 36 | -- refresh screen on every 250ms 37 | vim.opt.updatetime = 250 38 | 39 | vim.opt.signcolumn = 'yes' 40 | 41 | vim.opt.clipboard:append('unnamedplus') 42 | 43 | -- reload buffer when modified outside of Vim 44 | vim.cmd([[autocmd FocusGained,BufEnter * checktime]]) 45 | -------------------------------------------------------------------------------- /vim/plugin/01-display.lua: -------------------------------------------------------------------------------- 1 | -- display line number 2 | vim.opt.number = true 3 | 4 | -- don't give the intro message when starting Vim 5 | vim.opt.shortmess:append('I') 6 | 7 | vim.opt.list = true 8 | 9 | -- use twice the width of ASCII characters for East Asian Width characters 10 | vim.opt.ambiwidth = 'double' 11 | 12 | -- don't redraw the screen while executing macros 13 | vim.opt.lazyredraw = true 14 | 15 | -- limit the maximum number of items in the popup menu for Insert mode completion 16 | vim.opt.pumheight = 10 17 | -------------------------------------------------------------------------------- /vim/plugin/02-search.lua: -------------------------------------------------------------------------------- 1 | -- ignore cases 2 | vim.opt.ignorecase = true 3 | 4 | -- do not ignore cases when the query includes both small and capital letters 5 | vim.opt.smartcase = true 6 | 7 | if vim.fn.has('nvim') == 1 then 8 | vim.opt.inccommand = 'split' 9 | end 10 | 11 | vim.keymap.set('n', 'n', 'n:call BlinkNextMatch()', { noremap = true, silent = true }) 12 | vim.keymap.set('n', 'N', 'N:call BlinkNextMatch()', { noremap = true, silent = true }) 13 | 14 | vim.cmd([[ 15 | function! BlinkNextMatch() abort 16 | highlight JustMatched ctermfg=white ctermbg=magenta cterm=bold 17 | 18 | let pat = '\c\%#' . @/ 19 | let id = matchadd('JustMatched', pat) 20 | redraw 21 | 22 | exec 'sleep 150m' 23 | call matchdelete(id) 24 | redraw 25 | endfunction 26 | ]]) 27 | 28 | vim.keymap.set('v', '/', 'y/"', { noremap = true }) 29 | -------------------------------------------------------------------------------- /vim/plugin/03-indentation.lua: -------------------------------------------------------------------------------- 1 | -- Number of spaces that a tab in the file counts for 2 | vim.opt.tabstop = 2 3 | 4 | -- Number of spaces to use for each step if (auto)indent 5 | vim.opt.shiftwidth = 2 6 | 7 | -- Insert spaces instead of a tab 8 | vim.opt.expandtab = true 9 | 10 | -- Do smart auto-indenting when starting a new line 11 | vim.opt.smartindent = true 12 | 13 | -- Fire indentation on pressing tab key 14 | vim.opt.indentkeys:append('!') 15 | -------------------------------------------------------------------------------- /vim/plugin/10-key_bindings.lua: -------------------------------------------------------------------------------- 1 | vim.api.nvim_set_keymap('n', 'h', 'zv', { noremap = true }) 2 | vim.api.nvim_set_keymap('n', 'j', 'gj', { noremap = true }) 3 | vim.api.nvim_set_keymap('n', 'k', 'gk', { noremap = true }) 4 | vim.api.nvim_set_keymap('n', 'l', 'zv', { noremap = true }) 5 | 6 | vim.api.nvim_set_keymap('v', 'j', 'gj', { noremap = true }) 7 | vim.api.nvim_set_keymap('v', 'k', 'gk', { noremap = true }) 8 | 9 | vim.api.nvim_set_keymap('n', '', 'g', { noremap = true }) 10 | 11 | vim.api.nvim_set_keymap('n', '', ':noh', { silent = true }) 12 | 13 | vim.api.nvim_set_keymap('c', '', '', { noremap = true }) 14 | vim.api.nvim_set_keymap('c', '', '', { noremap = true }) 15 | -------------------------------------------------------------------------------- /vim/plugin/11-key_bindings_emacs.lua: -------------------------------------------------------------------------------- 1 | vim.api.nvim_set_keymap('n', '', '', {}) 2 | vim.api.nvim_set_keymap('i', '', '', {}) 3 | vim.api.nvim_set_keymap('x', '', '', {}) 4 | vim.api.nvim_set_keymap('c', '', '', {}) 5 | 6 | vim.api.nvim_set_keymap('n', '', '', {}) 7 | vim.api.nvim_set_keymap('i', '', '', {}) 8 | vim.api.nvim_set_keymap('x', '', '', {}) 9 | vim.api.nvim_set_keymap('c', '', '', {}) 10 | 11 | vim.api.nvim_set_keymap('i', '', 'U', {}) 12 | vim.api.nvim_set_keymap('x', '', '', {}) 13 | vim.api.nvim_set_keymap('c', '', '', {}) 14 | 15 | vim.api.nvim_set_keymap('i', '', 'U', {}) 16 | vim.api.nvim_set_keymap('x', '', '', {}) 17 | vim.api.nvim_set_keymap('c', '', '', {}) 18 | 19 | vim.api.nvim_set_keymap('i', '', '', {}) 20 | vim.api.nvim_set_keymap('c', '', '', {}) 21 | -------------------------------------------------------------------------------- /vim/plugin/12-key_bindings_buffers.lua: -------------------------------------------------------------------------------- 1 | vim.api.nvim_set_keymap('n', '[b', ':bprevious', { silent = true }) 2 | vim.api.nvim_set_keymap('n', ']b', ':bnext', { silent = true }) 3 | -------------------------------------------------------------------------------- /vim/plugin/14-filetype_detection.lua: -------------------------------------------------------------------------------- 1 | vim.api.nvim_create_augroup('filetype_detection', {}) 2 | vim.api.nvim_create_autocmd({ 'BufNewFile', 'Bufread' }, { 3 | group = 'filetype_detection', 4 | callback = function() 5 | vim.opt_local.suffixesadd = vim.fn.expand('%:e') 6 | end, 7 | }) 8 | -------------------------------------------------------------------------------- /vim/plugin/21-lightline.lua: -------------------------------------------------------------------------------- 1 | vim.opt.showmode = false 2 | 3 | vim.g.lightline = { 4 | colorscheme = 'solarized', 5 | } 6 | -------------------------------------------------------------------------------- /vim/plugin/24-ultisnips.lua: -------------------------------------------------------------------------------- 1 | -- The default value is , which conflicts with coc.nvim 2 | vim.g.UltiSnipsExpandTrigger = 's' 3 | -------------------------------------------------------------------------------- /vim/plugin/25-coc-git.lua: -------------------------------------------------------------------------------- 1 | vim.api.nvim_set_keymap('n', ']g', '(coc-git-nextchunk)', { silent = true }) 2 | vim.api.nvim_set_keymap('n', '[g', '(coc-git-prevchunk)', { silent = true }) 3 | vim.api.nvim_set_keymap('n', 'gs', '(coc-git-chunkinfo)', { silent = true }) 4 | vim.api.nvim_set_keymap('n', 'gc', '(coc-git-commit)', { silent = true }) 5 | 6 | vim.api.nvim_set_keymap('o', 'ig', '(coc-git-chunk-inner)', { silent = true }) 7 | vim.api.nvim_set_keymap('x', 'ig', '(coc-git-chunk-inner)', { silent = true }) 8 | vim.api.nvim_set_keymap('o', 'ag', '(coc-git-chunk-outer)', { silent = true }) 9 | vim.api.nvim_set_keymap('x', 'ag', '(coc-git-chunk-outer)', { silent = true }) 10 | 11 | vim.api.nvim_set_keymap('n', 'ga', ':CocCommand git.chunkStage', { silent = true, noremap = true }) 12 | vim.api.nvim_set_keymap('n', 'g', ':CocList --normal gstatus', { silent = true }) 13 | 14 | vim.api.nvim_create_autocmd('CursorHold', { 15 | command = 'CocCommand git.refresh', 16 | }) 17 | -------------------------------------------------------------------------------- /vim/plugin/25-coc.lua: -------------------------------------------------------------------------------- 1 | vim.keymap.set( 2 | 'i', 3 | '', 4 | 'coc#pum#visible() ? coc#pum#next(1) : v:lua.check_back_space() ? "" : coc#refresh()', 5 | { silent = true, noremap = true, expr = true, replace_keycodes = false } 6 | ) 7 | vim.keymap.set( 8 | 'i', 9 | '', 10 | [[coc#pum#visible() ? coc#pum#prev(1) : "\"]], 11 | { silent = true, noremap = true, expr = true, replace_keycodes = false } 12 | ) 13 | 14 | function _G.check_back_space() 15 | local col = vim.fn.col('.') - 1 16 | return col == 0 or vim.fn.getline('.'):sub(col, col):match('%s') ~= nil 17 | end 18 | 19 | -- Use to trigger completion. 20 | vim.keymap.set('i', '', 'coc#refresh()', { silent = true, expr = true }) 21 | 22 | vim.keymap.set( 23 | 'i', 24 | '', 25 | [[coc#pum#visible() ? coc#pum#confirm() : "\u\\=coc#on_enter()\"]], 26 | { silent = true, noremap = true, expr = true, replace_keycodes = false } 27 | ) 28 | 29 | -- Use `[c` and `]c` to navigate diagnostics 30 | vim.keymap.set('n', '[c', '(coc-diagnostic-prev)', { silent = true }) 31 | vim.keymap.set('n', ']c', '(coc-diagnostic-next)', { silent = true }) 32 | 33 | -- Remap keys for gotos 34 | vim.keymap.set('n', 'gd', '(coc-definition)', { silent = true }) 35 | vim.keymap.set('n', 'gy', '(coc-type-definition)', { silent = true }) 36 | vim.keymap.set('n', 'gi', '(coc-implementation)', { silent = true }) 37 | vim.keymap.set('n', 'gr', '(coc-references)', { silent = true }) 38 | 39 | vim.keymap.set('n', '_', '(coc-codeaction-cursor)', { silent = true }) 40 | 41 | -- Use K to show documentation in preview window 42 | vim.keymap.set('n', 'K', 'lua _G.show_docs()', { silent = true }) 43 | 44 | function _G.show_docs() 45 | local cw = vim.fn.expand('') 46 | if vim.fn.index({ 'vim', 'help' }, vim.bo.filetype) >= 0 then 47 | vim.api.nvim_command('h ' .. cw) 48 | elseif vim.api.nvim_eval('coc#rpc#ready()') then 49 | vim.fn.CocActionAsync('doHover') 50 | else 51 | vim.api.nvim_command('!' .. vim.o.keywordprg .. ' ' .. cw) 52 | end 53 | end 54 | 55 | vim.api.nvim_create_autocmd('CursorHold', { 56 | command = "silent call CocActionAsync('highlight')", 57 | desc = 'Highlight symbol under cursor on CursorHold', 58 | }) 59 | 60 | -- Remap for rename current word 61 | vim.keymap.set('n', 'rn', '(coc-rename)') 62 | 63 | -- Remap for format selected region 64 | vim.keymap.set('x', 'f', '(coc-format-selected)', { silent = true }) 65 | vim.keymap.set('n', 'f', '(coc-format-selected)', { silent = true }) 66 | 67 | -- Remap for do codeAction of selected region, ex: `aap` for current paragraph 68 | vim.keymap.set('x', 'a', '(coc-codeaction-selected)') 69 | vim.keymap.set('n', 'a', '(coc-codeaction-selected)') 70 | 71 | -- Remap for do codeAction of current line 72 | vim.keymap.set('n', 'ac', '(coc-codeaction)') 73 | -- Fix autofix problem of current line 74 | vim.keymap.set('n', 'qf', '(coc-fix-current)') 75 | 76 | -- Use `:Format` to format current buffer 77 | vim.api.nvim_create_user_command('Format', "call CocAction('format')", {}) 78 | 79 | -- Use `:Fold` to fold current buffer 80 | vim.api.nvim_create_user_command('Fold', "call CocAction('fold', )", { nargs = '?' }) 81 | 82 | -- use `:OR` for organize import of current buffer 83 | vim.api.nvim_create_user_command('OR', "call CocActionAsync('runCommand', 'editor.action.organizeImport')", {}) 84 | 85 | -- Add status line support, for integration with other plugin, checkout `:h coc-status` 86 | vim.opt.statusline:prepend("%{coc#status()}%{get(b:,'coc_current_function','')}") 87 | 88 | -- Using CocList 89 | -- Show all diagnostics 90 | vim.keymap.set('n', 'a', ':CocList diagnostics', { nowait = true, silent = true }) 91 | -- Manage extensions 92 | vim.keymap.set('n', 'e', ':CocList extensions', { nowait = true, silent = true }) 93 | -- Show commands 94 | vim.keymap.set('n', 'c', ':CocList commands', { nowait = true, silent = true }) 95 | -- Find symbol of current document 96 | vim.keymap.set('n', 'o', ':CocList outline', { nowait = true, silent = true }) 97 | -- Search workspace symbols 98 | vim.keymap.set('n', 's', ':CocList -I symbols', { nowait = true, silent = true }) 99 | -- Do default action for next item. 100 | vim.keymap.set('n', 'j', ':CocNext', { nowait = true, silent = true }) 101 | -- Do default action for previous item. 102 | vim.keymap.set('n', 'k', ':CocPrev', { nowait = true, silent = true }) 103 | -- Resume latest coc list 104 | vim.keymap.set('n', 'p', ':CocListResume', { nowait = true, silent = true }) 105 | 106 | -- Use for both expand and jump (make expand higher priority.) 107 | vim.keymap.set('i', '', '(coc-snippets-expand-jump)') 108 | -------------------------------------------------------------------------------- /vim/plugin/25-emmet.lua: -------------------------------------------------------------------------------- 1 | vim.g.user_emmet_settings = { 2 | typescript = { 3 | extends = 'jsx', 4 | }, 5 | } 6 | -------------------------------------------------------------------------------- /vim/plugin/25-fzf.lua: -------------------------------------------------------------------------------- 1 | vim.api.nvim_create_user_command( 2 | 'GGrep', 3 | "call fzf#vim#grep('git grep --line-number -I --untracked '..shellescape(), 0, { 'dir': systemlist('git rev-parse --show-toplevel')[0] }, 0)", 4 | { 5 | nargs = '*', 6 | bang = true, 7 | } 8 | ) 9 | 10 | vim.keymap.set('n', 'b', ':Buffers', { noremap = true, silent = true }) 11 | vim.keymap.set('n', 'f', ':GFiles -co --exclude-standard', { noremap = true, silent = true }) 12 | vim.keymap.set('n', 'g', ':GGrep', { noremap = true, silent = true }) 13 | vim.keymap.set('n', 'l', ':Line', { noremap = true, silent = true }) 14 | vim.keymap.set('n', 'h', ':History', { noremap = true, silent = true }) 15 | vim.keymap.set('n', 't', ':Tags', { noremap = true, silent = true }) 16 | 17 | vim.g.fzf_buffers_jump = 1 18 | 19 | vim.api.nvim_create_augroup('fzf', {}) 20 | vim.api.nvim_create_autocmd({ 'BufNewFile', 'Bufread' }, { 21 | group = 'filetype_detection', 22 | callback = function() 23 | vim.opt_local.suffixesadd = vim.fn.expand('%:e') 24 | end, 25 | }) 26 | 27 | vim.api.nvim_create_autocmd('FileType', { 28 | pattern = { 'fzf' }, 29 | command = 'set laststatus=0 noshowmode noruler | autocmd BufLeave set laststatus=2 showmode ruler', 30 | }) 31 | -------------------------------------------------------------------------------- /vim/plugin/25-nerdtree.lua: -------------------------------------------------------------------------------- 1 | vim.api.nvim_set_keymap('n', '', ':NERDTreeFind', { silent = true }) 2 | 3 | vim.api.nvim_create_augroup('nerdtree', {}) 4 | vim.api.nvim_create_autocmd({ 'BufEnter' }, { 5 | group = 'nerdtree', 6 | callback = function() 7 | -- if vim.fn.winnr('$') == 1 and vim.fn.exists('b:NERDTree') and vim.b. 8 | -- -- if (winnr("$") == 1 && exists("b:NERDTree") && b:NERDTree.isTabTree()) | q | endif 9 | end, 10 | }) 11 | 12 | vim.g.NERDTreeIndicatorMapCustom = { 13 | Modified = 'M', 14 | Staged = 'A', 15 | Untracked = '?', 16 | Renamed = 'R', 17 | Unmerged = '-', 18 | Deleted = 'D', 19 | Dirty = '-', 20 | Clean = '-', 21 | Ignored = '!', 22 | Unknown = '?', 23 | } 24 | -------------------------------------------------------------------------------- /vim/plugin/29-misc.lua: -------------------------------------------------------------------------------- 1 | vim.g.loaded_matchparen = 1 2 | -------------------------------------------------------------------------------- /zsh/aliases.zsh: -------------------------------------------------------------------------------- 1 | alias cp='cp -i' 2 | alias grep='grep --colour=auto' 3 | alias la='ls -A' 4 | alias ll='ls -lh' 5 | alias mv='mv -i' 6 | alias p='popd' 7 | alias vim='nvim' 8 | -------------------------------------------------------------------------------- /zsh/completion.zsh: -------------------------------------------------------------------------------- 1 | zstyle ':completion:*' verbose yes 2 | zstyle ':completion:*' completer _expand _complete _match _prefix _approximate _list 3 | 4 | zstyle ':completion:*' list-colors '' 5 | zstyle ':completion:*:aliases' list-colors '=*=34' 6 | zstyle ':completion:*:builtins' list-colors '=*=35' 7 | zstyle ':completion:*:commands' list-colors '=*=33' 8 | zstyle ':completion:*:options' list-colors '=^(-- *)=36' 9 | zstyle ':completion:*:parameters' list-colors '=*=32' 10 | 11 | # ignore cases on completion 12 | zstyle ':completion:*' matcher-list 'm:{a-z}={A-Z}' 13 | 14 | # do not complete current directory after ../ 15 | zstyle ':completion:*' ignore-parents parent pwd .. 16 | 17 | # complete commands after sudo 18 | zstyle ':completion:*:sudo:*' command-path /usr/local/sbin /usr/local/bin \ 19 | /usr/sbin /usr/bin /sbin /bin /usr/X11R6/bin 20 | 21 | # complete process name after ps command 22 | zstyle ':completion:*:processes' command 'ps x -o pid,s,args' 23 | zstyle ':completion:*:*:*:*:processes' command 'ps -u $LOGNAME -o pid,user,command -w' 24 | zstyle ':completion:*:*:kill:*:processes' list-colors '=(#b) #([0-9]#) ([0-9a-z-]#)*=01;36=0=01' 25 | zstyle ':completion:*:*:kill:*' menu yes select 26 | zstyle ':completion:*:*:kill:*' force-list always 27 | zstyle ':completion:*:*:kill:*' insert-ids single 28 | 29 | zstyle ':completion:*' use-cache true 30 | 31 | zstyle '*' single-ignored show 32 | 33 | zstyle ':completion:*:default' menu select=2 34 | 35 | zstyle ':completion:*' group-name '' 36 | 37 | zstyle ':completion:*:messages' format ' 38 | %F{magenta}%d%f' 39 | 40 | zstyle ':completion:*:corrections' format ' 41 | %B%F{yellow}%d%f %F{red}(errors: %e)%f%b' 42 | 43 | zstyle ':completion:*:descriptions' format ' 44 | %F{yellow}%B%d%b%f' 45 | 46 | zstyle ':completion:*:options' description 'yes' 47 | 48 | zstyle ':completion:*:warnings' format '%F{red}No matches found%f' 49 | 50 | zstyle ':completion:*:*files' ignored-patterns '.git' 51 | 52 | # display "do you wish to see all M possibilities (N lines)?" message 53 | # only when the completion possibilities are beyond the screen size 54 | LISTMAX=0 55 | -------------------------------------------------------------------------------- /zsh/functions.zsh: -------------------------------------------------------------------------------- 1 | autoload -Uz clean-up-swap-files 2 | 3 | load() { 4 | autoload -Uz $1 5 | zle -N $1 6 | if [ "$2" != '' ]; then 7 | bindkey $2 $1 8 | fi 9 | } 10 | 11 | if which fzf > /dev/null; then 12 | load fzf-history-search '^R' 13 | 14 | load fzf-git-add '^[g^[a' 15 | load fzf-git-unstage '^[g^[u' 16 | 17 | load fzf-git-checkout-branch '^[g^[b' 18 | 19 | load fzf-git-ls-files-editor '^V' 20 | fi 21 | -------------------------------------------------------------------------------- /zsh/functions/clean-up-swap-files: -------------------------------------------------------------------------------- 1 | function clean-up-swap-files() { 2 | rm ~/.local/share/nvim/swap/* 3 | } 4 | -------------------------------------------------------------------------------- /zsh/functions/fzf-git-add: -------------------------------------------------------------------------------- 1 | fzf-git-add() { 2 | local files="$(git status --porcelain | egrep -v -e '^.{1} ' | fzf -m --preview 'git diff --color=always -- $(git rev-parse --show-cdup){2} | delta' | awk '{ print $2; }')" 3 | 4 | if [ -n "$files" ]; then 5 | git add $(echo $files | sed -e "s|^|$(git rev-parse --show-cdup)|" | tr '\n' ' ') 6 | git status 7 | fi 8 | } 9 | -------------------------------------------------------------------------------- /zsh/functions/fzf-git-checkout-branch: -------------------------------------------------------------------------------- 1 | fzf-git-checkout-branch() { 2 | local branches branch 3 | branches=$(git branch --all | grep -v HEAD | cut -c 3-) && 4 | branch=$(echo "$branches" | 5 | fzf -d $(( 2 + $(wc -l <<< "$branches") )) +m --preview "git diff --stat --color=always HEAD..{} -- $(git rev-parse --show-cdup)") && 6 | git checkout $(echo "$branch" | sed "s/.* //" | sed "s#remotes/[^/]*/##") 7 | } 8 | -------------------------------------------------------------------------------- /zsh/functions/fzf-git-ls-files-editor: -------------------------------------------------------------------------------- 1 | fzf-git-ls-files-editor() { 2 | local files="$(cat <(git status --short) <(git ls-files -co --exclude-standard | awk '{ print " " $0 }') | fzf -m --preview 'cat {2}' | sed 's/^...//')" 3 | 4 | if [ -n "$files" ]; then 5 | $EDITOR $(echo $files | tr '\n' ' ') < /dev/tty 6 | fi 7 | } 8 | -------------------------------------------------------------------------------- /zsh/functions/fzf-git-unstage: -------------------------------------------------------------------------------- 1 | fzf-git-unstage() { 2 | local files="$(git status --porcelain | grep -v '^ ' | grep -v '^??' | awk '{ print $2 }' | fzf -m --preview 'git diff --cached --color=always -- $(git rev-parse --show-cdup){} | delta')" 3 | 4 | if [ -n "$files" ]; then 5 | git reset HEAD $(echo $files | sed -e "s|^|$(git rev-parse --show-cdup)|" | tr '\n' ' ') 6 | fi 7 | } 8 | -------------------------------------------------------------------------------- /zsh/functions/fzf-history-search: -------------------------------------------------------------------------------- 1 | fzf-history-search() { 2 | local cmd=$( ([ -n "$ZSH_NAME" ] && fc -l 1 || history) | fzf +s --tac | sed 's/ *[0-9]* *//') 3 | 4 | BUFFER=$cmd 5 | CURSOR=#BUFFER 6 | } 7 | -------------------------------------------------------------------------------- /zsh/history.zsh: -------------------------------------------------------------------------------- 1 | setopt INC_APPEND_HISTORY 2 | 3 | autoload history-search-end 4 | zle -N history-beginning-search-backward-end history-search-end 5 | zle -N history-beginning-search-forward-end history-search-end 6 | bindkey "^[p" history-beginning-search-backward-end 7 | bindkey "^[n" history-beginning-search-forward-end 8 | -------------------------------------------------------------------------------- /zsh/hooks.zsh: -------------------------------------------------------------------------------- 1 | function chpwd() { 2 | if [ `ls -Al | wc -l` -eq 0 ]; then 3 | echo "\n\nempty directory"; 4 | else 5 | echo "\n" 6 | ls 7 | fi 8 | } 9 | 10 | function preexec() { 11 | cmd=$(echo $1 | cut -d' ' -f1 ) 12 | tmux rename-window "$cmd:$PWD:t" 13 | } 14 | 15 | function precmd() { 16 | psvar=() 17 | LANG=en_US.UTF-8 vcs_info 18 | [[ -n "$vcs_info_msg_0_" ]] && psvar[1]="$vcs_info_msg_0_" 19 | 20 | tmux rename-window "zsh:$PWD:t" 21 | } 22 | -------------------------------------------------------------------------------- /zsh/ls.zsh: -------------------------------------------------------------------------------- 1 | case ${OSTYPE} in 2 | darwin*) # configurations for OSX 3 | export CLICOLOR=1 4 | # export LSCOLORS=Exfxcxdxbxegedabagacad 5 | alias ls='ls -G -F' 6 | ;; 7 | linux*) # configurations for linux 8 | ;; 9 | esac 10 | -------------------------------------------------------------------------------- /zsh/options.zsh: -------------------------------------------------------------------------------- 1 | # 日本語ファイル名を表示可能にする 2 | setopt print_eight_bit 3 | 4 | # フローコントロールを無効にする 5 | setopt no_flow_control 6 | 7 | # '#' 以降をコメントとして扱う 8 | setopt interactive_comments 9 | 10 | # ディレクトリ名だけでcdする 11 | setopt auto_cd 12 | 13 | # cd したら自動的にpushdする 14 | setopt auto_pushd 15 | 16 | # 重複したディレクトリを追加しない 17 | setopt pushd_ignore_dups 18 | 19 | # = の後はパス名として補完する 20 | setopt magic_equal_subst 21 | 22 | # 同じコマンドをヒストリに残さない 23 | setopt hist_ignore_all_dups 24 | 25 | # ヒストリファイルに保存するとき、すでに重複したコマンドがあったら古い方を削除する 26 | setopt hist_save_nodups 27 | 28 | # スペースから始まるコマンド行はヒストリに残さない 29 | setopt hist_ignore_space 30 | 31 | # ヒストリに保存するときに余分なスペースを削除する 32 | setopt hist_reduce_blanks 33 | 34 | # 補完候補が複数あるときに自動的に一覧表示する 35 | setopt auto_menu 36 | 37 | # 明確なドットの指定なしで.から始まるファイルをマッチ 38 | setopt globdots 39 | 40 | # 高機能なワイルドカード展開を使用する 41 | setopt extended_glob 42 | 43 | # Unicode の正規化に関する問題を吸収 44 | setopt combining_chars 45 | -------------------------------------------------------------------------------- /zsh/prompt.zsh: -------------------------------------------------------------------------------- 1 | autoload -Uz vcs_info 2 | zstyle ':vcs_info:*' formats '%s: %b' 3 | zstyle ':vcs_info:*' actionformats '%s: %b (%a)' 4 | 5 | PROMPT=" 6 | %F{blue}[%~]%f %1(v|%F{green}%1v%f|) 7 | %(?.%F{yellow}%}.%F{red})$%f " 8 | -------------------------------------------------------------------------------- /zsh/words.zsh: -------------------------------------------------------------------------------- 1 | autoload -Uz select-word-style 2 | select-word-style default 3 | zstyle ':zle:*' word-chars " '\"(),-./:;=@[]{|}" 4 | zstyle ':zle:*' word-style unspecified 5 | -------------------------------------------------------------------------------- /zsh/zmv.zsh: -------------------------------------------------------------------------------- 1 | # enable zmv 2 | autoload -Uz zmv 3 | alias zmv='noglob zmv -W' 4 | --------------------------------------------------------------------------------