From 6bf8fcbe9b74026330b54e35f7ac2d652c82dfb7 Mon Sep 17 00:00:00 2001 From: Abdellah El Morabit Date: Wed, 12 Nov 2025 14:15:31 +0100 Subject: [PATCH] [feature] nvim and .zshrc update --- nvim/init.lua | 108 +++++++++++++------------------------------- nvim/lazy-lock.json | 10 ++-- zsh/.zshrc | 52 +++++++++++++++++++++ 3 files changed, 88 insertions(+), 82 deletions(-) create mode 100644 zsh/.zshrc diff --git a/nvim/init.lua b/nvim/init.lua index 9afda0a..aaa9d4b 100644 --- a/nvim/init.lua +++ b/nvim/init.lua @@ -13,14 +13,7 @@ require("lazy").setup({ { "nvim-telescope/telescope.nvim",lazy = false, dependencies = "nvim-lua/plenary.nvim" }, { "neovim/nvim-lspconfig" }, { "williamboman/mason.nvim", config = true }, - { - "mason-org/mason-lspconfig.nvim", - opts = {}, - dependencies = { - { "mason-org/mason.nvim", opts = {} }, - "neovim/nvim-lspconfig", - }, - }, + { "mason-org/mason-lspconfig.nvim", opts = {}, dependencies = {"mason-org/mason.nvim"}}, { "nvim-treesitter/nvim-treesitter", build = ":TSUpdate" }, { "hrsh7th/nvim-cmp", dependencies = { "hrsh7th/cmp-nvim-lsp", @@ -30,7 +23,6 @@ require("lazy").setup({ "saadparwaiz1/cmp_luasnip", } }, -{ "ray-x/go.nvim", dependencies = { "ray-x/guihua.lua" }, config = true }, { "akinsho/toggleterm.nvim", version = "*", config = true }, { "sindrets/diffview.nvim", dependencies = "nvim-lua/plenary.nvim" }, { "airblade/vim-gitgutter" }, @@ -39,29 +31,31 @@ require("lazy").setup({ -- neovim configuration vim.opt.termguicolors = true -vim.o.encoding = 'utf-8' -vim.o.fileencoding = 'utf-8' -vim.o.tabstop = 2 -vim.o.shiftwidth = 2 -vim.o.expandtab = true -vim.o.smartindent = true -vim.o.hidden = true -vim.o.number = true -vim.o.relativenumber = true -vim.o.cursorline = true -vim.o.clipboard = 'unnamedplus' -vim.o.wildmenu = true -vim.o.laststatus = 2 -vim.o.undofile = true -vim.o.hlsearch = true -vim.o.incsearch = true -vim.o.ignorecase = true -vim.o.smartcase = true -vim.o.errorbells = false -vim.o.visualbell = false -vim.g.mapleader = ' ' -vim.opt.guicursor = "n-v-c:ver20,a:ver20" -vim.opt.mouse = nil +vim.o.encoding = 'utf-8' +vim.o.fileencoding = 'utf-8' +vim.o.tabstop = 2 +vim.o.shiftwidth = 2 +vim.o.expandtab = true +vim.o.smartindent = true +vim.o.hidden = false +vim.o.number = true +vim.o.relativenumber = true +vim.o.cursorline = true +vim.o.clipboard = 'unnamedplus' +vim.o.wildmenu = true +vim.o.laststatus = 0 +vim.o.cmdheight = 0 +vim.o.undofile = true +vim.o.hlsearch = true +vim.o.incsearch = true +vim.o.ignorecase = true +vim.o.smartcase = true +vim.o.errorbells = false +vim.g.mapleader = ' ' +vim.opt.mouse = nil +vim.o.autoread = true +vim.o.swapfile = off +vim.o.wildmode = longest -- Telescope Keybinds vim.keymap.set('n', '', require('telescope.builtin').find_files) @@ -93,8 +87,6 @@ vim.api.nvim_set_keymap('n', 'do', ':DiffviewOpen', { noremap = true vim.api.nvim_set_keymap('n', 'dc', ':DiffviewClose', { noremap = true, silent = true }) vim.api.nvim_set_keymap('n', 'dh', ':DiffviewFileHistory', { noremap = true, silent = true }) - - local capabilities = require('cmp_nvim_lsp').default_capabilities() local lspconfig = require("lspconfig") @@ -116,52 +108,17 @@ cmp.setup({ }) }) --- define server configurations -vim.lsp.config["gopls"] = { - cmd = { "gopls" }, - settings = { - gopls = { - analyses = { - unusedparams = true, - }, - staticcheck = true, - gofumpt = true, - }, - }, - capabilities = require("cmp_nvim_lsp").default_capabilities(), -} - -vim.lsp.config["clangd"] = { - cmd = { - "clangd", - "--background-index", - "--clang-tidy", - "--log=verbose", - }, - capabilities = require("cmp_nvim_lsp").default_capabilities(), -} - --- start servers automatically for matching filetypes -vim.api.nvim_create_autocmd("FileType", { - pattern = "go", - callback = function() - vim.lsp.start(vim.lsp.config["gopls"]) - end, -}) - -vim.api.nvim_create_autocmd("FileType", { - pattern = { "c", "cpp", "objc", "objcpp" }, - callback = function() - vim.lsp.start(vim.lsp.config["clangd"]) - end, -}) require("nvim-treesitter.configs").setup { - ensure_installed = { "go", "gomod", "c", "lua" }, highlight = { enable = true, additional_vim_regex_highlighting = false }, } require("mason").setup() +require("mason-lspconfig").setup({ + automatic_installation = true, +}) + + require('lualine').setup { options = { @@ -189,11 +146,10 @@ require('lualine').setup { lualine_x = {''}, lualine_y = { { - 'filetype', colored = false, icon_only = false + 'filetype', colored = false, icon_only = true } }, lualine_z = {'location'} }, } - diff --git a/nvim/lazy-lock.json b/nvim/lazy-lock.json index bfac4bc..afdcf7c 100644 --- a/nvim/lazy-lock.json +++ b/nvim/lazy-lock.json @@ -5,18 +5,16 @@ "cmp-path": { "branch": "main", "commit": "c642487086dbd9a93160e1679a1327be111cbc25" }, "cmp_luasnip": { "branch": "master", "commit": "98d9cb5c2c38532bd9bdb481067b20fea8f32e90" }, "diffview.nvim": { "branch": "main", "commit": "4516612fe98ff56ae0415a259ff6361a89419b0a" }, - "go.nvim": { "branch": "master", "commit": "eb92453bc049c156290ed402f90f74090aa86363" }, - "guihua.lua": { "branch": "master", "commit": "6f0b6393bf94dac4c26196e10c234a3d63657741" }, - "lazy.nvim": { "branch": "main", "commit": "e6a8824858757ca9cd4f5ae1a72d845fa5c46a39" }, + "lazy.nvim": { "branch": "main", "commit": "85c7ff3711b730b4030d03144f6db6375044ae82" }, "lualine.nvim": { "branch": "master", "commit": "3946f0122255bc377d14a59b27b609fb3ab25768" }, - "mason-lspconfig.nvim": { "branch": "main", "commit": "d7b5feb6e769e995f7fcf44d92f49f811c51d10c" }, + "mason-lspconfig.nvim": { "branch": "main", "commit": "b1d9a914b02ba5660f1e272a03314b31d4576fe2" }, "mason.nvim": { "branch": "main", "commit": "ad7146aa61dcaeb54fa900144d768f040090bff0" }, "nvim-autopairs": { "branch": "master", "commit": "7a2c97cccd60abc559344042fefb1d5a85b3e33b" }, "nvim-cmp": { "branch": "main", "commit": "106c4bcc053a5da783bf4a9d907b6f22485c2ea0" }, - "nvim-lspconfig": { "branch": "master", "commit": "2010fc6ec03e2da552b4886fceb2f7bc0fc2e9c0" }, + "nvim-lspconfig": { "branch": "master", "commit": "c8503e63c6afab3ed34b49865a4a4edbb1ebf4a8" }, "nvim-treesitter": { "branch": "master", "commit": "42fc28ba918343ebfd5565147a42a26580579482" }, "plenary.nvim": { "branch": "master", "commit": "b9fd5226c2f76c951fc8ed5923d85e4de065e509" }, - "telescope.nvim": { "branch": "master", "commit": "47a8530e79a484d55ba5efa3768fc0b0c023d497" }, + "telescope.nvim": { "branch": "master", "commit": "3a12a853ebf21ec1cce9a92290e3013f8ae75f02" }, "toggleterm.nvim": { "branch": "main", "commit": "50ea089fc548917cc3cc16b46a8211833b9e3c7c" }, "vim-gitgutter": { "branch": "main", "commit": "488c0555e47e2aabe273c635f7dd233e985311a6" } } diff --git a/zsh/.zshrc b/zsh/.zshrc new file mode 100644 index 0000000..e3af585 --- /dev/null +++ b/zsh/.zshrc @@ -0,0 +1,52 @@ +export ZSH="$HOME/.oh-my-zsh" +ZSH_THEME="sorin" +plugins=(git) +source $ZSH/oh-my-zsh.sh + +export EDITOR=nvim + +alias vim="nvim" +alias vi="nvim" +alias ls="lsd" + +# Zoxide +eval "$(zoxide init zsh)" +alias cd='z' +alias zi='zoxide query -i' +alias zq='zoxide query' + +alias attach='tmux attach-session -t' +alias list='tmux list-sessions' + +fzfedit() { + local file + file=$(find . -type f ! -path '*/.*' | fzf --preview 'bat --style=full --color=always {} 2>/dev/null') || return + [[ -n "$file" ]] && nvim "$file" +} + +cfg() { + local file + file=$(find ~/.config -type f | fzf --preview 'bat --style=full --color=always {} 2>/dev/null') || return + [[ -n "$file" ]] && nvim "$file" +} + +# Herd configurations +export HERD_PHP_83_INI_SCAN_DIR="/Users/nasr/Library/Application Support/Herd/config/php/83/" +export HERD_PHP_82_INI_SCAN_DIR="/Users/nasr/Library/Application Support/Herd/config/php/82/" +export PATH="/Users/nasr/Library/Application Support/Herd/bin/":$PATH +export HERD_PHP_85_INI_SCAN_DIR="/Users/nasr/Library/Application Support/Herd/config/php/85/" +export HERD_PHP_84_INI_SCAN_DIR="/Users/nasr/Library/Application Support/Herd/config/php/84/" +export NVM_DIR="/Users/nasr/Library/Application Support/Herd/config/nvm" +[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm +[[ -f "/Applications/Herd.app/Contents/Resources/config/shell/zshrc.zsh" ]] && builtin source "/Applications/Herd.app/Contents/Resources/config/shell/zshrc.zsh" + +# Angular autocompletion +source <(ng completion script) + +# Homebrew configuration +export PATH="$HOME/.local/bin:$PATH" +export PKG_CONFIG_PATH="/opt/homebrew/lib/pkgconfig:$PKG_CONFIG_PATH" # Add Homebrew pkg-config path +export PKG_CONFIG_PATH="/opt/homebrew/Cellar/raylib/5.5/lib/pkgconfig:$PKG_CONFIG_PATH" + +# Syntax highlighting +source /opt/homebrew/share/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh