Search This Blog

Showing posts with label neovim. Show all posts
Showing posts with label neovim. Show all posts

Install pre-requisites for flake8 (python language server) on Linux

  • Install pip:
    sudo apt install python3-pip
  • Check python version:
    python3 --version
    Python 3.10.6
  • Install virtualenv:
    sudo apt install python3.10-virtualenv

Setup Neovim and LazyVim

I. Install Neovim




II. Install LazyVim

  • Follow the instructions to install LazyVim: https://www.lazyvim.org/installation
  • Install fd, ripgrep, fzf, lazygit:
    • Mac OS:
      brew install fd ripgrep fzf lazygit
    • Linux:
      apt install fd-find ripgrep fzf lazygit



III. Configuration

  • Install toggleterm.nvim. Create file: ~/.config/nvim/lua/plugins/toggleterm.lua:
    -- ~/.config/nvim/lua/plugins/toggleterm.lua
    return {
      {
        "akinsho/toggleterm.nvim",
        tag = "2.4.0",
        keys = {
          { "<leader>th", "<cmd>ToggleTerm size=15 direction=horizontal<cr>", desc = "Open a horizontal terminal" },
          { "<leader>tt", "<cmd>ToggleTerm<cr>", desc = "Toggle terminal" },
          { "<F7>", "<cmd>ToggleTerm<cr>", desc = "Toggle terminal" },
          { "<F7>", "<cmd>ToggleTerm<cr>", mode= "t", desc = "Toggle terminal" },
        },
        opts = {
          --[[ things you want to change go here]]
        },
      },
    }
  • Set options in ~/.config/nvim/lua/config/options.lua:
    -- ~/.config/nvim/lua/config/options.lua
    vim.opt.relativenumber = false -- Relative line numbers
    vim.opt.shiftwidth = 4 -- Size of an indent
    vim.opt.tabstop = 4 -- Number of spaces tabs count for
    
  • Install nightfox colorscheme. Create file: ~/.config/nvim/lua/plugins/colorscheme.lua:
    -- ~/.config/nvim/lua/plugins/colorscheme.lua
    return {
      -- add nightfox colorscheme
      { "EdenEast/nightfox.nvim" },
    
      -- Configure LazyVim to load nightfox
      {
        "LazyVim/LazyVim",
        opts = {
          colorscheme = "carbonfox",
        },
      }
    }



See also

Compile Neovide from source on Mac OS

  • Install the latest version of Rust.
  • Install CMake. Using homebrew:
    brew install cmake
  • Check out the source code:
    git clone https://github.com/neovide/neovide
  • Compile and install the binary: neovide into ~/.cargo/bin:
    cd neovide
    cargo install --path .
    The resulting binary is to be found under ~/.cargo/bin.
  • In case you want a nice application bundle:
    cargo install cargo-bundle
    cargo bundle --release
    Copy ./target/release/bundle/osx/neovide.app to ~/Applications and enjoy.



See also

NeoVim: Clean Up Everything (Config, Plugins, Cache ...)

# linux/macos (unix)
rm -rf ~/.config/nvim
rm -rf ~/.local/share/nvim
rm -rf ~/.local/state/nvim
rm -rf ~/.cache/nvim




# windows
rd -r ~\AppData\Local\nvim
rd -r ~\AppData\Local\nvim-data



see also

Customize AstroNvim

Enable user customisation

cp -r ~/.config/nvim/lua/user_example ~/.config/nvim/lua/user



Install new plugins

nvim ~/.config/nvim/lua/user/init.lua

  plugins = {
    init = { 
      -- You can also add new plugins here as well:
      -- Add plugins, the packer syntax without the "use"
      { "bryant-the-coder/astron.nvim" }, -- astron colorscheme
    },
  },

:PackerSync



Change colorscheme

nvim ~/.config/nvim/lua/user/init.lua
 -- Set colorscheme to use
 -- colorscheme = "default_theme",
 colorscheme = "astron",



Disable relativenumber option

nvim ~/.config/nvim/lua/user/init.lua
relativenumber = false,



See also

Setup Neovim for Rust Development

  1. Install Neovim
  2. Install AstroNvim
    • After installed AstroNvim, you can customise it
  3. Install rust LSP
    In Neovim, execute command:
    :LspInstall rust
  4. Install rust language parser (tree-sitter)
    In Neovim, execute command:
    :TSInstall rust
  5. Install lua language parser (tree-sitter)
    In Neovim, execute command:
    :TSInstall lua
    This is useful for editting the Neovim config (lua) files (*.lua)





See also