install.sh, keymaps, settings

This commit is contained in:
Arsen Mirzaev Tatyano-Muradovich 2024-06-08 16:38:50 +07:00
parent 68c1b808d4
commit 6f8ee458c9
4 changed files with 190 additions and 118 deletions

View File

@ -1,14 +1,29 @@
#!/usr/bin/env fish #!/usr/bin/env fish
# need to rewrite in future # Initializing the flags
sudo apt install -y npm python3-venv ruby-dev pkg-config set -l options (fish_opt -s v -l verbose)
python3 -m pip install --upgrade pip set options $options (fish_opt -s f -l force)
fish_add_path ~/.local/bin set options $options (fish_opt -s u -l update)
pip3 install --upgrade pynvim
sudo gem install neovim
# Install NeoVim module for NPM # Reading the flags
sudo npm i -g neovim argparse $options -- $argv
# Initializing the buffer of output
set -l output (if set -q _flag_verbose; echo '/dev/tty'; else; echo '/dev/null'; end)
if set -q _flag_update
begin
# need to rewrite in future (бляяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяя)
sudo apt install -y npm python3.10-venv ruby-dev pkg-config
python3 -m pip install --upgrade pip
fish_add_path ~/.local/bin
pip3 install --upgrade pynvim
sudo gem install neovim
# Install NeoVim module for NPM
sudo npm i -g neovim
end &> $output
end
# Инициализация текста сообщений в зависимости от установленного языка в оболочке # Инициализация текста сообщений в зависимости от установленного языка в оболочке
if test (string match -ri "ru" "$LANG") if test (string match -ri "ru" "$LANG")
@ -59,9 +74,9 @@ if test (string match -ri "ru" "$LANG")
case FONTS case FONTS
set_color yellow; echo -n "[mirzaev/nvim] "; set_color magenta; echo -n "[ДАННЫЕ] "; set_color white; echo "Шрифты для GNOME эмулятора терминала: https://www.nerdfonts.com/font-downloads (моя рекомендация - "(set_color cyan)"FiraCode"(set_color white)")"; set_color yellow; echo -n "[mirzaev/nvim] "; set_color magenta; echo -n "[ДАННЫЕ] "; set_color white; echo "Шрифты для GNOME эмулятора терминала: https://www.nerdfonts.com/font-downloads (моя рекомендация - "(set_color cyan)"FiraCode"(set_color white)")";
case FONT_PATCH case FONT_PATCH
set_color yellow; echo -n "[mirzaev/nvim] "; set_color blue; echo -n "[ЗАДАЧА] "; set_color white; echo "Пропатчить шрифт для иконок ? (\"nvim-tree/nvim-web-devicons\") (y/N) "; set_color yellow; echo -n "[mirzaev/nvim] "; set_color blue; echo -n "[ЗАДАЧА] "; set_color white; echo "Пропатчить шрифт для иконок? (\"nvim-tree/nvim-web-devicons\") (y/N) ";
case FONT_CHOOSE case FONT_CHOOSE
set_color yellow; echo -n "[mirzaev/nvim] "; set_color blue; echo -n "[ЗАДАЧА] "; set_color white; echo "Выбери шрифт (путь) "; set_color yellow; echo -n "[mirzaev/nvim] "; set_color blue; echo -n "[ЗАДАЧА] "; set_color white; echo "Путь до шрифта";
case FONT_PATCHED case FONT_PATCHED
set_color yellow; echo -n "[mirzaev/nvim] "; set_color green; echo -n "[РАБОТА] "; set_color white; echo "Пропатчен шрифт для иконок (\"nvim-tree/nvim-web-devicons\")"; set_color yellow; echo -n "[mirzaev/nvim] "; set_color green; echo -n "[РАБОТА] "; set_color white; echo "Пропатчен шрифт для иконок (\"nvim-tree/nvim-web-devicons\")";
end end
@ -92,9 +107,9 @@ else
case LSP_CSSMODULES_INSTALLED case LSP_CSSMODULES_INSTALLED
set_color yellow; echo -n "[mirzaev/nvim] "; set_color green; echo -n "[WORK] "; set_color white; echo "Install the LSP-server for CSS (formatter) (\"antonk52/cssmodules-language-server\")"; set_color yellow; echo -n "[mirzaev/nvim] "; set_color green; echo -n "[WORK] "; set_color white; echo "Install the LSP-server for CSS (formatter) (\"antonk52/cssmodules-language-server\")";
case LSP_DENO_INSTALL case LSP_DENO_INSTALL
set_color yellow; echo -n "[mirzaev/nvim] "; set_color blue; echo -n "[TASK] "; set_color white; echo "Install the LSP-server for JavaScript и PostScript? (\"denoland/deno\") (y/N) "; set_color yellow; echo -n "[mirzaev/nvim] "; set_color blue; echo -n "[TASK] "; set_color white; echo "Install the LSP-server for JavaScript and PostScript? (\"denoland/deno\") (y/N) ";
case LSP_DENO_INSTALLED case LSP_DENO_INSTALLED
set_color yellow; echo -n "[mirzaev/nvim] "; set_color green; echo -n "[WORK] "; set_color white; echo "Installed the LSP-server for JavaScript и PostScript (\"denoland/deno\")"; set_color yellow; echo -n "[mirzaev/nvim] "; set_color green; echo -n "[WORK] "; set_color white; echo "Installed the LSP-server for JavaScript and PostScript (\"denoland/deno\")";
case LSP_LUA_INSTALL case LSP_LUA_INSTALL
set_color yellow; echo -n "[mirzaev/nvim] "; set_color blue; echo -n "[TASK] "; set_color white; echo "Install the LSP-server for Lua? (\"luals/lua-language-server\") (y/N) "; set_color yellow; echo -n "[mirzaev/nvim] "; set_color blue; echo -n "[TASK] "; set_color white; echo "Install the LSP-server for Lua? (\"luals/lua-language-server\") (y/N) ";
case LSP_LUA_INSTALLED case LSP_LUA_INSTALLED
@ -112,113 +127,141 @@ else
case FONT_INSTALLED case FONT_INSTALLED
set_color yellow; echo -n "[mirzaev/nvim] "; set_color green; echo -n "[WORK] "; set_color white; echo "Installed "(set_color cyan)"FiraCode"(set_color white)" font (select it in your terminal emulator settings)"; set_color yellow; echo -n "[mirzaev/nvim] "; set_color green; echo -n "[WORK] "; set_color white; echo "Installed "(set_color cyan)"FiraCode"(set_color white)" font (select it in your terminal emulator settings)";
case FONTS case FONTS
set_color yellow; echo -n "[mirzaev/nvim] "; set_color magenta; echo -n "[INFO] "; set_color white; echo "Fonts for GNOME terminal emulator: https://www.nerdfonts.com/font-downloads (my recommendation - "(set_color cyan)"FiraCode"(set_color white)")"; set_color yellow; echo -n "[mirzaev/nvim] "; set_color magenta; echo -n "[INFO] "; set_color white; echo "Fonts for GNOME terminal emulator: https://www.nerdfonts.com/font-downloads (my recommendation - "(set_color cyan)"FiraCode"(set_color white)") ";
case FONT_PATCH case FONT_PATCH
set_color yellow; echo -n "[mirzaev/nvim] "; set_color blue; echo -n "[TASK] "; set_color white; echo "Patch your font for icons ? (\"nvim-tree/nvim-web-devicons\") (y/N) "; set_color yellow; echo -n "[mirzaev/nvim] "; set_color blue; echo -n "[TASK] "; set_color white; echo "Patch your font for icons? (\"nvim-tree/nvim-web-devicons\") (y/N) ";
case FONT_CHOOSE case FONT_CHOOSE
set_color yellow; echo -n "[mirzaev/nvim] "; set_color blue; echo -n "[TASK] "; set_color white; echo "Choose a font (path)"; set_color yellow; echo -n "[mirzaev/nvim] "; set_color blue; echo -n "[TASK] "; set_color white; echo "Path to the font";
case FONT_PATCHED case FONT_PATCHED
set_color yellow; echo -n "[mirzaev/nvim] "; set_color green; echo -n "[WORK] "; set_color white; echo "Pathed the font for icons (\"nvim-tree/nvim-web-devicons\")"; set_color yellow; echo -n "[mirzaev/nvim] "; set_color green; echo -n "[WORK] "; set_color white; echo "Pathed the font for icons (\"nvim-tree/nvim-web-devicons\")";
end end
end end
end end
# Installation request if not set -q _flag_force
set RESPONSE (read -n 1 -p "print PACKER_INSTALL") # Installation request
bind -e y set RESPONSE (read -n 1 -p "print PACKER_INSTALL")
bind -e y
end
if test (string match -ri 'y' "$RESPONSE") if set -q _flag_force; or test (string match -ri 'y' "$RESPONSE")
if test -d ~/.local/share/nvim/site/pack/packer/start/packer.nvim if test -d ~/.local/share/nvim/site/pack/packer/start/packer.nvim
# Найден репозиторий "wbthomason/packer.nvim" # Найден репозиторий "wbthomason/packer.nvim"
# Installation request if not set -q _flag_force
set RESPONSE (read -n 1 -p "print PACKER_EXISTS") # Installation request
bind -e y set RESPONSE (read -n 1 -p "print PACKER_EXISTS")
bind -e y
end
if test (string match -ri 'y' "$RESPONSE") if set -q _flag_force; or test (string match -ri 'y' "$RESPONSE")
# Запрошена переустановка # Запрошена переустановка
# Деинициализация старого репозитория begin
rm -rf ~/.local/share/nvim/site/pack/packer/start/packer.nvim 1> /dev/null 2> /dev/null # Деинициализация старого репозитория
rm -rf ~/.local/share/nvim/site/pack/packer/start/packer.nvim
# Инициализация репозитория # Инициализация репозитория
git clone --depth 1 https://github.com/wbthomason/packer.nvim\ git clone --depth 1 https://github.com/wbthomason/packer.nvim\
~/.local/share/nvim/site/pack/packer/start/packer.nvim 1> /dev/null 2> /dev/null ~/.local/share/nvim/site/pack/packer/start/packer.nvim
end &> $output
print PACKER_INSTALLED print PACKER_INSTALLED
end end
else else
# Не найден репозиторий "wbthomason/packer.nvim" # Не найден репозиторий "wbthomason/packer.nvim"
# Инициализация репозитория begin
git clone --depth 1 https://github.com/wbthomason/packer.nvim\ # Инициализация репозитория
~/.local/share/nvim/site/pack/packer/start/packer.nvim 1> /dev/null 2> /dev/null git clone --depth 1 https://github.com/wbthomason/packer.nvim\
~/.local/share/nvim/site/pack/packer/start/packer.nvim
end &> $output
print PACKER_INSTALLED print PACKER_INSTALLED
end end
end end
# Installation request if not set -q _flag_force
set RESPONSE (read -n 1 -p "print LSP_INTELEPHENSE_INSTALL") # Installation request
bind -e y set RESPONSE (read -n 1 -p "print LSP_INTELEPHENSE_INSTALL")
bind -e y
end
if test (string match -ri 'y' "$RESPONSE") if set -q _flag_force; or test (string match -ri 'y' "$RESPONSE")
# Запрошена установка "bmewburn/vscode-intelephense" # Запрошена установка "bmewburn/vscode-intelephense"
# Установка begin
sudo npm i -g intelephense 1> /dev/null 2> /dev/null # Установка
sudo npm i -g intelephense
end &> $output
print LSP_INTELEPHENSE_INSTALLED print LSP_INTELEPHENSE_INSTALLED
end end
# Installation request if not set -q _flag_force
set RESPONSE (read -n 1 -p "print LSP_VSCODE-LANGSERVERS_INSTALL") # Installation request
bind -e y set RESPONSE (read -n 1 -p "print LSP_VSCODE-LANGSERVERS_INSTALL")
bind -e y
end
if test (string match -ri 'y' "$RESPONSE") if set -q _flag_force; or test (string match -ri 'y' "$RESPONSE")
# Запрошена установка "hrsh7th/vscode-langservers-extracted" # Запрошена установка "hrsh7th/vscode-langservers-extracted"
# Установка begin
sudo npm i -g vscode-langservers-extracted 1> /dev/null 2> /dev/null # Установка
sudo npm i -g vscode-langservers-extracted
end &> $output
print LSP_VSCODE-LANGSERVERS_INSTALLED print LSP_VSCODE-LANGSERVERS_INSTALLED
end end
# Installation request if not set -q _flag_force
set RESPONSE (read -n 1 -p "print LSP_EMMET_INSTALL") # Installation request
bind -e y set RESPONSE (read -n 1 -p "print LSP_EMMET_INSTALL")
bind -e y
end
if test (string match -ri 'y' "$RESPONSE") if set -q _flag_force; or test (string match -ri 'y' "$RESPONSE")
# Запрошена установка "aca/emmet-ls" # Запрошена установка "aca/emmet-ls"
# Установка begin
sudo npm i -g emmet-ls 1> /dev/null 2> /dev/null # Установка
sudo npm i -g emmet-ls
end &> $output
print LSP_EMMET_INSTALLED print LSP_EMMET_INSTALLED
end end
# Installation request if not set -q _flag_force
set RESPONSE (read -n 1 -p "print LSP_CSSMODULES_INSTALL") # Installation request
bind -e y set RESPONSE (read -n 1 -p "print LSP_CSSMODULES_INSTALL")
bind -e y
end
if test (string match -ri 'y' "$RESPONSE") if set -q _flag_force; or test (string match -ri 'y' "$RESPONSE")
# Запрошена установка "antonk52/cssmodules-language-server" # Запрошена установка "antonk52/cssmodules-language-server"
# Установка begin
sudo npm i -g cssmodules-language-server 1> /dev/null 2> /dev/null # Установка
sudo npm i -g cssmodules-language-server
end &> $output
print LSP_CSSMODULES_INSTALLED print LSP_CSSMODULES_INSTALLED
end end
# Installation request if not set -q _flag_force
set RESPONSE (read -n 1 -p "print LSP_DENO_INSTALL") # Installation request
bind -e y set RESPONSE (read -n 1 -p "print LSP_DENO_INSTALL")
bind -e y
end
if test (string match -ri 'y' "$RESPONSE") if set -q _flag_force; or test (string match -ri 'y' "$RESPONSE")
# Запрошена установка "denoland/deno" # Запрошена установка "denoland/deno"
# Установка begin
curl -fsSL https://deno.land/install.sh | sh 1> /dev/null 2> /dev/null # Установка
curl -fsSL https://deno.land/install.sh | sh
end &> $output
# TODO доделать нормально # TODO доделать нормально
set -g DENO_INSTALL "$HOME/.deno" set -g DENO_INSTALL "$HOME/.deno"
@ -227,72 +270,90 @@ if test (string match -ri 'y' "$RESPONSE")
print LSP_DENO_INSTALLED print LSP_DENO_INSTALLED
end end
# Installation request
set RESPONSE (read -n 1 -p "print LSP_LUA_INSTALL")GG
bind -e y
if test (string match -ri 'y' "$RESPONSE") if not set -q _flag_force
# Installation request
set RESPONSE (read -n 1 -p "print LSP_LUA_INSTALL")
bind -e y
end
if set -q _flag_force; or test (string match -ri 'y' "$RESPONSE")
# Запрошена установка "luals/lua-language-server" # Запрошена установка "luals/lua-language-server"
# Установка begin
sudo apt install ninja-build -y # Установка
cd ~/ sudo apt install ninja-build -y
rm -rf lua-language-server 1> /dev/null 2> /dev/null cd ~/
git clone https://github.com/LuaLS/lua-language-server 1> /dev/null 2> /dev/null rm -rf lua-language-server
cd lua-language-server git clone https://github.com/LuaLS/lua-language-server
fish ./make.sh 1> /dev/null 2> /dev/null cd lua-language-server
fish_add_path $HOME/lua-language-server/bin 1> /dev/null 2> /dev/null fish ./make.sh
fish_add_path $HOME/lua-language-server/bin
end &> $output
print LSP_LUA_INSTALLED print LSP_LUA_INSTALLED
end end
# Installation request if not set -q _flag_force
set RESPONSE (read -n 1 -p "print FORMATTER_NGINX_INSTALL") # Installation request
bind -e y set RESPONSE (read -n 1 -p "print FORMATTER_NGINX_INSTALL")
bind -e y
end
if test (string match -ri 'y' "$RESPONSE") if set -q _flag_force; or test (string match -ri 'y' "$RESPONSE")
# Запрошена установка "vasilevich/nginxbeautifier" # Запрошена установка "vasilevich/nginxbeautifier"
# Установка begin
sudo npm i -g nginxbeautifier 1> /dev/null 2> /dev/null # Установка
sudo npm i -g nginxbeautifier
end &> $output
print FORMATTER_NGINX_INSTALLED print FORMATTER_NGINX_INSTALLED
end end
# Installation request if not set -q _flag_force
set RESPONSE (read -n 1 -p "print FORMATTER_PRETTIER_INSTALL") # Installation request
bind -e y set RESPONSE (read -n 1 -p "print FORMATTER_PRETTIER_INSTALL")
bind -e y
end
if test (string match -ri 'y' "$RESPONSE") if set -q _flag_force; or test (string match -ri 'y' "$RESPONSE")
# Accepted installation of "prettier/vim-prettier" # Accepted installation of "prettier/vim-prettier"
npm i prettier 1> /dev/null 2> /dev/null begin
sudo npm i -g prettier 1> /dev/null 2> /dev/null npm i prettier
sudo npm i -g prettier
end &> $output
print FORMATTER_PRETTIER_INSTALLED print FORMATTER_PRETTIER_INSTALLED
end end
print FONTS print FONTS
# Installation request if not set -q _flag_force
set RESPONSE (read -n 1 -p "print FONT_INSTALL") # Installation request
bind -e y set RESPONSE (read -n 1 -p "print FONT_INSTALL")
if test (string match -ri 'y' "$RESPONSE") bind -e y
end
if set -q _flag_force; or test (string match -ri 'y' "$RESPONSE")
# Accepted installation of the FiraCode font # Accepted installation of the FiraCode font
mkdir -p ~/.local/share/fonts/FiraCode begin
cd ~/.local/share/fonts/FiraCode mkdir -p ~/.local/share/fonts/FiraCode
wget "https://github.com/ryanoasis/nerd-fonts/releases/download/v3.1.1/FiraCode.zip" cd ~/.local/share/fonts/FiraCode
unzip FiraCode.zip wget "https://github.com/ryanoasis/nerd-fonts/releases/download/v3.1.1/FiraCode.zip"
rm FiraCode.zip unzip -o FiraCode.zip
fc-cache -f -v rm FiraCode.zip
fc-cache -f -v
end &> $output
print FONT_INSTALLED print FONT_INSTALLED
if type -q dconf if type -q dconf
# GNOME # GNOME
# if (string match (lsb_release -i | grep -Po '[^\s]*$') Ubuntu)) # if (set -q _flag_force or string match (lsb_release -i | grep -Po '[^\s]*$') Ubuntu))
# sudo apt-get install dconf # sudo apt-get install dconf
# end # end
end end
@ -303,27 +364,37 @@ if test (string match -ri 'y' "$RESPONSE")
else else
# Denied installation of the FiraCode font # Denied installation of the FiraCode font
# Installation request if not set -q _flag_force
set RESPONSE (read -n 1 -p "print FONT_PATCH") # Installation request
bind -e y set RESPONSE (read -n 1 -p "print FONT_PATCH")
bind -e y
end
if test (string match -ri 'y' "$RESPONSE") if set -q _flag_force; or test (string match -ri 'y' "$RESPONSE")
# Accepted to patching the font # Accepted to patching the font
cd ~/ begin
wget "https://github.com/ryanoasis/nerd-fonts/releases/latest/download/FontPatcher.zip" cd ~/
unzip FontPatcher.zip -d font_patcher wget "https://github.com/ryanoasis/nerd-fonts/releases/latest/download/FontPatcher.zip"
cd font_patcher unzip -o FontPatcher.zip -d font_patcher
cd font_patcher
#if not type -q python && type -q python3 #if not type -q python && type -q python3
if not type -q python if not type -q python
# alias python=python3 # alias python=python3
sudo apt install python-is-python3 -y sudo apt install python-is-python3 -y
end end
sudo apt install fontforge python3-fontforge -y sudo apt install fontforge python3-fontforge -y
./font-patcher (read -p "print FONT_CHOOSE") end &> $output
# Initializing path to the font
set FONT (read -p "print FONT_CHOOSE")
begin
./font-patcher $FONT
end &> $output
print FONT_PATCHED print FONT_PATCHED
end end

View File

@ -0,0 +1,2 @@
-- Quick compilation with GCC and running
vim.keymap.set('n', 'co', '<cmd>:!gcc -o test % && ./test', {noremap = true})

View File

@ -30,7 +30,7 @@ vim.keymap.set('n', '<space>q', vim.diagnostic.setloclist, { noremap = true, sil
lspconfig_on_attach = function(client, bufnr) lspconfig_on_attach = function(client, bufnr)
-- Активация завершения -- Активация завершения
vim.api.nvim_buf_set_option(bufnr, 'omnifunc', 'v:lua.vim.lsp.omnifunc') vim.api.nvim_buf_set_option(bufnr, 'omnifunc', 'v:lua.vim.lsp.omnifunc')
vim.keymap.set({ 'n', 'v', 't' }, 'F', function() vim.lsp.buf.format { async = true } end, { noremap = true, silent = true, buffer = bufnr }) -- vim.keymap.set({ 'n', 'v', 't' }, 'F', function() vim.lsp.buf.format { async = true } end, { noremap = true, silent = true, buffer = bufnr })
vim.keymap.set('n', 'gD', vim.lsp.buf.declaration, { noremap = true, silent = true, buffer = bufnr }) vim.keymap.set('n', 'gD', vim.lsp.buf.declaration, { noremap = true, silent = true, buffer = bufnr })
vim.keymap.set('n', 'gd', vim.lsp.buf.definition, { noremap = true, silent = true, buffer = bufnr }) vim.keymap.set('n', 'gd', vim.lsp.buf.definition, { noremap = true, silent = true, buffer = bufnr })
@ -55,19 +55,18 @@ vim.keymap.set({ 'n', 'v', 't' }, 'F', function()
vim.api.nvim_exec('w', false) vim.api.nvim_exec('w', false)
vim.api.nvim_exec('! nginxbeautifier -i %', false) vim.api.nvim_exec('! nginxbeautifier -i %', false)
vim.api.nvim_exec('redraw', false) vim.api.nvim_exec('redraw', false)
elseif (vim.lsp.buf.server_ready()) then elseif (not (vim.diff(vim.inspect(vim.lsp.buf_get_clients()), '{}') == '')) then
-- LSP-server is ready -- LSP-server clients is ready
vim.lsp.buf.format { async = true } vim.lsp.buf.format { async = true }
else else
-- LSP-server not found -- LSP-server clients not found
vim.api.nvim_exec('PrettierAsync', false) vim.api.nvim_exec('PrettierAsync', false)
end end
end, end,
{ noremap = true, silent = true, buffer = bufnr }) { noremap = true, silent = true, buffer = bufnr })
--[[ lewis6991/gitsigns.nvim ]] --[[ lewis6991/gitsigns.nvim ]]
-- Инициализация только после того, как LSP-сервер подключится к текущему буферу -- Инициализация только после того, как LSP-сервер подключится к текущему буферу
gitsigns_on_attach = function(bufnr) gitsigns_on_attach = function(bufnr)

View File

@ -5,7 +5,7 @@ vim.opt.clipboard = 'unnamedplus'
--vim.opt.completeopt = 'menuone,noselect' --vim.opt.completeopt = 'menuone,noselect'
-- Не автокомментировать новые линии при переходе на новую строку -- Не автокомментировать новые линии при переходе на новую строку
--vim.cmd('autocmd BufEnter * set fo-=c fo-=r fo-=o') vim.cmd('autocmd BufEnter * set fo-=c fo-=r fo-=o')
-- Нумерация строк -- Нумерация строк
vim.opt.number = true vim.opt.number = true