From b4242e0f559ebfef66e611d2ef416f0fcdb50e04 Mon Sep 17 00:00:00 2001 From: Donovan Glover Date: Fri, 16 Jun 2023 08:19:22 -0400 Subject: [PATCH] chore: Continue home-manager separation --- modules/joshuto/default.nix | 1484 ++++++++++++++--------------- modules/neovim/default.nix | 643 +++++++------ modules/waycorner/default.nix | 36 +- modules/xdg-user-dirs/default.nix | 28 +- src/main.nix | 3 + 5 files changed, 1087 insertions(+), 1107 deletions(-) diff --git a/modules/joshuto/default.nix b/modules/joshuto/default.nix index ac351a0e..309e4f9b 100644 --- a/modules/joshuto/default.nix +++ b/modules/joshuto/default.nix @@ -1,747 +1,741 @@ { pkgs, ... }: { - environment.systemPackages = with pkgs; [ - joshuto - ]; - - home-manager.sharedModules = [ - { - xdg.configFile."joshuto/joshuto.toml".text = /* toml */ '' - [display] - automatically_count_files = true - show_borders = false - show_hidden = true - show_icons = true - line_number_style = "absolute" - collapse_preview = false - - [preview] - max_preview_size = 10000000000 - preview_script = "~/.config/joshuto/preview.sh" - preview_shown_hook_script = "~/.config/joshuto/kitty-show.sh" - preview_removed_hook_script = "~/.config/joshuto/kitty-remove.sh" - ''; - - xdg.configFile."joshuto/preview.sh".source = ./preview.sh; - xdg.configFile."joshuto/kitty-show.sh".source = ./kitty-show.sh; - xdg.configFile."joshuto/kitty-remove.sh".source = ./kitty-remove.sh; - - xdg.configFile."joshuto/mimetype.toml".text = /* toml */ '' - [class] - audio_default = [ - { command = "mpv", args = [ "--" ] }, - { command = "mediainfo", confirm_exit = true }, - ] - - image_default = [ - { command = "feh", args = [ "--" ], fork = true, silent = true }, - ] - - video_default = [ - { command = "mpv", args = [ "--" ] , fork = true, silent = true }, - { command = "mediainfo", confirm_exit = true }, - { command = "mpv", args = [ "--mute", "on", "--" ], fork = true, silent = true }, - ] - - text_default = [ - { command = "nvim" }, - ] - - reader_default = [ - { command = "zathura", fork = true, silent = true }, - ] - - libreoffice_default = [ - { command = "libreoffice", fork = true, silent = true }, - ] - - [extension] - - ## image formats - avif.inherit = "image_default" - bmp.inherit = "image_default" - gif.inherit = "image_default" - heic.inherit = "image_default" - jpeg.inherit = "image_default" - jpe.inherit = "image_default" - jpg.inherit = "image_default" - pgm.inherit = "image_default" - png.inherit = "image_default" - ppm.inherit = "image_default" - webp.inherit = "image_default" - - ## audio formats - flac.inherit = "audio_default" - m4a.inherit = "audio_default" - mp3.inherit = "audio_default" - ogg.inherit = "audio_default" - wav.inherit = "audio_default" - - ## video formats - avi.inherit = "video_default" - av1.inherit = "video_default" - flv.inherit = "video_default" - mkv.inherit = "video_default" - m4v.inherit = "video_default" - mov.inherit = "video_default" - mp4.inherit = "video_default" - ts.inherit = "video_default" - webm.inherit = "video_default" - wmv.inherit = "video_default" - - ## text formats - build.inherit = "text_default" - c.inherit = "text_default" - cmake.inherit = "text_default" - conf.inherit = "text_default" - cpp.inherit = "text_default" - css.inherit = "text_default" - csv.inherit = "text_default" - cu.inherit = "text_default" - ebuild.inherit = "text_default" - eex.inherit = "text_default" - env.inherit = "text_default" - ex.inherit = "text_default" - exs.inherit = "text_default" - go.inherit = "text_default" - h.inherit = "text_default" - hpp.inherit = "text_default" - hs.inherit = "text_default" - html.inherit = "text_default" - ini.inherit = "text_default" - java.inherit = "text_default" - js.inherit = "text_default" - json.inherit = "text_default" - kt.inherit = "text_default" - lock.inherit = "text_default" - lua.inherit = "text_default" - log.inherit = "text_default" - md.inherit = "text_default" - micro.inherit = "text_default" - ninja.inherit = "text_default" - py.inherit = "text_default" - rkt.inherit = "text_default" - rs.inherit = "text_default" - scss.inherit = "text_default" - sh.inherit = "text_default" - srt.inherit = "text_default" - svelte.inherit = "text_default" - toml.inherit = "text_default" - tsx.inherit = "text_default" - txt.inherit = "text_default" - vim.inherit = "text_default" - xml.inherit = "text_default" - yaml.inherit = "text_default" - yml.inherit = "text_default" - - # archive formats - 7z.app_list = [ { command = "7z", args = [ "x" ], confirm_exit = true } ] - rar.app_list = [ - { command = "unrar", args = [ "x" ], confirm_exit = true }, - { command = "file-roller", fork = true, silent = true } ] - zip.app_list = [ - { command = "unzip", confirm_exit = true }, - { command = "file-roller", fork = true, silent = true } ] - - # misc formats - aup.app_list = [ - { command = "audacity", fork = true, silent = true } ] - - odt.inherit = "libreoffice_default" - odf.inherit = "libreoffice_default" - ods.inherit = "libreoffice_default" - odp.inherit = "libreoffice_default" - - doc.inherit = "libreoffice_default" - docx.inherit = "libreoffice_default" - xls.inherit = "libreoffice_default" - xlsx.inherit = "libreoffice_default" - ppt.inherit = "libreoffice_default" - pptx.inherit = "libreoffice_default" - - pdf.inherit = "reader_default" - - kra.app_list = [ - { command = "krita", fork = true, silent = true } - ] - kdenlive.app_list = [ - { command = "kdenlive", fork = true, silent = true } - ] - - tex.app_list = [ - { command = "micro" }, - { command = "gedit", fork = true, silent = true }, - { command = "bat", confirm_exit = true }, - { command = "pdflatex" } ] - - torrent.app_list = [ - { command = "transmission-gtk" } ] - - [mimetype] - - # application/octet-stream - [mimetype.application.subtype.octet-stream] - inherit = "video_default" - - # text/* - [mimetype.text] - inherit = "text_default" - - # text/* - [mimetype.video] - inherit = "video_default" - ''; - - xdg.configFile."joshuto/keymap.toml".text = /* toml */ '' - [default_view] - - keymap = [ - { keys = ["escape"], command = "escape" }, - { keys = ["ctrl+t"], command = "new_tab" }, - { keys = ["alt+t"], command = "new_tab --cursor" }, - { keys = ["T"], command = "new_tab --current" }, - { keys = ["W"], command = "close_tab" }, - { keys = ["ctrl+w"], command = "close_tab" }, - { keys = ["q"], command = "close_tab" }, - { keys = ["ctrl+c"], command = "quit" }, - { keys = ["o"], command = "quit --output-selected-files" }, - - { keys = ["R"], command = "reload_dirlist" }, - { keys = ["z", "h"], command = "toggle_hidden" }, - { keys = ["ctrl+h"], command = "toggle_hidden" }, - { keys = ["\t"], command = "tab_switch 1" }, - { keys = ["backtab"], command = "tab_switch -1" }, - - { keys = ["alt+1"], command = "tab_switch_index 1" }, - { keys = ["alt+2"], command = "tab_switch_index 2" }, - { keys = ["alt+3"], command = "tab_switch_index 3" }, - { keys = ["alt+4"], command = "tab_switch_index 4" }, - { keys = ["alt+5"], command = "tab_switch_index 5" }, - - { keys = ["1"], command = "numbered_command 1" }, - { keys = ["2"], command = "numbered_command 2" }, - { keys = ["3"], command = "numbered_command 3" }, - { keys = ["4"], command = "numbered_command 4" }, - { keys = ["5"], command = "numbered_command 5" }, - { keys = ["6"], command = "numbered_command 6" }, - { keys = ["7"], command = "numbered_command 7" }, - { keys = ["8"], command = "numbered_command 8" }, - { keys = ["9"], command = "numbered_command 9" }, - - # arrow keys - { keys = ["arrow_up"], command = "cursor_move_up" }, - { keys = ["arrow_down"], command = "cursor_move_down" }, - { keys = ["arrow_left"], command = "cd .." }, - { keys = ["arrow_right"], command = "open" }, - { keys = ["\n"], command = "open" }, - { keys = ["home"], command = "cursor_move_home" }, - { keys = ["end"], command = "cursor_move_end" }, - { keys = ["page_up"], command = "cursor_move_page_up" }, - { keys = ["page_down"], command = "cursor_move_page_down" }, - { keys = ["ctrl+u"], command = "cursor_move_page_up 0.5" }, - { keys = ["ctrl+d"], command = "cursor_move_page_down 0.5" }, - - # vim-like keybindings - { keys = ["j"], command = "cursor_move_down" }, - { keys = ["k"], command = "cursor_move_up" }, - { keys = ["h"], command = "cd .." }, - { keys = ["l"], command = "open" }, - { keys = ["g", "g"], command = "cursor_move_home" }, - { keys = ["G"], command = "cursor_move_end" }, - { keys = ["r"], command = "open_with" }, - - { keys = ["H"], command = "cursor_move_page_home" }, - { keys = ["L"], command = "cursor_move_page_middle" }, - { keys = ["M"], command = "cursor_move_page_end" }, - - { keys = ["["], command = "parent_cursor_move_up" }, - { keys = ["]"], command = "parent_cursor_move_down" }, - - { keys = ["c", "d"], command = ":cd " }, - { keys = ["d", "d"], command = "cut_files" }, - { keys = ["y", "y"], command = "copy_files" }, - { keys = ["y", "n"], command = "copy_filename" }, - { keys = ["y", "."], command = "copy_filename_without_extension" }, - { keys = ["y", "p"], command = "copy_filepath" }, - { keys = ["y", "d"], command = "copy_dirpath" }, - - { keys = ["p", "l"], command = "symlink_files --relative=false" }, - { keys = ["p", "L"], command = "symlink_files --relative=true" }, - - { keys = ["delete"], command = "delete_files" }, - { keys = ["d", "D"], command = "delete_files" }, - - { keys = ["p", "p"], command = "paste_files" }, - { keys = ["p", "o"], command = "paste_files --overwrite=true" }, - - { keys = ["a"], command = "rename_append" }, - { keys = ["A"], command = "rename_prepend" }, - - { keys = ["f", "t"], command = ":touch " }, - - { keys = [" "], command = "select --toggle=true" }, - { keys = ["t"], command = "select --all=true --toggle=true" }, - { keys = ["V"], command = "toggle_visual" }, - - { keys = ["w"], command = "show_tasks --exit-key=w" }, - { keys = ["b", "b"], command = "bulk_rename" }, - { keys = ["="], command = "set_mode" }, - - { keys = [":"], command = ":" }, - { keys = [";"], command = ":" }, - - { keys = ["'"], command = ":shell " }, - { keys = ["m", "k"], command = ":mkdir " }, - { keys = ["c", "w"], command = ":rename " }, - - { keys = ["/"], command = ":search " }, - { keys = ["|"], command = ":search_inc " }, - { keys = ["\\"], command = ":search_glob " }, - { keys = ["S"], command = "search_fzf" }, - { keys = ["C"], command = "subdir_fzf" }, - - { keys = ["n"], command = "search_next" }, - { keys = ["N"], command = "search_prev" }, - - { keys = ["s", "r"], command = "sort reverse" }, - { keys = ["s", "l"], command = "sort lexical" }, - { keys = ["s", "m"], command = "sort mtime" }, - { keys = ["s", "n"], command = "sort natural" }, - { keys = ["s", "s"], command = "sort size" }, - { keys = ["s", "e"], command = "sort ext" }, - - { keys = ["m", "s"], command = "linemode size" }, - { keys = ["m", "m"], command = "linemode mtime" }, - { keys = ["m", "M"], command = "linemode sizemtime" }, - - { keys = ["g", "r"], command = "cd /" }, - { keys = ["g", "c"], command = "cd ~/.config" }, - { keys = ["g", "d"], command = "cd ~/Downloads" }, - { keys = ["g", "e"], command = "cd /etc" }, - { keys = ["g", "h"], command = "cd ~/" }, - { keys = ["?"], command = "help" }, - ] - - [task_view] - - keymap = [ - # arrow keys - { keys = ["arrow_up"], command = "cursor_move_up" }, - { keys = ["arrow_down"], command = "cursor_move_down" }, - { keys = ["home"], command = "cursor_move_home" }, - { keys = ["end"], command = "cursor_move_end" }, - - # vim-like keybindings - { keys = ["j"], command = "cursor_move_down" }, - { keys = ["k"], command = "cursor_move_up" }, - { keys = ["g", "g"], command = "cursor_move_home" }, - { keys = ["G"], command = "cursor_move_end" }, - - { keys = ["w"], command = "show_tasks" }, - { keys = ["escape"], command = "show_tasks" }, - ] - - [help_view] - - keymap = [ - # arrow keys - { keys = ["arrow_up"], command = "cursor_move_up" }, - { keys = ["arrow_down"], command = "cursor_move_down" }, - { keys = ["home"], command = "cursor_move_home" }, - { keys = ["end"], command = "cursor_move_end" }, - - # vim-like keybindings - { keys = ["j"], command = "cursor_move_down" }, - { keys = ["k"], command = "cursor_move_up" }, - { keys = ["g", "g"], command = "cursor_move_home" }, - { keys = ["G"], command = "cursor_move_end" }, - - { keys = ["w"], command = "show_tasks" }, - { keys = ["escape"], command = "show_tasks" }, - ] - ''; - - xdg.configFile."joshuto/theme.toml".text = /* toml */ '' - [selection] - fg = "light_yellow" - bold = true - - [visual_mode_selection] - fg = "light_red" - bold = true - - [selection.prefix] - prefix = " " - size = 2 - - [executable] - fg = "light_green" - bold = true - - [regular] - fg = "white" - - [directory] - fg = "light_blue" - bold = true - - [link] - fg = "cyan" - bold = true - - [link_invalid] - fg = "red" - bold = true - - [socket] - fg = "light_magenta" - bold = true - - [ext] - - bmp.fg = "yellow" - gif.fg = "yellow" - heic.fg = "yellow" - jpg.fg = "yellow" - jpeg.fg = "yellow" - pgm.fg = "yellow" - png.fg = "yellow" - ppm.fg = "yellow" - svg.fg = "yellow" - - wav.fg = "magenta" - flac.fg = "magenta" - mp3.fg = "magenta" - amr.fg = "magenta" - - avi.fg = "magenta" - flv.fg = "magenta" - m3u.fg = "magenta" - m4a.fg = "magenta" - m4v.fg = "magenta" - mkv.fg = "magenta" - mov.fg = "magenta" - mp4.fg = "magenta" - mpg.fg = "magenta" - rmvb.fg = "magenta" - webm.fg = "magenta" - wmv.fg = "magenta" - - 7z.fg = "red" - bz2.fg = "red" - gz.fg = "red" - rar.fg = "red" - tar.fg = "red" - tgz.fg = "red" - xz.fg = "red" - zip.fg = "red" - ''; - - xdg.configFile."joshuto/icons.toml".text = /* toml */ '' - # Default fallback icons - [defaults] - file = "" - directory = "" - - # Directory exact match icons - [directory_exact] - # English - ".git" = "" - "Desktop" = "" - "Documents" = "" - "Downloads" = "" - "Dotfiles" = "" - "Dropbox" = "" - "Music" = "" - "Pictures" = "" - "Public" = "" - "Templates" = "" - "Videos" = "" - - # File exact match icons - [file_exact] - ".bash_aliases" = "" - ".bash_history" = "" - ".bash_logout" = "" - ".bash_profile" = "" - ".bashprofile" = "" - ".bashrc" = "" - ".dmrc" = "" - ".DS_Store" = "" - ".fasd" = "" - ".fehbg" = "" - ".gitattributes" = "" - ".gitconfig" = "" - ".gitignore" = "" - ".gitlab-ci.yml" = "" - ".gvimrc" = "" - ".inputrc" = "" - ".jack-settings" = "" - ".mime.types" = "" - ".ncmpcpp" = "" - ".nvidia-settings-rc" = "" - ".pam_environment" = "" - ".profile" = "" - ".recently-used" = "" - ".selected_editor" = "" - ".vim" = "" - ".viminfo" = "" - ".vimrc" = "" - ".Xauthority" = "" - ".Xdefaults" = "" - ".xinitrc" = "" - ".xinputrc" = "" - ".Xresources" = "" - ".zshrc" = "" - "_gvimrc" = "" - "_vimrc" = "" - "a.out" = "" - "authorized_keys" = "" - "bspwmrc" = "" - "cmakelists.txt" = "" - "config" = "" - "config.ac" = "" - "config.m4" = "" - "config.mk" = "" - "config.ru" = "" - "configure" = "" - "docker-compose.yml" = "" - "dockerfile" = "" - "Dockerfile" = "" - "dropbox" = "" - "exact-match-case-sensitive-1.txt" = "X1" - "exact-match-case-sensitive-2" = "X2" - "favicon.ico" = "" - "gemfile" = "" - "gruntfile.coffee" = "" - "gruntfile.js" = "" - "gruntfile.ls" = "" - "gulpfile.coffee" = "" - "gulpfile.js" = "" - "gulpfile.ls" = "" - "ini" = "" - "known_hosts" = "" - "ledger" = "" - "license" = "" - "LICENSE" = "" - "LICENSE.md" = "" - "LICENSE.txt" = "" - "Makefile" = "" - "makefile" = "" - "Makefile.ac" = "" - "Makefile.in" = "" - "mimeapps.list" = "" - "mix.lock" = "" - "node_modules" = "" - "package-lock.json" = "" - "package.json" = "" - "playlists" = "" - "procfile" = "" - "Rakefile" = "" - "rakefile" = "" - "react.jsx" = "" - "README" = "" - "README.markdown" = "" - "README.md" = "" - "README.rst" = "" - "README.txt" = "" - "sxhkdrc" = "" - "user-dirs.dirs" = "" - "webpack.config.js" = "" - - # File extension match - [ext] - "7z" = "" - "a" = "" - "ai" = "" - "apk" = "" - "asm" = "" - "asp" = "" - "aup" = "" - "avi" = "" - "awk" = "" - "bash" = "" - "bat" = "" - "bmp" = "" - "bz2" = "" - "c" = "" - "c++" = "" - "cab" = "" - "cbr" = "" - "cbz" = "" - "cc" = "" - "class" = "" - "clj" = "" - "cljc" = "" - "cljs" = "" - "cmake" = "" - "coffee" = "" - "conf" = "" - "cp" = "" - "cpio" = "" - "cpp" = "" - "cs" = "" - "csh" = "" - "css" = "" - "cue" = "" - "cvs" = "" - "cxx" = "" - "d" = "" - "dart" = "" - "db" = "" - "deb" = "" - "diff" = "" - "dll" = "" - "doc" = "" - "docx" = "" - "dump" = "" - "edn" = "" - "eex" = "" - "efi" = "" - "ejs" = "" - "elf" = "" - "elm" = "" - "epub" = "" - "erl" = "" - "ex" = "" - "exe" = "" - "exs" = "" - "f//" = "" - "fifo" = "|" - "fish" = "" - "flac" = "" - "flv" = "" - "fs" = "" - "fsi" = "" - "fsscript" = "" - "fsx" = "" - "gem" = "" - "gemspec" = "" - "gif" = "" - "go" = "" - "gz" = "" - "gzip" = "" - "h" = "" - "haml" = "" - "hbs" = "" - "hh" = "" - "hpp" = "" - "hrl" = "" - "hs" = "" - "htaccess" = "" - "htm" = "" - "html" = "" - "htpasswd" = "" - "hxx" = "" - "ico" = "" - "img" = "" - "ini" = "" - "iso" = "" - "jar" = "" - "java" = "" - "jl" = "" - "jpeg" = "" - "jpg" = "" - "js" = "" - "json" = "" - "jsx" = "" - "key" = "" - "ksh" = "" - "leex" = "" - "less" = "" - "lha" = "" - "lhs" = "" - "log" = "" - "lua" = "" - "lzh" = "" - "lzma" = "" - "m4a" = "" - "m4v" = "" - "markdown" = "" - "md" = "" - "mdx" = "" - "mjs" = "" - "mkv" = "" - "ml" = "λ" - "mli" = "λ" - "mov" = "" - "mp3" = "" - "mp4" = "" - "mpeg" = "" - "mpg" = "" - "msi" = "" - "mustache" = "" - "nix" = "" - "o" = "" - "ogg" = "" - "pdf" = "" - "php" = "" - "pl" = "" - "pm" = "" - "png" = "" - "pp" = "" - "ppt" = "" - "pptx" = "" - "ps1" = "" - "psb" = "" - "psd" = "" - "pub" = "" - "py" = "" - "pyc" = "" - "pyd" = "" - "pyo" = "" - "r" = "ﳒ" - "rake" = "" - "rar" = "" - "rb" = "" - "rc" = "" - "rlib" = "" - "rmd" = "" - "rom" = "" - "rpm" = "" - "rproj" = "鉶" - "rs" = "" - "rss" = "" - "rtf" = "" - "s" = "" - "sass" = "" - "scala" = "" - "scss" = "" - "sh" = "" - "slim" = "" - "sln" = "" - "so" = "" - "sql" = "" - "styl" = "" - "suo" = "" - "swift" = "" - "t" = "" - "tar" = "" - "tex" = "ﭨ" - "tgz" = "" - "toml" = "" - "ts" = "" - "tsx" = "" - "twig" = "" - "vim" = "" - "vimrc" = "" - "vue" = "﵂" - "wav" = "" - "webm" = "" - "webmanifest" = "" - "webp" = "" - "xbps" = "" - "xcplayground" = "" - "xhtml" = "" - "xls" = "" - "xlsx" = "" - "xml" = "" - "xul" = "" - "xz" = "" - "yaml" = "" - "yml" = "" - "zip" = "" - "zsh" = "" - ''; - } - ]; + home.packages = with pkgs; [ joshuto ]; + + xdg.configFile."joshuto/joshuto.toml".text = /* toml */ '' + [display] + automatically_count_files = true + show_borders = false + show_hidden = true + show_icons = true + line_number_style = "absolute" + collapse_preview = false + + [preview] + max_preview_size = 10000000000 + preview_script = "~/.config/joshuto/preview.sh" + preview_shown_hook_script = "~/.config/joshuto/kitty-show.sh" + preview_removed_hook_script = "~/.config/joshuto/kitty-remove.sh" + ''; + + xdg.configFile."joshuto/preview.sh".source = ./preview.sh; + xdg.configFile."joshuto/kitty-show.sh".source = ./kitty-show.sh; + xdg.configFile."joshuto/kitty-remove.sh".source = ./kitty-remove.sh; + + xdg.configFile."joshuto/mimetype.toml".text = /* toml */ '' + [class] + audio_default = [ + { command = "mpv", args = [ "--" ] }, + { command = "mediainfo", confirm_exit = true }, + ] + + image_default = [ + { command = "feh", args = [ "--" ], fork = true, silent = true }, + ] + + video_default = [ + { command = "mpv", args = [ "--" ] , fork = true, silent = true }, + { command = "mediainfo", confirm_exit = true }, + { command = "mpv", args = [ "--mute", "on", "--" ], fork = true, silent = true }, + ] + + text_default = [ + { command = "nvim" }, + ] + + reader_default = [ + { command = "zathura", fork = true, silent = true }, + ] + + libreoffice_default = [ + { command = "libreoffice", fork = true, silent = true }, + ] + + [extension] + + ## image formats + avif.inherit = "image_default" + bmp.inherit = "image_default" + gif.inherit = "image_default" + heic.inherit = "image_default" + jpeg.inherit = "image_default" + jpe.inherit = "image_default" + jpg.inherit = "image_default" + pgm.inherit = "image_default" + png.inherit = "image_default" + ppm.inherit = "image_default" + webp.inherit = "image_default" + + ## audio formats + flac.inherit = "audio_default" + m4a.inherit = "audio_default" + mp3.inherit = "audio_default" + ogg.inherit = "audio_default" + wav.inherit = "audio_default" + + ## video formats + avi.inherit = "video_default" + av1.inherit = "video_default" + flv.inherit = "video_default" + mkv.inherit = "video_default" + m4v.inherit = "video_default" + mov.inherit = "video_default" + mp4.inherit = "video_default" + ts.inherit = "video_default" + webm.inherit = "video_default" + wmv.inherit = "video_default" + + ## text formats + build.inherit = "text_default" + c.inherit = "text_default" + cmake.inherit = "text_default" + conf.inherit = "text_default" + cpp.inherit = "text_default" + css.inherit = "text_default" + csv.inherit = "text_default" + cu.inherit = "text_default" + ebuild.inherit = "text_default" + eex.inherit = "text_default" + env.inherit = "text_default" + ex.inherit = "text_default" + exs.inherit = "text_default" + go.inherit = "text_default" + h.inherit = "text_default" + hpp.inherit = "text_default" + hs.inherit = "text_default" + html.inherit = "text_default" + ini.inherit = "text_default" + java.inherit = "text_default" + js.inherit = "text_default" + json.inherit = "text_default" + kt.inherit = "text_default" + lock.inherit = "text_default" + lua.inherit = "text_default" + log.inherit = "text_default" + md.inherit = "text_default" + micro.inherit = "text_default" + ninja.inherit = "text_default" + py.inherit = "text_default" + rkt.inherit = "text_default" + rs.inherit = "text_default" + scss.inherit = "text_default" + sh.inherit = "text_default" + srt.inherit = "text_default" + svelte.inherit = "text_default" + toml.inherit = "text_default" + tsx.inherit = "text_default" + txt.inherit = "text_default" + vim.inherit = "text_default" + xml.inherit = "text_default" + yaml.inherit = "text_default" + yml.inherit = "text_default" + + # archive formats + 7z.app_list = [ { command = "7z", args = [ "x" ], confirm_exit = true } ] + rar.app_list = [ + { command = "unrar", args = [ "x" ], confirm_exit = true }, + { command = "file-roller", fork = true, silent = true } ] + zip.app_list = [ + { command = "unzip", confirm_exit = true }, + { command = "file-roller", fork = true, silent = true } ] + + # misc formats + aup.app_list = [ + { command = "audacity", fork = true, silent = true } ] + + odt.inherit = "libreoffice_default" + odf.inherit = "libreoffice_default" + ods.inherit = "libreoffice_default" + odp.inherit = "libreoffice_default" + + doc.inherit = "libreoffice_default" + docx.inherit = "libreoffice_default" + xls.inherit = "libreoffice_default" + xlsx.inherit = "libreoffice_default" + ppt.inherit = "libreoffice_default" + pptx.inherit = "libreoffice_default" + + pdf.inherit = "reader_default" + + kra.app_list = [ + { command = "krita", fork = true, silent = true } + ] + kdenlive.app_list = [ + { command = "kdenlive", fork = true, silent = true } + ] + + tex.app_list = [ + { command = "micro" }, + { command = "gedit", fork = true, silent = true }, + { command = "bat", confirm_exit = true }, + { command = "pdflatex" } ] + + torrent.app_list = [ + { command = "transmission-gtk" } ] + + [mimetype] + + # application/octet-stream + [mimetype.application.subtype.octet-stream] + inherit = "video_default" + + # text/* + [mimetype.text] + inherit = "text_default" + + # text/* + [mimetype.video] + inherit = "video_default" + ''; + + xdg.configFile."joshuto/keymap.toml".text = /* toml */ '' + [default_view] + + keymap = [ + { keys = ["escape"], command = "escape" }, + { keys = ["ctrl+t"], command = "new_tab" }, + { keys = ["alt+t"], command = "new_tab --cursor" }, + { keys = ["T"], command = "new_tab --current" }, + { keys = ["W"], command = "close_tab" }, + { keys = ["ctrl+w"], command = "close_tab" }, + { keys = ["q"], command = "close_tab" }, + { keys = ["ctrl+c"], command = "quit" }, + { keys = ["o"], command = "quit --output-selected-files" }, + + { keys = ["R"], command = "reload_dirlist" }, + { keys = ["z", "h"], command = "toggle_hidden" }, + { keys = ["ctrl+h"], command = "toggle_hidden" }, + { keys = ["\t"], command = "tab_switch 1" }, + { keys = ["backtab"], command = "tab_switch -1" }, + + { keys = ["alt+1"], command = "tab_switch_index 1" }, + { keys = ["alt+2"], command = "tab_switch_index 2" }, + { keys = ["alt+3"], command = "tab_switch_index 3" }, + { keys = ["alt+4"], command = "tab_switch_index 4" }, + { keys = ["alt+5"], command = "tab_switch_index 5" }, + + { keys = ["1"], command = "numbered_command 1" }, + { keys = ["2"], command = "numbered_command 2" }, + { keys = ["3"], command = "numbered_command 3" }, + { keys = ["4"], command = "numbered_command 4" }, + { keys = ["5"], command = "numbered_command 5" }, + { keys = ["6"], command = "numbered_command 6" }, + { keys = ["7"], command = "numbered_command 7" }, + { keys = ["8"], command = "numbered_command 8" }, + { keys = ["9"], command = "numbered_command 9" }, + + # arrow keys + { keys = ["arrow_up"], command = "cursor_move_up" }, + { keys = ["arrow_down"], command = "cursor_move_down" }, + { keys = ["arrow_left"], command = "cd .." }, + { keys = ["arrow_right"], command = "open" }, + { keys = ["\n"], command = "open" }, + { keys = ["home"], command = "cursor_move_home" }, + { keys = ["end"], command = "cursor_move_end" }, + { keys = ["page_up"], command = "cursor_move_page_up" }, + { keys = ["page_down"], command = "cursor_move_page_down" }, + { keys = ["ctrl+u"], command = "cursor_move_page_up 0.5" }, + { keys = ["ctrl+d"], command = "cursor_move_page_down 0.5" }, + + # vim-like keybindings + { keys = ["j"], command = "cursor_move_down" }, + { keys = ["k"], command = "cursor_move_up" }, + { keys = ["h"], command = "cd .." }, + { keys = ["l"], command = "open" }, + { keys = ["g", "g"], command = "cursor_move_home" }, + { keys = ["G"], command = "cursor_move_end" }, + { keys = ["r"], command = "open_with" }, + + { keys = ["H"], command = "cursor_move_page_home" }, + { keys = ["L"], command = "cursor_move_page_middle" }, + { keys = ["M"], command = "cursor_move_page_end" }, + + { keys = ["["], command = "parent_cursor_move_up" }, + { keys = ["]"], command = "parent_cursor_move_down" }, + + { keys = ["c", "d"], command = ":cd " }, + { keys = ["d", "d"], command = "cut_files" }, + { keys = ["y", "y"], command = "copy_files" }, + { keys = ["y", "n"], command = "copy_filename" }, + { keys = ["y", "."], command = "copy_filename_without_extension" }, + { keys = ["y", "p"], command = "copy_filepath" }, + { keys = ["y", "d"], command = "copy_dirpath" }, + + { keys = ["p", "l"], command = "symlink_files --relative=false" }, + { keys = ["p", "L"], command = "symlink_files --relative=true" }, + + { keys = ["delete"], command = "delete_files" }, + { keys = ["d", "D"], command = "delete_files" }, + + { keys = ["p", "p"], command = "paste_files" }, + { keys = ["p", "o"], command = "paste_files --overwrite=true" }, + + { keys = ["a"], command = "rename_append" }, + { keys = ["A"], command = "rename_prepend" }, + + { keys = ["f", "t"], command = ":touch " }, + + { keys = [" "], command = "select --toggle=true" }, + { keys = ["t"], command = "select --all=true --toggle=true" }, + { keys = ["V"], command = "toggle_visual" }, + + { keys = ["w"], command = "show_tasks --exit-key=w" }, + { keys = ["b", "b"], command = "bulk_rename" }, + { keys = ["="], command = "set_mode" }, + + { keys = [":"], command = ":" }, + { keys = [";"], command = ":" }, + + { keys = ["'"], command = ":shell " }, + { keys = ["m", "k"], command = ":mkdir " }, + { keys = ["c", "w"], command = ":rename " }, + + { keys = ["/"], command = ":search " }, + { keys = ["|"], command = ":search_inc " }, + { keys = ["\\"], command = ":search_glob " }, + { keys = ["S"], command = "search_fzf" }, + { keys = ["C"], command = "subdir_fzf" }, + + { keys = ["n"], command = "search_next" }, + { keys = ["N"], command = "search_prev" }, + + { keys = ["s", "r"], command = "sort reverse" }, + { keys = ["s", "l"], command = "sort lexical" }, + { keys = ["s", "m"], command = "sort mtime" }, + { keys = ["s", "n"], command = "sort natural" }, + { keys = ["s", "s"], command = "sort size" }, + { keys = ["s", "e"], command = "sort ext" }, + + { keys = ["m", "s"], command = "linemode size" }, + { keys = ["m", "m"], command = "linemode mtime" }, + { keys = ["m", "M"], command = "linemode sizemtime" }, + + { keys = ["g", "r"], command = "cd /" }, + { keys = ["g", "c"], command = "cd ~/.config" }, + { keys = ["g", "d"], command = "cd ~/Downloads" }, + { keys = ["g", "e"], command = "cd /etc" }, + { keys = ["g", "h"], command = "cd ~/" }, + { keys = ["?"], command = "help" }, + ] + + [task_view] + + keymap = [ + # arrow keys + { keys = ["arrow_up"], command = "cursor_move_up" }, + { keys = ["arrow_down"], command = "cursor_move_down" }, + { keys = ["home"], command = "cursor_move_home" }, + { keys = ["end"], command = "cursor_move_end" }, + + # vim-like keybindings + { keys = ["j"], command = "cursor_move_down" }, + { keys = ["k"], command = "cursor_move_up" }, + { keys = ["g", "g"], command = "cursor_move_home" }, + { keys = ["G"], command = "cursor_move_end" }, + + { keys = ["w"], command = "show_tasks" }, + { keys = ["escape"], command = "show_tasks" }, + ] + + [help_view] + + keymap = [ + # arrow keys + { keys = ["arrow_up"], command = "cursor_move_up" }, + { keys = ["arrow_down"], command = "cursor_move_down" }, + { keys = ["home"], command = "cursor_move_home" }, + { keys = ["end"], command = "cursor_move_end" }, + + # vim-like keybindings + { keys = ["j"], command = "cursor_move_down" }, + { keys = ["k"], command = "cursor_move_up" }, + { keys = ["g", "g"], command = "cursor_move_home" }, + { keys = ["G"], command = "cursor_move_end" }, + + { keys = ["w"], command = "show_tasks" }, + { keys = ["escape"], command = "show_tasks" }, + ] + ''; + + xdg.configFile."joshuto/theme.toml".text = /* toml */ '' + [selection] + fg = "light_yellow" + bold = true + + [visual_mode_selection] + fg = "light_red" + bold = true + + [selection.prefix] + prefix = " " + size = 2 + + [executable] + fg = "light_green" + bold = true + + [regular] + fg = "white" + + [directory] + fg = "light_blue" + bold = true + + [link] + fg = "cyan" + bold = true + + [link_invalid] + fg = "red" + bold = true + + [socket] + fg = "light_magenta" + bold = true + + [ext] + + bmp.fg = "yellow" + gif.fg = "yellow" + heic.fg = "yellow" + jpg.fg = "yellow" + jpeg.fg = "yellow" + pgm.fg = "yellow" + png.fg = "yellow" + ppm.fg = "yellow" + svg.fg = "yellow" + + wav.fg = "magenta" + flac.fg = "magenta" + mp3.fg = "magenta" + amr.fg = "magenta" + + avi.fg = "magenta" + flv.fg = "magenta" + m3u.fg = "magenta" + m4a.fg = "magenta" + m4v.fg = "magenta" + mkv.fg = "magenta" + mov.fg = "magenta" + mp4.fg = "magenta" + mpg.fg = "magenta" + rmvb.fg = "magenta" + webm.fg = "magenta" + wmv.fg = "magenta" + + 7z.fg = "red" + bz2.fg = "red" + gz.fg = "red" + rar.fg = "red" + tar.fg = "red" + tgz.fg = "red" + xz.fg = "red" + zip.fg = "red" + ''; + + xdg.configFile."joshuto/icons.toml".text = /* toml */ '' + # Default fallback icons + [defaults] + file = "" + directory = "" + + # Directory exact match icons + [directory_exact] + # English + ".git" = "" + "Desktop" = "" + "Documents" = "" + "Downloads" = "" + "Dotfiles" = "" + "Dropbox" = "" + "Music" = "" + "Pictures" = "" + "Public" = "" + "Templates" = "" + "Videos" = "" + + # File exact match icons + [file_exact] + ".bash_aliases" = "" + ".bash_history" = "" + ".bash_logout" = "" + ".bash_profile" = "" + ".bashprofile" = "" + ".bashrc" = "" + ".dmrc" = "" + ".DS_Store" = "" + ".fasd" = "" + ".fehbg" = "" + ".gitattributes" = "" + ".gitconfig" = "" + ".gitignore" = "" + ".gitlab-ci.yml" = "" + ".gvimrc" = "" + ".inputrc" = "" + ".jack-settings" = "" + ".mime.types" = "" + ".ncmpcpp" = "" + ".nvidia-settings-rc" = "" + ".pam_environment" = "" + ".profile" = "" + ".recently-used" = "" + ".selected_editor" = "" + ".vim" = "" + ".viminfo" = "" + ".vimrc" = "" + ".Xauthority" = "" + ".Xdefaults" = "" + ".xinitrc" = "" + ".xinputrc" = "" + ".Xresources" = "" + ".zshrc" = "" + "_gvimrc" = "" + "_vimrc" = "" + "a.out" = "" + "authorized_keys" = "" + "bspwmrc" = "" + "cmakelists.txt" = "" + "config" = "" + "config.ac" = "" + "config.m4" = "" + "config.mk" = "" + "config.ru" = "" + "configure" = "" + "docker-compose.yml" = "" + "dockerfile" = "" + "Dockerfile" = "" + "dropbox" = "" + "exact-match-case-sensitive-1.txt" = "X1" + "exact-match-case-sensitive-2" = "X2" + "favicon.ico" = "" + "gemfile" = "" + "gruntfile.coffee" = "" + "gruntfile.js" = "" + "gruntfile.ls" = "" + "gulpfile.coffee" = "" + "gulpfile.js" = "" + "gulpfile.ls" = "" + "ini" = "" + "known_hosts" = "" + "ledger" = "" + "license" = "" + "LICENSE" = "" + "LICENSE.md" = "" + "LICENSE.txt" = "" + "Makefile" = "" + "makefile" = "" + "Makefile.ac" = "" + "Makefile.in" = "" + "mimeapps.list" = "" + "mix.lock" = "" + "node_modules" = "" + "package-lock.json" = "" + "package.json" = "" + "playlists" = "" + "procfile" = "" + "Rakefile" = "" + "rakefile" = "" + "react.jsx" = "" + "README" = "" + "README.markdown" = "" + "README.md" = "" + "README.rst" = "" + "README.txt" = "" + "sxhkdrc" = "" + "user-dirs.dirs" = "" + "webpack.config.js" = "" + + # File extension match + [ext] + "7z" = "" + "a" = "" + "ai" = "" + "apk" = "" + "asm" = "" + "asp" = "" + "aup" = "" + "avi" = "" + "awk" = "" + "bash" = "" + "bat" = "" + "bmp" = "" + "bz2" = "" + "c" = "" + "c++" = "" + "cab" = "" + "cbr" = "" + "cbz" = "" + "cc" = "" + "class" = "" + "clj" = "" + "cljc" = "" + "cljs" = "" + "cmake" = "" + "coffee" = "" + "conf" = "" + "cp" = "" + "cpio" = "" + "cpp" = "" + "cs" = "" + "csh" = "" + "css" = "" + "cue" = "" + "cvs" = "" + "cxx" = "" + "d" = "" + "dart" = "" + "db" = "" + "deb" = "" + "diff" = "" + "dll" = "" + "doc" = "" + "docx" = "" + "dump" = "" + "edn" = "" + "eex" = "" + "efi" = "" + "ejs" = "" + "elf" = "" + "elm" = "" + "epub" = "" + "erl" = "" + "ex" = "" + "exe" = "" + "exs" = "" + "f//" = "" + "fifo" = "|" + "fish" = "" + "flac" = "" + "flv" = "" + "fs" = "" + "fsi" = "" + "fsscript" = "" + "fsx" = "" + "gem" = "" + "gemspec" = "" + "gif" = "" + "go" = "" + "gz" = "" + "gzip" = "" + "h" = "" + "haml" = "" + "hbs" = "" + "hh" = "" + "hpp" = "" + "hrl" = "" + "hs" = "" + "htaccess" = "" + "htm" = "" + "html" = "" + "htpasswd" = "" + "hxx" = "" + "ico" = "" + "img" = "" + "ini" = "" + "iso" = "" + "jar" = "" + "java" = "" + "jl" = "" + "jpeg" = "" + "jpg" = "" + "js" = "" + "json" = "" + "jsx" = "" + "key" = "" + "ksh" = "" + "leex" = "" + "less" = "" + "lha" = "" + "lhs" = "" + "log" = "" + "lua" = "" + "lzh" = "" + "lzma" = "" + "m4a" = "" + "m4v" = "" + "markdown" = "" + "md" = "" + "mdx" = "" + "mjs" = "" + "mkv" = "" + "ml" = "λ" + "mli" = "λ" + "mov" = "" + "mp3" = "" + "mp4" = "" + "mpeg" = "" + "mpg" = "" + "msi" = "" + "mustache" = "" + "nix" = "" + "o" = "" + "ogg" = "" + "pdf" = "" + "php" = "" + "pl" = "" + "pm" = "" + "png" = "" + "pp" = "" + "ppt" = "" + "pptx" = "" + "ps1" = "" + "psb" = "" + "psd" = "" + "pub" = "" + "py" = "" + "pyc" = "" + "pyd" = "" + "pyo" = "" + "r" = "ﳒ" + "rake" = "" + "rar" = "" + "rb" = "" + "rc" = "" + "rlib" = "" + "rmd" = "" + "rom" = "" + "rpm" = "" + "rproj" = "鉶" + "rs" = "" + "rss" = "" + "rtf" = "" + "s" = "" + "sass" = "" + "scala" = "" + "scss" = "" + "sh" = "" + "slim" = "" + "sln" = "" + "so" = "" + "sql" = "" + "styl" = "" + "suo" = "" + "swift" = "" + "t" = "" + "tar" = "" + "tex" = "ﭨ" + "tgz" = "" + "toml" = "" + "ts" = "" + "tsx" = "" + "twig" = "" + "vim" = "" + "vimrc" = "" + "vue" = "﵂" + "wav" = "" + "webm" = "" + "webmanifest" = "" + "webp" = "" + "xbps" = "" + "xcplayground" = "" + "xhtml" = "" + "xls" = "" + "xlsx" = "" + "xml" = "" + "xul" = "" + "xz" = "" + "yaml" = "" + "yml" = "" + "zip" = "" + "zsh" = "" + ''; } diff --git a/modules/neovim/default.nix b/modules/neovim/default.nix index ed991b5d..136ab7f9 100644 --- a/modules/neovim/default.nix +++ b/modules/neovim/default.nix @@ -12,331 +12,324 @@ let }; in { - programs.neovim.enable = true; - programs.npm.enable = true; + programs.bat.enable = true; - home-manager.sharedModules = [ - { - programs.bat.enable = true; - - home.packages = with pkgs; [ - go - gopls - nil - alejandra - nixpkgs-fmt - nixfmt - nodejs - yarn - deno - gcc - rustc - rustfmt - cargo - rust-analyzer - bacon - marksman - lua-language-server - clang-tools - texlab - ]; - - editorconfig = { - enable = true; - - settings = { - "*" = { - charset = "utf-8"; - end_of_line = "lf"; - insert_final_newline = true; - indent_size = 2; - indent_style = "space"; - trim_trailing_whitespace = true; - }; - - "*.md".indent_style = "tab"; - - "Makefile" = { - indent_style = "tab"; - indent_size = 4; - }; - - "*.html" = { - indent_style = "tab"; - indent_size = 4; - }; - - "*.go" = { - indent_style = "tab"; - indent_size = 4; - }; - - "*.rs" = { - indent_style = "space"; - indent_size = 4; - }; - }; - }; - - programs.neovim = { - enable = true; - extraConfig = /* vim */ '' - filetype plugin indent on - set undofile - set spell - set number - set linebreak - set clipboard=unnamedplus - set fileencoding=utf-8 " Ensure that we always save files as utf-8 - set fileencodings=utf-8,sjis " Automatically open shiftjis files with their proper encoding - set spelllang=en_us,cjk " Don't show errors for CJK characters - set noshowmode " Disable the --MODE-- text (enable if not using the status line) - set mouse=a - set ignorecase " By default use case-insensitive search (combine with smartcase) - set smartcase " Make search case-sensitive when using capital letters - set scrolloff=1 " The minimal number of rows to show when scrolling up/down - set sidescrolloff=5 " The minimal number of columns to show when scrolling left/right - set tabstop=4 " Show a tab character as 4 spaces - set softtabstop=0 " Edit soft tabs as if they're regular spaces - set shiftwidth=4 " Make autoindent appear as 4 spaces - - set foldmethod=indent - set foldlevelstart=99 - - map - imap - map <2-MiddleMouse> - imap <2-MiddleMouse> - map <3-MiddleMouse> - imap <3-MiddleMouse> - map <4-MiddleMouse> - imap <4-MiddleMouse> - - highlight Search ctermbg=240 ctermfg=255 - highlight IncSearch ctermbg=255 ctermfg=240 - - let mapleader = ' ' - nnoremap e :set nu! - nnoremap t :OverCommandLine%s/ - nnoremap a w - nnoremap s :Alpha - nnoremap d :Bdelete - nnoremap f :Files - nnoremap g :set hlsearch! - nnoremap j :Buffers - nnoremap l :Rg - nnoremap ; :NvimTreeToggle - vnoremap y:silent !notify-send -t 4000 "成果" "$(tango '0')": - - autocmd BufNewFile,BufRead *.ecr setlocal syntax=html - autocmd BufWritePre,FileWritePre * silent! call mkdir(expand(':p:h'), 'p') - autocmd VimEnter * silent! :cd `git rev-parse --show-toplevel` - - tnoremap - ''; - plugins = with pkgs.vimPlugins; [ - { - plugin = nvim-tree-lua; - type = "lua"; - config = /* lua */ '' - require("nvim-tree").setup() - - vim.api.nvim_create_autocmd({"QuitPre"}, { - callback = function() vim.cmd("NvimTreeClose") end - }) - - local function open_nvim_tree(data) - local real_file = vim.fn.filereadable(data.file) == 1 - local no_name = data.file == "" and vim.bo[data.buf].buftype == "" - - if not real_file and not no_name then - return - end - - require("nvim-tree.api").tree.toggle({ focus = false, find_file = true }) - end - - vim.api.nvim_create_autocmd({ "VimEnter" }, { callback = open_nvim_tree }) - ''; - } - { - plugin = indent-blankline-nvim; - type = "lua"; - config = /* lua */ '' - require("indent_blankline").setup() - ''; - } - { - plugin = gitsigns-nvim; - type = "lua"; - config = /* lua */ '' - require('gitsigns').setup() - ''; - } - { - plugin = nvim-web-devicons; - type = "lua"; - } - { - plugin = nvim-scrollbar; - type = "lua"; - config = /* lua */ ''require("scrollbar").setup()''; - } - { - plugin = nvim-lspconfig; - type = "lua"; - config = /* lua */ '' - local lspconfig = require('lspconfig') - lspconfig.nil_ls.setup {} - lspconfig.rust_analyzer.setup {} - lspconfig.marksman.setup {} - lspconfig.gopls.setup {} - lspconfig.lua_ls.setup {} - lspconfig.clangd.setup {} - lspconfig.texlab.setup {} - lspconfig.crystalline.setup {} - vim.keymap.set('n', 'e', vim.diagnostic.open_float) - vim.keymap.set('n', '[d', vim.diagnostic.goto_prev) - vim.keymap.set('n', ']d', vim.diagnostic.goto_next) - vim.keymap.set('n', 'q', vim.diagnostic.setloclist) - vim.api.nvim_create_autocmd('LspAttach', { - group = vim.api.nvim_create_augroup('UserLspConfig', {}), - callback = function(ev) - local opts = { buffer = ev.buf } - vim.keymap.set('n', 'gD', vim.lsp.buf.declaration, opts) - vim.keymap.set('n', 'gd', vim.lsp.buf.definition, opts) - vim.keymap.set('n', 'K', vim.lsp.buf.hover, opts) - vim.keymap.set('n', 'gi', vim.lsp.buf.implementation, opts) - vim.keymap.set('n', '', vim.lsp.buf.signature_help, opts) - vim.keymap.set('n', 'D', vim.lsp.buf.type_definition, opts) - vim.keymap.set('n', 'rn', vim.lsp.buf.rename, opts) - vim.keymap.set({ 'n', 'v' }, 'ca', vim.lsp.buf.code_action, opts) - vim.keymap.set('n', 'gr', vim.lsp.buf.references, opts) - end, - }) - ''; - } - { - plugin = nvim-base16; - type = "lua"; - config = "vim.cmd('colorscheme base16-monokai')"; - } - { - plugin = lualine-nvim; - type = "lua"; - config = /* lua */ '' - local theme = require("lualine.themes.base16") - theme.normal.b.bg = nil - theme.normal.c.bg = nil - theme.replace.b.bg = nil - theme.insert.b.bg = nil - theme.visual.b.bg = nil - theme.inactive.a.bg = nil - theme.inactive.b.bg = nil - theme.inactive.c.bg = nil - - require('lualine').setup { - options = { theme = theme }, - sections = { lualine_c = {'%f'} } - } - ''; - } - { - plugin = git-blame-nvim; - type = "lua"; - } - { - plugin = comment-nvim; - type = "lua"; - config = ''require('Comment').setup()''; - } - { - plugin = plenary-nvim; - type = "lua"; - } - { - plugin = auto-save-nvim; - type = "lua"; - config = ''require("auto-save").setup()''; - } - { - plugin = toggleterm-nvim; - type = "lua"; - config = /* lua */ '' - require("toggleterm").setup { - shade_terminals = false - } - ''; - } - { - plugin = vimtex; - config = /* vim */ '' - " Disable all keybinds so we can define our own - let g:vimtex_mappings_enabled = 0 - let g:vimtex_imaps_enabled = 0 - let g:vimtex_view_method = 'zathura' - let g:vimtex_compiler_latexmk = {'build_dir': '.tex'} - - " Set the normal keybinds - nnoremap f (vimtex-view) - nnoremap g (vimtex-compile) - nnoremap d (vimtex-env-delete) - nnoremap c (vimtex-env-change) - ''; - } - { - plugin = alpha-nvim; - type = "lua"; - config = /* lua */ '' - local startify = require('alpha.themes.startify') - - startify.section.header.val = vim.fn.system("${pkgs.fish}/bin/fish -c 'cat (random choice (${pkgs.fd}/bin/fd . ${pkgs.ponysay}/share/ponysay/quotes --ignore-file ~/.config/fd/ponyignore)) | head -n 1'") - - startify.section.top_buttons.val = { - startify.button("e", "新しいファイル", "ene ") - } - - startify.section.mru.val = { { type = "padding", val = 0 } } - startify.section.mru_cwd.val = { - { type = "padding", val = 1 }, - { type = "text", val = "歴史", opts = { hl = "SpecialComment", shrink_margin = false } }, - { type = "padding", val = 1 }, - { - type = "group", - val = function() - return { startify.mru(0, vim.fn.getcwd()) } - end, - opts = { shrink_margin = false }, - } - } - - require('alpha').setup(startify.config) - ''; - } - fzf-vim - vim-caddyfile - vim-graphql - vim-pug - vim-prisma - vim-javascript - vim-jsx-pretty - vim-vue - vim-over - vim-endwise - csv-vim - rust-vim - neoformat - bufdelete-nvim - vim-crystal - vim-nix-rummik - fcitx-vim - ]; - }; - - xdg.configFile."fd/ponyignore".text = '' - snowflake+horsepower+bulkbiceps.1 - snowflake+horsepower+bulkbiceps.2 - ''; - } + home.packages = with pkgs; [ + go + gopls + nil + alejandra + nixpkgs-fmt + nixfmt + nodejs + yarn + deno + gcc + rustc + rustfmt + cargo + rust-analyzer + bacon + marksman + lua-language-server + clang-tools + texlab ]; + + editorconfig = { + enable = true; + + settings = { + "*" = { + charset = "utf-8"; + end_of_line = "lf"; + insert_final_newline = true; + indent_size = 2; + indent_style = "space"; + trim_trailing_whitespace = true; + }; + + "*.md".indent_style = "tab"; + + "Makefile" = { + indent_style = "tab"; + indent_size = 4; + }; + + "*.html" = { + indent_style = "tab"; + indent_size = 4; + }; + + "*.go" = { + indent_style = "tab"; + indent_size = 4; + }; + + "*.rs" = { + indent_style = "space"; + indent_size = 4; + }; + }; + }; + + programs.neovim = { + enable = true; + extraConfig = /* vim */ '' + filetype plugin indent on + set undofile + set spell + set number + set linebreak + set clipboard=unnamedplus + set fileencoding=utf-8 " Ensure that we always save files as utf-8 + set fileencodings=utf-8,sjis " Automatically open shiftjis files with their proper encoding + set spelllang=en_us,cjk " Don't show errors for CJK characters + set noshowmode " Disable the --MODE-- text (enable if not using the status line) + set mouse=a + set ignorecase " By default use case-insensitive search (combine with smartcase) + set smartcase " Make search case-sensitive when using capital letters + set scrolloff=1 " The minimal number of rows to show when scrolling up/down + set sidescrolloff=5 " The minimal number of columns to show when scrolling left/right + set tabstop=4 " Show a tab character as 4 spaces + set softtabstop=0 " Edit soft tabs as if they're regular spaces + set shiftwidth=4 " Make autoindent appear as 4 spaces + + set foldmethod=indent + set foldlevelstart=99 + + map + imap + map <2-MiddleMouse> + imap <2-MiddleMouse> + map <3-MiddleMouse> + imap <3-MiddleMouse> + map <4-MiddleMouse> + imap <4-MiddleMouse> + + highlight Search ctermbg=240 ctermfg=255 + highlight IncSearch ctermbg=255 ctermfg=240 + + let mapleader = ' ' + nnoremap e :set nu! + nnoremap t :OverCommandLine%s/ + nnoremap a w + nnoremap s :Alpha + nnoremap d :Bdelete + nnoremap f :Files + nnoremap g :set hlsearch! + nnoremap j :Buffers + nnoremap l :Rg + nnoremap ; :NvimTreeToggle + vnoremap y:silent !notify-send -t 4000 "成果" "$(tango '0')": + + autocmd BufNewFile,BufRead *.ecr setlocal syntax=html + autocmd BufWritePre,FileWritePre * silent! call mkdir(expand(':p:h'), 'p') + autocmd VimEnter * silent! :cd `git rev-parse --show-toplevel` + + tnoremap + ''; + plugins = with pkgs.vimPlugins; [ + { + plugin = nvim-tree-lua; + type = "lua"; + config = /* lua */ '' + require("nvim-tree").setup() + + vim.api.nvim_create_autocmd({"QuitPre"}, { + callback = function() vim.cmd("NvimTreeClose") end + }) + + local function open_nvim_tree(data) + local real_file = vim.fn.filereadable(data.file) == 1 + local no_name = data.file == "" and vim.bo[data.buf].buftype == "" + + if not real_file and not no_name then + return + end + + require("nvim-tree.api").tree.toggle({ focus = false, find_file = true }) + end + + vim.api.nvim_create_autocmd({ "VimEnter" }, { callback = open_nvim_tree }) + ''; + } + { + plugin = indent-blankline-nvim; + type = "lua"; + config = /* lua */ '' + require("indent_blankline").setup() + ''; + } + { + plugin = gitsigns-nvim; + type = "lua"; + config = /* lua */ '' + require('gitsigns').setup() + ''; + } + { + plugin = nvim-web-devicons; + type = "lua"; + } + { + plugin = nvim-scrollbar; + type = "lua"; + config = /* lua */ ''require("scrollbar").setup()''; + } + { + plugin = nvim-lspconfig; + type = "lua"; + config = /* lua */ '' + local lspconfig = require('lspconfig') + lspconfig.nil_ls.setup {} + lspconfig.rust_analyzer.setup {} + lspconfig.marksman.setup {} + lspconfig.gopls.setup {} + lspconfig.lua_ls.setup {} + lspconfig.clangd.setup {} + lspconfig.texlab.setup {} + lspconfig.crystalline.setup {} + vim.keymap.set('n', 'e', vim.diagnostic.open_float) + vim.keymap.set('n', '[d', vim.diagnostic.goto_prev) + vim.keymap.set('n', ']d', vim.diagnostic.goto_next) + vim.keymap.set('n', 'q', vim.diagnostic.setloclist) + vim.api.nvim_create_autocmd('LspAttach', { + group = vim.api.nvim_create_augroup('UserLspConfig', {}), + callback = function(ev) + local opts = { buffer = ev.buf } + vim.keymap.set('n', 'gD', vim.lsp.buf.declaration, opts) + vim.keymap.set('n', 'gd', vim.lsp.buf.definition, opts) + vim.keymap.set('n', 'K', vim.lsp.buf.hover, opts) + vim.keymap.set('n', 'gi', vim.lsp.buf.implementation, opts) + vim.keymap.set('n', '', vim.lsp.buf.signature_help, opts) + vim.keymap.set('n', 'D', vim.lsp.buf.type_definition, opts) + vim.keymap.set('n', 'rn', vim.lsp.buf.rename, opts) + vim.keymap.set({ 'n', 'v' }, 'ca', vim.lsp.buf.code_action, opts) + vim.keymap.set('n', 'gr', vim.lsp.buf.references, opts) + end, + }) + ''; + } + { + plugin = nvim-base16; + type = "lua"; + config = "vim.cmd('colorscheme base16-monokai')"; + } + { + plugin = lualine-nvim; + type = "lua"; + config = /* lua */ '' + local theme = require("lualine.themes.base16") + theme.normal.b.bg = nil + theme.normal.c.bg = nil + theme.replace.b.bg = nil + theme.insert.b.bg = nil + theme.visual.b.bg = nil + theme.inactive.a.bg = nil + theme.inactive.b.bg = nil + theme.inactive.c.bg = nil + + require('lualine').setup { + options = { theme = theme }, + sections = { lualine_c = {'%f'} } + } + ''; + } + { + plugin = git-blame-nvim; + type = "lua"; + } + { + plugin = comment-nvim; + type = "lua"; + config = ''require('Comment').setup()''; + } + { + plugin = plenary-nvim; + type = "lua"; + } + { + plugin = auto-save-nvim; + type = "lua"; + config = ''require("auto-save").setup()''; + } + { + plugin = toggleterm-nvim; + type = "lua"; + config = /* lua */ '' + require("toggleterm").setup { + shade_terminals = false + } + ''; + } + { + plugin = vimtex; + config = /* vim */ '' + " Disable all keybinds so we can define our own + let g:vimtex_mappings_enabled = 0 + let g:vimtex_imaps_enabled = 0 + let g:vimtex_view_method = 'zathura' + let g:vimtex_compiler_latexmk = {'build_dir': '.tex'} + + " Set the normal keybinds + nnoremap f (vimtex-view) + nnoremap g (vimtex-compile) + nnoremap d (vimtex-env-delete) + nnoremap c (vimtex-env-change) + ''; + } + { + plugin = alpha-nvim; + type = "lua"; + config = /* lua */ '' + local startify = require('alpha.themes.startify') + + startify.section.header.val = vim.fn.system("${pkgs.fish}/bin/fish -c 'cat (random choice (${pkgs.fd}/bin/fd . ${pkgs.ponysay}/share/ponysay/quotes --ignore-file ~/.config/fd/ponyignore)) | head -n 1'") + + startify.section.top_buttons.val = { + startify.button("e", "新しいファイル", "ene ") + } + + startify.section.mru.val = { { type = "padding", val = 0 } } + startify.section.mru_cwd.val = { + { type = "padding", val = 1 }, + { type = "text", val = "歴史", opts = { hl = "SpecialComment", shrink_margin = false } }, + { type = "padding", val = 1 }, + { + type = "group", + val = function() + return { startify.mru(0, vim.fn.getcwd()) } + end, + opts = { shrink_margin = false }, + } + } + + require('alpha').setup(startify.config) + ''; + } + fzf-vim + vim-caddyfile + vim-graphql + vim-pug + vim-prisma + vim-javascript + vim-jsx-pretty + vim-vue + vim-over + vim-endwise + csv-vim + rust-vim + neoformat + bufdelete-nvim + vim-crystal + vim-nix-rummik + fcitx-vim + ]; + }; + + xdg.configFile."fd/ponyignore".text = '' + snowflake+horsepower+bulkbiceps.1 + snowflake+horsepower+bulkbiceps.2 + ''; } diff --git a/modules/waycorner/default.nix b/modules/waycorner/default.nix index 05480769..0e502d75 100644 --- a/modules/waycorner/default.nix +++ b/modules/waycorner/default.nix @@ -1,25 +1,19 @@ { pkgs, ... }: { - environment.systemPackages = with pkgs; [ - waycorner - ]; + home.packages = with pkgs; [ waycorner ]; - home-manager.sharedModules = [ - { - xdg.configFile."waycorner/config.toml".text = /* toml */ '' - [application_launcher] - enter_command = [ "hyprctl", "dispatch", "workspace", "empty" ] - exit_command = [ "${pkgs.lnch}/bin/lnch", "${pkgs.rofi}/bin/rofi", "-show", "drun" ] - locations = ["top_right"] # default - size = 10 - timeout_ms = 250 + xdg.configFile."waycorner/config.toml".text = /* toml */ '' + [application_launcher] + enter_command = [ "hyprctl", "dispatch", "workspace", "empty" ] + exit_command = [ "${pkgs.lnch}/bin/lnch", "${pkgs.rofi}/bin/rofi", "-show", "drun" ] + locations = ["top_right"] # default + size = 10 + timeout_ms = 250 - [show_desktop] - enter_command = [ "hyprctl", "dispatch", "workspace", "empty" ] - exit_command = [ "hyprctl", "dispatch", "workspace", "previous"] - locations = ["bottom_right"] # default - size = 10 - timeout_ms = 250 - ''; - } - ]; + [show_desktop] + enter_command = [ "hyprctl", "dispatch", "workspace", "empty" ] + exit_command = [ "hyprctl", "dispatch", "workspace", "previous"] + locations = ["bottom_right"] # default + size = 10 + timeout_ms = 250 + ''; } diff --git a/modules/xdg-user-dirs/default.nix b/modules/xdg-user-dirs/default.nix index b22691a2..86479ca8 100644 --- a/modules/xdg-user-dirs/default.nix +++ b/modules/xdg-user-dirs/default.nix @@ -1,21 +1,17 @@ let VARIABLES = import ../../src/variables.nix; in { - home-manager.sharedModules = [ - { - xdg.userDirs = { - enable = true; + xdg.userDirs = { + enable = true; - desktop = null; - templates = null; - publicShare = null; + desktop = null; + templates = null; + publicShare = null; - download = "/home/${VARIABLES.username}/ダウンロード"; - documents = "/home/${VARIABLES.username}/ドキュメント"; - music = "/home/${VARIABLES.username}/音楽"; - pictures = "/home/${VARIABLES.username}/画像"; - videos = "/home/${VARIABLES.username}/ビデオ"; - }; + download = "/home/${VARIABLES.username}/ダウンロード"; + documents = "/home/${VARIABLES.username}/ドキュメント"; + music = "/home/${VARIABLES.username}/音楽"; + pictures = "/home/${VARIABLES.username}/画像"; + videos = "/home/${VARIABLES.username}/ビデオ"; + }; - xdg.configFile."user-dirs.locale".text = "ja_JP"; - } - ]; + xdg.configFile."user-dirs.locale".text = "ja_JP"; } diff --git a/src/main.nix b/src/main.nix index b812984a..17f28731 100644 --- a/src/main.nix +++ b/src/main.nix @@ -46,6 +46,9 @@ let VARIABLES = import ./variables.nix; in { boot.tmp.useTmpfs = true; + programs.neovim.enable = true; + programs.npm.enable = true; + programs.gamemode = { enable = true; settings = {