migrate my config to container form
This commit is contained in:
parent
81c6df2323
commit
95bb972fee
4 changed files with 132 additions and 47 deletions
47
Dockerfile
Normal file
47
Dockerfile
Normal file
|
@ -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" ]
|
88
README.md
88
README.md
|
@ -9,52 +9,90 @@ Those repos are obviously listed in plugin setup part.
|
||||||
|
|
||||||
# Basic usage of this config
|
# Basic usage of this config
|
||||||
|
|
||||||
### First Time Setup
|
<p class="callout warning">Tested only with rootless podman, docker might require additional setup, or proper in-container user setup</p>
|
||||||
|
|
||||||
Installing system stuff (Fedora example):
|
### Host system Setup
|
||||||
|
|
||||||
|
Installing host system stuff, currently just fonts (Fedora example):
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
sudo dnf install \
|
sudo dnf install -y \
|
||||||
git \
|
|
||||||
python3-pip \
|
|
||||||
neovim \
|
|
||||||
ripgrep \
|
|
||||||
fd-find \
|
|
||||||
npm \
|
|
||||||
tree-sitter-cli \
|
|
||||||
wl-clipboard \
|
|
||||||
dejavu-fonts-all \
|
dejavu-fonts-all \
|
||||||
gnu-free-mono-fonts \
|
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
|
|
||||||
```
|
```
|
||||||
|
|
||||||
#####
|
##### 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
|
##### Inside vim
|
||||||
|
|
||||||
```
|
```
|
||||||
# manage plugins:
|
# manage plugins:
|
||||||
:Lazy
|
: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)
|
[https://www.nerdfonts.com/font-downloads](https://www.nerdfonts.com/font-downloads)
|
||||||
|
|
||||||
#### General info
|
#### General info
|
||||||
|
|
||||||
##### Mason:
|
##### 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
|
### Usage
|
||||||
|
|
||||||
|
|
|
@ -1,26 +1,26 @@
|
||||||
return {
|
return {
|
||||||
config = {
|
config = {
|
||||||
ensure_installed = {
|
--ensure_installed = {
|
||||||
"bashls",
|
--"bashls",
|
||||||
"pyright",
|
--"pyright",
|
||||||
"pylsp",
|
--"pylsp",
|
||||||
"ruff_lsp",
|
--"ruff_lsp",
|
||||||
--"pyre",
|
----"pyre",
|
||||||
"perlnavigator",
|
--"perlnavigator",
|
||||||
"dockerls",
|
--"dockerls",
|
||||||
"intelephense",
|
--"intelephense",
|
||||||
"eslint",
|
--"eslint",
|
||||||
"tsserver",
|
--"tsserver",
|
||||||
"cssls",
|
--"cssls",
|
||||||
"cssmodules_ls",
|
--"cssmodules_ls",
|
||||||
"jsonls",
|
--"jsonls",
|
||||||
"lua_ls",
|
--"lua_ls",
|
||||||
"sqlls",
|
--"sqlls",
|
||||||
"yamlls",
|
--"yamlls",
|
||||||
"lemminx",
|
--"lemminx",
|
||||||
"marksman",
|
--"marksman",
|
||||||
"html",
|
--"html",
|
||||||
},
|
--},
|
||||||
-- Whether servers that are set up (via lspconfig) should be automatically installed if they're not already installed.
|
-- 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.
|
-- This setting has no relation with the `ensure_installed` setting.
|
||||||
-- Can either be:
|
-- Can either be:
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
return function()
|
return function()
|
||||||
require 'nvim-treesitter.configs'.setup {
|
require 'nvim-treesitter.configs'.setup {
|
||||||
-- A list of parser names, or "all"
|
-- 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`)
|
-- Install parsers synchronously (only applied to `ensure_installed`)
|
||||||
sync_install = false,
|
sync_install = false,
|
||||||
|
|
Loading…
Reference in a new issue