• Configurer NeoVim

      Emplacement des fichiers de configuration

      ~/.config/nvim/init.lua
      ~/.config/nvim/init.vim

       

      Autres fichiers importants :

      ~/.config/nvim/plugin/    # Scripts chargés automatiquement
      ~/.config/nvim/ftplugin/  # Configurations spécifiques à des types de fichiers

       

      Vérifier l’emplacemenr depuis Neovim :

      nvim --headless -c 'echo stdpath("config")' -c 'q'

      ou bien dans vim :

      :echo stdpath('config') -> affichera le chemin ~/.config/nvim

       

      Migrer depuis init.vim vers init.lua -> ~/.vimrc peut être liée via :lua

      vi ~/.config/nvim/init.vim
      set runtimepath^=~/.vim
      source ~/.vimrc

      Activer la souris dans Neovim

      vi ~/.config/nvim/init.lua :

      vi ~/.config/nvim/init.lua
      
      -- Active la souris dans tous les modes (n=normal, v=visuel, i=insertion)
      vim.opt.mouse = "a"    -- 'a' pour "all" (tous les modes)
      vim.opt.mouse = "nvi"  -- Seulement normal, visuel et insertion

       

      Pour éviter que Neovim ne capture la souris dans un terminal :

      :source $MYVIMRC  -- ou :luafile ~/.config/nvim/init.lua

       

      NOTE :Si la souris ne fonctionne pas dans TMUX, ajoutez set -g mouse on dans ~/.tmux.conf.

      Changer le curseur

      Rectangle plein (bloc) comme curseur en mode insertion :

      vi ~/.config/nvim/init.lua
      vim.opt.guicursor = "n-v-c:block,i-ci-ve:block"

       

      - Fonctionne bien avec :Kitty, Alacritty, iTerm2, Windows Terminal, mais peut ne pas marcher dans le terminal xterm.

      Pour un meilleur support dans Kitty :

      vi kitty.conf
      shell_integration no-cursor

       

      block Forme du curseur (block , ver pour vertical (|)., hor pour horizontal (_).

      blinkwait300 Délai (en ms) avant que le curseur ne commence à clignoter. 300 millisecondes

      blinkon200 Durée (en ms) pendant laquelle le curseur reste visible pendant un clignotement. 200 millisecondes

      blinkoff150 Durée (en ms) pendant laquelle le curseur reste invisible pendant un clignotement. 150 millisecondes
      À combiner avec les modes (i = insertion, n = normal, v = visual).

       

      Voili voilou !

       

       

      Installation

      There are multiple ways to install lazy.nvim. The Structured Setup is the recommended way, but you can also use the Single File Setup if you prefer to keep everything in your init.lua.

      Please refer to the Configuration section for an overview of all available options.

      It is recommended to run :checkhealth lazy after installation.

      In what follows ~/.config/nvim is your Neovim configuration directory. On Windows, this is usually ~\AppData\Local\nvim. To know the correct path for your system, run :echo stdpath('config').

      • Structured Setup
      • Single File Setup
      ~/.config/nvim/init.lua
      require("config.lazy")
      
      ~/.config/nvim/lua/config/lazy.lua
      local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim"
      if not (vim.uv or vim.loop).fs_stat(lazypath) then
        local lazyrepo = "https://github.com/folke/lazy.nvim.git"
        local out = vim.fn.system({ "git", "clone", "--filter=blob:none", "--branch=stable", lazyrepo, lazypath })
        if vim.v.shell_error ~= 0 then
          vim.api.nvim_echo({
            { "Failed to clone lazy.nvim:\n", "ErrorMsg" },
            { out, "WarningMsg" },
            { "\nPress any key to exit..." },
          }, true, {})
          vim.fn.getchar()
          os.exit(1)
        end
      end
      vim.opt.rtp:prepend(lazypath)
      
      -- Make sure to setup `mapleader` and `maplocalleader` before
      -- loading lazy.nvim so that mappings are correct.
      -- This is also a good place to setup other settings (vim.opt)
      vim.g.mapleader = " "
      vim.g.maplocalleader = "\\"
      
      -- Setup lazy.nvim
      require("lazy").setup({
        spec = {
          -- import your plugins
          { import = "plugins" },
        },
        -- Configure any other settings here. See the documentation for more details.
        -- colorscheme that will be used when installing plugins.
        install = { colorscheme = { "habamax" } },
        -- automatically check for plugin updates
        checker = { enabled = true },
      })
      

       

      You can then create your plugin specs in ~/.config/nvim/lua/plugins/. Each file should return a table with the plugins you want to install.

      For more info see Structuring Your Plugins

      ~/.config/nvim
      ├── lua
      │   ├── config
      │   │   └── lazy.lua
      │   └── plugins
      │       ├── spec1.lua
      │       ├── **
      │       └── spec2.lua
      └── init.lua
      

       

       

       

 

Aucun commentaire

 

Laissez un commentaire