├── .vimrc └── README.md /.vimrc: -------------------------------------------------------------------------------- 1 | " General settings 2 | set scrolloff=8 3 | set number 4 | set relativenumber 5 | set laststatus=2 6 | set tabstop=4 softtabstop=4 7 | set shiftwidth=4 8 | set expandtab 9 | set smartindent 10 | set hlsearch 11 | set termguicolors 12 | set incsearch 13 | set ignorecase 14 | set smartcase 15 | set path+=/usr/include,/usr/local/include 16 | set mouse=a 17 | set ttymouse=sgr 18 | set balloonevalterm 19 | 20 | " Terminal capabilities (Truecolor, underline, strikethrough, etc.) 21 | let &t_AU = "\e[58:5:%dm" 22 | let &t_8u = "\e[58:2:%lu:%lu:%lum" 23 | let &t_Us = "\e[4:2m" 24 | let &t_Cs = "\e[4:3m" 25 | let &t_ds = "\e[4:4m" 26 | let &t_Ds = "\e[4:5m" 27 | let &t_Ce = "\e[4:0m" 28 | let &t_Ts = "\e[9m" 29 | let &t_Te = "\e[29m" 30 | let &t_8f = "\e[38:2:%lu:%lu:%lum" 31 | let &t_8b = "\e[48:2:%lu:%lu:%lum" 32 | let &t_RF = "\e]10;?\e\\" 33 | let &t_RB = "\e]11;?\e\\" 34 | let &t_BE = "\e[?2004h" 35 | let &t_BD = "\e[?2004l" 36 | let &t_PS = "\e[200~" 37 | let &t_PE = "\e[201~" 38 | let &t_RC = "\e[?12$p" 39 | let &t_SH = "\e[%d q" 40 | let &t_RS = "\eP$q q\e\\" 41 | let &t_SI = "\e[5 q" 42 | let &t_SR = "\e[3 q" 43 | let &t_EI = "\e[1 q" 44 | let &t_VS = "\e[?12l" 45 | let &t_fe = "\e[?1004h" 46 | let &t_fd = "\e[?1004l" 47 | let &t_ut='' " Fix background rendering for kitty-like terminals 48 | 49 | " Leader key 50 | let mapleader = " " 51 | 52 | " Plugin management with vim-plug 53 | call plug#begin('~/.vim/plugged') 54 | 55 | " Colorscheme 56 | Plug 'kaicataldo/material.vim', { 'branch': 'main' } 57 | Plug 'ayu-theme/ayu-vim' 58 | 59 | " Essential plugins 60 | Plug 'junegunn/fzf', { 'do': { -> fzf#install() } } 61 | Plug 'junegunn/fzf.vim' 62 | Plug 'wakatime/vim-wakatime' 63 | 64 | " Core autocompletion and LSP with coc.nvim 65 | " Use release branch (recommended) 66 | Plug 'neoclide/coc.nvim', {'branch': 'release'} 67 | 68 | " Or build from source code by using npm 69 | Plug 'neoclide/coc.nvim', {'branch': 'master', 'do': 'npm ci'} 70 | 71 | Plug 'shawncplus/phpcomplete.vim' 72 | 73 | " PHP-specific plugins (Best for autocompletion) 74 | Plug 'phpactor/phpactor', {'for': 'php', 'do': 'composer install --no-dev -o'} " PHP language server 75 | Plug 'jwalton512/vim-blade' " Laravel Blade support 76 | Plug 'noahfrederick/vim-laravel' " Laravel-specific features 77 | Plug 'stephpy/vim-yaml', {'for': 'yaml'} " YAML for Laravel configs 78 | Plug 'beanworks/vim-phpfmt' " PHP formatting 79 | 80 | " Linting and fixing (complements autocompletion) 81 | Plug 'dense-analysis/ale' 82 | 83 | " Utility plugins 84 | Plug 'tpope/vim-fugitive' " Git integration 85 | Plug 'airblade/vim-gitgutter' " Git diff in gutter 86 | Plug 'scrooloose/nerdtree' " File explorer 87 | Plug 'majutsushi/tagbar' " Tag navigation 88 | 89 | " C/C++ support 90 | Plug 'neoclide/coc-clangd' " C/C++ autocompletion 91 | 92 | " ARM assembly support 93 | Plug 'Shirk/vim-gas' " GNU Assembler syntax 94 | 95 | Plug 'yaegassy/coc-intelephense', {'do': 'yarn install --frozen-lockfile'} 96 | 97 | " Markdown preview 98 | " If you don't have nodejs and yarn 99 | " use pre build, add 'vim-plug' to the filetype list so vim-plug can update this plugin 100 | " see: https://github.com/iamcco/markdown-preview.nvim/issues/50 101 | Plug 'iamcco/markdown-preview.nvim', { 'do': { -> mkdp#util#install() }, 'for': ['markdown', 'vim-plug']} 102 | 103 | 104 | " If you have nodejs 105 | Plug 'iamcco/markdown-preview.nvim', { 'do': 'cd app && npx --yes yarn install' } 106 | 107 | call plug#end() 108 | 109 | " Theme settings 110 | let ayucolor="mirage" 111 | colorscheme material 112 | 113 | " Coc.nvim global extensions 114 | let g:coc_global_extensions = ['coc-clangd', 'coc-phpactor', 'coc-json', 'coc-html', 'coc-css'] 115 | let g:coc_node_path = '/usr/bin/node' " Verify this path with :!which node 116 | 117 | " General autocompletion settings 118 | set completeopt=menuone,noinsert,noselect 119 | inoremap coc#refresh() " Trigger completion 120 | inoremap pumvisible() ? "\" : "\" " Select completion with Tab 121 | inoremap pumvisible() ? "\" : "\" " Navigate up in completion menu 122 | 123 | " PHP-specific settings 124 | autocmd FileType php setlocal omnifunc=v:lua.vim.lsp.omnifunc 125 | autocmd FileType php let g:coc_php_server_args = ['--tcp=127.0.0.1:1212', '--memory-limit=2048M'] 126 | 127 | " C/C++ settings 128 | autocmd FileType c,cpp setlocal omnifunc=v:lua.vim.lsp.omnifunc 129 | autocmd FileType c,cpp setlocal tabstop=4 shiftwidth=4 expandtab smartindent 130 | 131 | " ALE settings (Linting and Fixing for PHP) 132 | let g:ale_linters = { 133 | \ 'php': ['phpcs'], 134 | \ 'c': ['gcc'], 135 | \ 'cpp': ['g++'] 136 | \} 137 | let g:ale_fixers = { 138 | \ 'php': ['php_cs_fixer', 'phpcbf'] 139 | \} 140 | let g:ale_php_php_cs_fixer_executable = 'php-cs-fixer' 141 | let g:ale_php_php_cs_fixer_options = '--rules=@PSR12' " Modern PSR-12 standard 142 | let g:ale_fix_on_save = 1 143 | 144 | " PHPactor settings (optional manual tweak) 145 | let g:phpactorCompletion = 1 146 | let g:phpactorPath = '~/.vim/plugged/phpactor/bin/phpactor' 147 | 148 | " Mappings 149 | nnoremap pv :Vex " Vertical explorer 150 | nnoremap :so ~/.vimrc " Reload config 151 | nnoremap pf :Files 152 | nnoremap ff :NERDTreeToggle " Toggle NERDTree 153 | nnoremap tt :TagbarToggle " Toggle Tagbar 154 | nnoremap gs :G " Git status 155 | nnoremap cc :CocCommand " Coc commands 156 | nnoremap :cnext " Next quickfix item 157 | nnoremap :cprev " Previous quickfix item 158 | 159 | " Autocommands 160 | augroup ClearSearchHighlight 161 | autocmd! 162 | autocmd InsertEnter * :set nohlsearch 163 | augroup END 164 | 165 | " Assembly filetypes 166 | autocmd BufRead,BufNewFile *.s,*.asm set filetype=asm 167 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # My Vim Configuration for Vim 9.1 2 | 3 | 4 | 5 | This repository contains my personal Vim configuration designed to enhance productivity for general programming, PHP development, and C/C++ workflows. It is optimized for Vim 9.1 and includes plugins and settings tailored for web development, assembly, and C/C++ projects. 6 | 7 | 8 | 9 | --- 10 | 11 | 12 | 13 | ## Features 14 | 15 | 16 | 17 | - **General Enhancements**: 18 | 19 | - Line numbers (relative and absolute) 20 | 21 | - Smart indentation and tabs 22 | 23 | - Mouse support 24 | 25 | - Truecolor and styled underline support 26 | 27 | 28 | 29 | - **Programming Language Support**: 30 | 31 | - **PHP**: Includes plugins for Laravel and PHP-specific enhancements 32 | 33 | - **C/C++**: Autocompletion and linting using `coc-clangd` and `YouCompleteMe` 34 | 35 | - **Assembly**: Syntax highlighting for ARM assembly (GNU Assembler) 36 | 37 | 38 | 39 | - **Plugins for Productivity**: 40 | 41 | - **File Navigation**: FZF and NERDTree 42 | 43 | - **Version Control**: Fugitive and GitGutter 44 | 45 | - **Code Formatting**: ALE and Prettier 46 | 47 | - **Debugger**: Vimspector for debugging C/C++ projects 48 | 49 | 50 | 51 | - **Theme**: Ayu (mirage variant) 52 | 53 | 54 | 55 | --- 56 | 57 | 58 | 59 | ## Requirements 60 | 61 | 62 | 63 | 1. **Vim 9.1 or higher** 64 | 65 | - Ensure your Vim installation is compiled with Python 3 support for plugins like YouCompleteMe and Coc.nvim. 66 | 67 | - For Linux, install Vim with `vim-gtk3` or build from source: 68 | 69 | ```bash 70 | 71 | sudo apt install vim-gtk3 72 | 73 | ``` 74 | 75 | 76 | 77 | 2. **Plugin Manager**: [vim-plug](https://github.com/junegunn/vim-plug) 78 | 79 | - If not already installed, set it up by running: 80 | 81 | ```bash 82 | 83 | curl -fLo ~/.vim/autoload/plug.vim --create-dirs \ 84 | 85 | https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim 86 | 87 | ``` 88 | 89 | 90 | 91 | 3. **Dependencies**: 92 | 93 | - Node.js (for Coc.nvim and Prettier): 94 | 95 | ```bash 96 | 97 | sudo apt install nodejs npm 98 | 99 | ``` 100 | 101 | - Composer (for PHPactor): 102 | 103 | ```bash 104 | 105 | sudo apt install composer 106 | 107 | ``` 108 | 109 | - Python 3 (for YouCompleteMe): 110 | 111 | ```bash 112 | 113 | sudo apt install python3 python3-pip 114 | 115 | ``` 116 | 117 | - Yarn (for vim-prettier): 118 | 119 | ```bash 120 | 121 | npm install --global yarn 122 | 123 | ``` 124 | 125 | 126 | 127 | --- 128 | 129 | 130 | 131 | ## Installation 132 | 133 | 134 | 135 | 1. Clone this repository into your home directory: 136 | 137 | ```bash 138 | 139 | git clone https://github.com/imaarov/my-vim-config.git ~/.vim 140 | 141 | --------------------------------------------------------------------------------