diff options
author | Oxbian <oxbian@mailbox.org> | 2025-03-24 21:38:08 -0400 |
---|---|---|
committer | Oxbian <oxbian@mailbox.org> | 2025-03-24 21:38:08 -0400 |
commit | 1e4633737b636fd29cfe4add6752aea73639be0c (patch) | |
tree | d19ed20ebf8662c621151f7d92ce6eb7d1bd2bb7 | |
parent | 14779f654194f86b3cec6d89e3fef9e792d29026 (diff) | |
download | vimrc-1e4633737b636fd29cfe4add6752aea73639be0c.tar.gz vimrc-1e4633737b636fd29cfe4add6752aea73639be0c.zip |
feat: better formatter and auto relign at 80 cols
-rw-r--r-- | README.md | 11 | ||||
-rw-r--r-- | conf/options.vim | 4 | ||||
-rw-r--r-- | conf/plugins.vim | 16 |
3 files changed, 24 insertions, 7 deletions
@@ -6,9 +6,6 @@ This repo contains my vim configuration, hope it will be useful for you. You will need `vim` and `git` to be able to use this configuration. -Normally if you run the `install.sh` script it will work, but if you have a -problem, try to install vim plug and check if your problem is solved. - **Since VIM 9.1.0327, vim can now read config from $XDG_CONFIG_HOME/vim** ```sh @@ -143,6 +140,14 @@ source .venv/bin/activate pip install pyton-lsp-server[all] ``` +### PHP + +For PHP, a combinaison of linters and fixers is used. +- [Intelephense](https://github.com/bmewburn/intelephense-docs) LSP +- [PHP_CodeSniffer](https://github.com/squizlabs/PHP_CodeSniffer) linter +- [PHP MessDetector](https://phpmd.org/) linter +- [PHP code fixer](https://cs.symfony.com/) fixer + ## Formatter By default my config add autoformatting on save on each filetype, you just need a LSP server for the filetype. diff --git a/conf/options.vim b/conf/options.vim index c4e131c..8e84a25 100644 --- a/conf/options.vim +++ b/conf/options.vim @@ -9,8 +9,8 @@ syntax on " Show syntax color set number " Show line number colorscheme onedark " Set vim theme to onedark set colorcolumn=80 " Add an indicator for 80 char limit -"set textwidth=80 " Set max text width -"autocmd BufNewFile,BufRead * setlocal formatoptions=cropt " Linebreak at 80 char +set textwidth=80 " Set max text width +autocmd BufNewFile,BufRead * setlocal formatoptions=cropt " Linebreak at 80 char set relativenumber " Show relative line number set cursorline " Select the current line set showmatch " Show matching brackets when hovered diff --git a/conf/plugins.vim b/conf/plugins.vim index bdfa5ea..e2349f3 100644 --- a/conf/plugins.vim +++ b/conf/plugins.vim @@ -48,12 +48,24 @@ let g:ale_set_balloons = 1 " Show error when mouse over it " Linters and fixers (don't forget to setup LSP as linters) let g:ale_linters = { -\ 'python': ['pylsp', 'flake8', 'pylint', 'mypy'] +\ 'python': ['pylsp', 'flake8', 'pylint', 'mypy'], +\ 'php': ['intelephense', 'phpcs', 'phpmd'], +\ 'rust': ['analyzer'], +\ 'html': ['vscodehtml', 'htmlhint', 'stylelint', 'eslint'], +\ 'css': ['vscodecss', 'stylelint'], +\ 'javascript': ['eslint'], \} let g:ale_fixers = { -\ 'python': ['black', 'isort', 'autopep8'] +\ 'python': ['black', 'isort', 'autopep8'], +\ 'php': ['php_cs_fixer'], +\ 'rust': ['rustfmt'], +\ 'html': ['html-beautify'], +\ 'css': ['css-beautify'], +\ 'javascript': ['js-beautify'], \} +let g:ale_html_htmlhint_use_global = 1 +let g:ale_html_stylehint_use_global = 1 " Netrw (filetree built-in vim) let g:netrw_keepdir = 0 " Reload buffer usefull when moving or removing file |