diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..3b178a8 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,47 @@ +FROM registry.fedoraproject.org/fedora:37 + +COPY . /root/.config/nvim + +# install system dependencies +RUN dnf install -y \ + wget \ + unzip \ + git \ + python3-pip \ + neovim \ + ripgrep \ + fd-find \ + npm \ + tree-sitter-cli \ + wl-clipboard \ + clang \ + && \ + dnf clean all && \ + pip install pynvim + +# install lsp and liners using mason +RUN nvim --headless +"MasonInstall \ + bash-language-server \ + css-lsp \ + cssmodules-language-server \ + dockerfile-language-server \ + eslint-lsp \ + html-lsp \ + intelephense \ + json-lsp \ + lemminx \ + lua-language-server \ + marksman \ + perlnavigator \ + phpcs \ + phpstan \ + pyright \ + python-lsp-server \ + ruff-lsp \ + sqlls \ + typescript-language-server \ + yaml-language-server \ + markdownlint" \ + +qa || true + +ENTRYPOINT [ "/usr/bin/nvim" ] diff --git a/README.md b/README.md index cf87883..4b2b4b8 100644 --- a/README.md +++ b/README.md @@ -9,52 +9,90 @@ Those repos are obviously listed in plugin setup part. # Basic usage of this config -### First Time Setup +
Tested only with rootless podman, docker might require additional setup, or proper in-container user setup
-Installing system stuff (Fedora example): +### Host system Setup + +Installing host system stuff, currently just fonts (Fedora example): ```bash -sudo dnf install \ - git \ - python3-pip \ - neovim \ - ripgrep \ - fd-find \ - npm \ - tree-sitter-cli \ - wl-clipboard \ +sudo dnf install -y \ dejavu-fonts-all \ - gnu-free-mono-fonts \ - clang \ - perl-App-cpanminus # optional, allow perlnavigator lsp working properly - -pip install pynvim - -git clone https://github.com/Szwendacz99/nvim ~/.config/nvim + gnu-free-mono-fonts ``` -##### +##### Image management: +build: + +```bash +git clone https://github.com/Szwendacz99/nvim && \ +podman build -t neovim ./nvim +``` + +pack to file with high compression: + +```bash +podman save localhost/neovim:latest -o /dev/stdout | xz -z -9 -e -c > neovim.tar.xz +``` + +import file back to local registry: + +```bash +podman load -i ./neovim.tar.xz +``` + +##### Image usage examples + + +basic startup for editing current folder: + +```bash +podman run --privileged -it --rm \ + -e XDG_RUNTIME_DIR=/runtime_dir \ + -e WAYLAND_DISPLAY=$WAYLAND_DISPLAY \ + -v $XDG_RUNTIME_DIR/$WAYLAND_DISPLAY:/runtime_dir/$WAYLAND_DISPLAY \ + --workdir /data \ + -v "./:/data:rw" \ + neovim:latest +``` + +function to run neovim container easily, +allowing passing parameters and mounting files: + +```bash +function nvim() { + if [ $1 ] && [ -f $1 ]; then + MOUNT_FILE="-v "$1:$1""; + echo "mounting file $1"; + else + MOUNT_FOLDER="--workdir /data -v ./:/data:rw" + fi + podman run --privileged -it --rm \ + -e XDG_RUNTIME_DIR=/runtime_dir \ + -e WAYLAND_DISPLAY=$WAYLAND_DISPLAY \ + -v $XDG_RUNTIME_DIR/$WAYLAND_DISPLAY:/runtime_dir/$WAYLAND_DISPLAY \ + $MOUNT_FILE \ + $MOUNT_FOLDER \ + neovim:latest "$@" +} +``` ##### Inside vim ``` # manage plugins: :Lazy - -# installing packages, which mason-lspconfig cannot autoinstall (?) -:MasonInstall phpcs - ``` -On Fedora there is need to make sure your system can display any unicode character. Hacked fonts are needed for filetype icons but there is also need for a dedicated package with unicode fonts (like unifont-fonts.noarch) that will have every character missing from default font used in Neovim editor. Link to hacked fonts: +There is need to make sure your system can display (almost) any unicode character. Hacked fonts may be needed for filetype icons but there is also need for a dedicated package with unicode fonts (like unifont-fonts.noarch) that will have every character missing from default font used in Neovim editor. Link to hacked fonts: [https://www.nerdfonts.com/font-downloads](https://www.nerdfonts.com/font-downloads) #### General info ##### Mason: -Mason installs stuff in `.local/share/nvim/mason/packages` so they are independent from system stuff, like pip installed python packages. +Mason installs stuff in `.local/share/nvim/mason/packages` so they are independent from system stuff, like pip installed python packages. All that is saved in image, so that is why image is so heavy. ### Usage diff --git a/lua/plugins/mason-lspconfig.lua b/lua/plugins/mason-lspconfig.lua index 931c99d..db7df5e 100644 --- a/lua/plugins/mason-lspconfig.lua +++ b/lua/plugins/mason-lspconfig.lua @@ -1,26 +1,26 @@ return { config = { - ensure_installed = { - "bashls", - "pyright", - "pylsp", - "ruff_lsp", - --"pyre", - "perlnavigator", - "dockerls", - "intelephense", - "eslint", - "tsserver", - "cssls", - "cssmodules_ls", - "jsonls", - "lua_ls", - "sqlls", - "yamlls", - "lemminx", - "marksman", - "html", - }, + --ensure_installed = { + --"bashls", + --"pyright", + --"pylsp", + --"ruff_lsp", + ----"pyre", + --"perlnavigator", + --"dockerls", + --"intelephense", + --"eslint", + --"tsserver", + --"cssls", + --"cssmodules_ls", + --"jsonls", + --"lua_ls", + --"sqlls", + --"yamlls", + --"lemminx", + --"marksman", + --"html", + --}, -- Whether servers that are set up (via lspconfig) should be automatically installed if they're not already installed. -- This setting has no relation with the `ensure_installed` setting. -- Can either be: diff --git a/lua/plugins/treesitter.lua b/lua/plugins/treesitter.lua index 023e20e..f221e06 100644 --- a/lua/plugins/treesitter.lua +++ b/lua/plugins/treesitter.lua @@ -1,7 +1,7 @@ return function() require 'nvim-treesitter.configs'.setup { -- A list of parser names, or "all" - ensure_installed = { "html", "dockerfile", "cpp", "css", "markdown", "c", "gitcommit", "bash", "phpdoc", "comment", "python", "http", "php", "regex", "json5", "lua", "gitattributes", "gitignore", "json", "git_rebase", "javascript", "perl", "sql", "yaml" }, + --ensure_installed = { "html", "dockerfile", "cpp", "css", "markdown", "c", "gitcommit", "bash", "phpdoc", "comment", "python", "http", "php", "regex", "json5", "lua", "gitattributes", "gitignore", "json", "git_rebase", "javascript", "perl", "sql", "yaml" }, -- Install parsers synchronously (only applied to `ensure_installed`) sync_install = false,