From 07fe8b33f8844bbd5c35130484ddc78419e6d23d Mon Sep 17 00:00:00 2001 From: philw Date: Mon, 13 Jan 2025 18:15:13 +0100 Subject: Update readme --- README.md | 150 ++++++++++++++++++++++++++++++++++++++++++-------------------- 1 file changed, 103 insertions(+), 47 deletions(-) diff --git a/README.md b/README.md index 3ab13b8..2cf0516 100644 --- a/README.md +++ b/README.md @@ -3,62 +3,118 @@ ![nvim](https://user-images.githubusercontent.com/91333841/212791030-440472c6-1568-4754-9181-c47e69bc42d6.png) ### Features +The main goal of this config is being robust and as lightweight as possible. Nothing fancy, just minimum setup for ide-like(ish) experience. ### Installation -Run checkhealth in your nvim to satisfy it's requirements +Run checkhealth before cloning my setup ```vim :checkhealth ``` - -Make sure you analyzed the output properly: - -- Your neovim must be >= 0.7.0 to run this config - -### Installation - -> Easy way - -You can just clone this repo to your .config folder +Then clone this repo to your .config folder, open neovim and wait till installation is over. ```bash git clone https://codeberg.org/philw/nvim ~/.config ``` - -> My way - -I use [gnu-stow](https://www.gnu.org/software/stow/) to manage my [dotfiles](https://codeberg.org/philw/rice), so I encourage you to use it too. - -Use your package manage of choice to get stow, for example: - -```bash -paru -S stow -``` - -Clone this repo to your prefered dir and use stow to symlink - -In order to do this you need an empty nvim directory in your .config folder - -```bash -cd ~/.config -mkdir nvim -cd ~/dir -git clone https://codeberg.org/philw/nvim -stow -d ~/dir -t ~/.config/nvim nvim/ - -``` -Or use my [script](https://codeberg.org/philw/scripts) - -Everything should set up automatically. There is no need for additional setup(if there is report an error). - -```bash -:TSUpdate -``` - -```bash -:TSInstall -``` - +After the installation it may require a restart so it can load colorscheme properly ### Further development -This is the only text editor on my system, so I'll be adding updates as long as I find something better(not gonna happen soon) +After many years, this is the only text editor on my system, so I'll be adding updates as long as I find something better(not gonna happen soon). + +### Documentation + +## Global Settings + +### Editor settings +- `nu = true`: Show line numbers. +- `tabstop = 2`: Set the width of a tab to 2 spaces. +- `softtabstop = 2`: Number of spaces that a tab character counts for during editing. +- `shiftwidth = 2`: Number of spaces to use for auto-indentation. +- `expandtab = true`: Convert tabs to spaces. +- `smartindent = true`: Automatically indent new lines based on the syntax. +- `ruler = false`: Hide the ruler (status bar showing line and column position). +- `wrap = false`: Disable line wrapping. +- `swapfile = false`: Disable the creation of swap files. +- `hlsearch = false`: Disable highlighting of search matches. +- `incsearch = true`: Enable incremental search. +- `updatetime = 50`: Set the update time for asynchronous operations like completions. +- `laststatus = 0`: Hide the status line. +- `signcolumn = "number"`: Display line numbers in the sign column. +- `autoindent = true`: Enable automatic indentation. +- `clipboard = "unnamedplus"`: Use the system clipboard for copy-pasting. +- `termguicolors = true`: Enable 24-bit RGB color support in the terminal. +- `fillchars = "eob: "`: Customize end-of-buffer character. +- `lazyredraw = false`: Disable lazy redrawing for smoother experience. +- `timeoutlen = 500`: Set timeout for key sequences to 500ms. +- `netrw_banner = 0`: Disable Netrw banner. +- `netrw_liststyle = 3`: Use a tree-style layout for Netrw. +- `netrw_altv = 0`: Disable vertical splits for Netrw. +- `netrw_winsize = 25`: Set Netrw window size. +- `netrw_browse_split = 4`: Open Netrw in a horizontal split. +- `rustfmt_autosave = 1`: Enable automatic formatting for Rust files using rustfmt. +- `mkdp_auto_start = 1`: Automatically start Markdown Preview (for `mkdp`). +- `vimtex_view_method = "zathura"`: Set PDF viewer to `zathura` for LaTeX files. +- `vimtex_compiler_method = "latexmk"`: Use `latexmk` for compiling LaTeX files. +- `vimtex_quickfix_mode = 0`: Disable quickfix window for VimTeX. +- `tex_conceal = "abdmg"`: Enable automatic concealment of LaTeX formatting. +- `tex_flavor = "latex"`: Set the flavor of TeX to LaTeX. +- `gitgutter_set_sign_backgrounds = 1`: Enable background color for GitGutter signs. + +## Auto Commands and custom functions (`api.nvim_create_autocmd`) + +### Format on Save +- Formats the buffer using `vim.lsp.buf.format` before saving any file. + +### Run Prettier and Compile LaTeX on Save +- For JavaScript, TypeScript, CSS, HTML, YAML, Markdown, and JSON files, Prettier is run automatically after saving. Yes, I could use lsp features here but in my case this is the bulletproof setup. +- For LaTeX files (`*.tex`), `VimtexCompile` is triggered upon saving to compile the document.(bugged af) + +You can add anything you want. Just make sure it's on your system. + +### Auto-delete Netrw Hidden Buffers +- Automatically deletes hidden buffers when opening a Netrw window. This is quite helpful for the ToggleVExplorer function. + +### `ToggleVExplorer` +- Toggles the VExplorer window in Neovim. +- If the window is already open, it will be closed; if it is closed, it will be opened in the first window. + +## Plugin Management (`require("lazy").setup`) + +The configuration uses **Lazy.nvim** for plugin management. I've tried them all. This works the best for me. + +- **`airblade/vim-gitgutter`**: Displays Git changes in the gutter (added, modified, deleted lines). +- **`lervag/vimtex`**: Provides LaTeX support, including features like auto-compiling and PDF viewing. +- **`norcalli/nvim-colorizer.lua`**: Highlights color codes in files. +- **`nvim-treesitter/nvim-treesitter`**: Provides better syntax highlighting and tree-sitter integration. +- **`neovim/nvim-lspconfig`**: Set up language servers for autocompletion and LSP features. +- **`ms-jpq/coq_nvim`**: Provides autocompletion with COQ (a Neovim completion plugin). +- **`nvim-telescope/telescope.nvim`**: A fuzzy finder plugin for file searching and navigation. +- **`windwp/nvim-autopairs`**: Automatically closes pairs of parentheses, brackets, etc. + +## LSP (Language Server Protocol) Configuration + +### Rust Configuration (`rust_analyzer`) +- Configures `rust_analyzer` with specific settings: + - `imports.granularity.group = "module"`: Organizes imports by module. + - `cargo.buildScripts.enable = true`: Enable build script support for Cargo. + - `procMacro.enable = true`: Enable procedural macro support. + +Each language server is set up using `lspconfig`, and the configuration is ensured with `coq` autocompletion. + +### Mason Setup +- **`mason.nvim`**: Automatically installs LSP servers(currently just rust_analyzer) and other tools. + +## Key Mappings (`keymap.set`) + +- **`e`**: Toggle the VExplorer window. +- **`z`**: Search and replace the word under the cursor in the entire buffer. +- **`a`**: Select the entire buffer. +- **`y`**: Replace the current line with `cc` (change the line). +- **``**: Yank the current line to the clipboard. +- **``**: Paste from the clipboard. +- **``**: Undo the last change. +- **`J` and `K`**: Speed up moving the selected text block down or up in visual mode. +- **`f`**: Open Telescope's file finder. +- **`g`**: Open Telescope's live grep search. +- **`d`**: Go to definition (LSP feature). +- **`k`**: Show hover information (LSP feature). -- cgit v1.2.3