Skip to content

enzoarguello512/ubuntu-nvim-config

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

19 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

This is my configuration for nvim in the ubuntu environment, much of the information already comes from my old configuration in windows , in this new version several new plugins are added and the migration to lua begins

Table of contents

  1. Requirements
  2. Configuration
  3. Used plugins and their function
  4. Plugins Requirements
  5. Keyboard shortcuts
  6. Windows version (old)
  7. Special mentions
  8. How to keep it updated
  9. Credits

⚡️ Requirements

  • Have vim and nvim installed

  • A plugin manager (I personally use Vim-Plug), but you can safely use any other, for example Vim-Vundle, and you would only have to change the lines to suit your plugin manager. For example using Vim-Vundle you would have to change the following:

    set rtp+=~/.vim/bundle/Vundle.vim
    call vundle#begin()
    " And any other plugin you want to change
    Plugin 'tpope/vim-fugitive'
    call vundle#end()
  • Once you have a plugin manager you will have to install the plugins that are in ".vimrc", in case of using vim-plug, you only have to put this command in the console and you should install them :PlugInstall

  • To use the plugins you will also need:

    • node or nvm
    • python
      Additionally you can improve the autocomplete for python by installing the following packages
      pip3 install pynvim
      pip3 install neovim
      
      pip3 install -U setuptools
      
      pip3 install python-language-server
      pip3 install 'python-language-server[all]'
      
      pip3 install git+git:https://github.com/psf/black
      
      pip3 install pyls-mypy
      pip3 install pyls-isort
      pip3 install pyls-black

⚙️ Configuration

You can configure everything to your liking, I leave it as it is more comfortable for me, below I will also describe most of the keyboard shortcuts (which are generally the defaults of the X plugin in particular)

  • There is an option enabled in the configuration (.vimrc) that will autosave the view (this includes, for example, where you were positioned before closing the file, if you created folds, they will also be saved, etc.)

    " save the folds in the .vim/view directory
     autocmd BufWinLeave _._ mkview
     autocmd BufWinEnter _._ silent loadview

    but it may generate lag and also it will execute with each new file and it will generate an error message if it is a new file (only the first time), it will also generate a folder called "view" in the nvim folder and in the vim folder

    In windows C:\Users\<username>\AppData\Local\nvim-data\view or C:\Users\<username>\\.vim\view

    That is why if it bothers you to have this enabled it is better that you delete it from the .vimrc

📚 Used plugins and their function

Autocomplete

Appearance

  • tokyonight theme a simple theme for nvim that I liked, nothing special
  • lualine to make the statusline and tabline more beautiful
  • nvim-web-devicons displays icons according to file type
  • indentLine a vim plugin to display the indention levels with thin vertical lines

Navigation

Mobility

  • hop to move much faster while editing
  • neoscroll for smooth scrolling

Git

  • vim-gitgutter shows which lines have been added, modified, or removed when using git
  • vim-fugitive to use git commands more quickly

Browsers

  • firenvim embed neovim in chrome, firefox, thunderbird & others.

Useful

  • vim-sandwich set of operator and textobject plugins to search/select/edit sandwiched textobjects
  • emmet-vim emmet-vim is a vim plug-in which provides support for expanding abbreviations similar to emmet
  • winresizer very simple vim plugin for easy resizing of your vim windows
  • vim-polyglot something like prettier but for many more languages and vim
  • vim-commentary for commenting operations and styles
  • asyncrun for running async shell commands
  • better-escape a vim/neovim plugin for escaping insert mode without lagging

📘 Plugins requirements

coc.nvim

https://github.com/neoclide/coc.nvim/wiki/Install-coc.nvim

vim-mundo

  • Vim ≥ 7.3 with +python3 or +python options
  • Neovim with pynvim installed
  • Python ≥ 2.4

https://github.com/simnalamburt/vim-mundo#requirements

firenvim

  1. Check if the luabitop package is available by running :lua bit.band(1,1) in Neovim. If this throws an error, you will need to install it.

  2. Finally, install the Firenvim addon for your browser from Mozilla's store or Google's.

https://github.com/glacambre/firenvim#installing

nvim-web-devicons

https://github.com/kyazdani42/nvim-web-devicons#requirements

telescope.nvim

https://github.com/nvim-telescope/telescope.nvim#getting-started

nvim-treesitter

https://github.com/nvim-treesitter/nvim-treesitter

cpsm

  • Vim 7.4, compiled with the +python flag.

  • A C++ compiler supporting C++11.

  • Boost (Ubuntu: package libboost-all-dev).

  • CMake (Ubuntu: package cmake).

  • Python headers (Ubuntu: package python-dev).

  • Optional, required for Unicode support: ICU (Ubuntu: package libicu-dev).

Pyenv users on Mac OS X: cpsm requires dynamic Python libraries, which pyenv does not build by default. If CMake indicates that it's using static libraries, e.g.:

-- Found PythonLibs: /Users/<username>/.pyenv/versions/3.5.2/lib/python3.5/config-3.5m/libpython3.5m.a

Rebuild with dynamic library support by running env PYTHON_CONFIGURE_OPTS="--enable-framework" pyenv install <version>.

Python 3 Support: If your Vim is compiled against Python 3 instead (+python3 flag) the install script should detect this in most cases and everything should just work. You may need different python headers installed (e.g. python3-dev on Ubuntu).

If the detection does not work for any reason you can set PY3=ON or PY3=OFF as appropriate when running ./install.sh to override it.

https://github.com/nixprime/cpsm#requirements

fd

On Ubuntu ... and other Debian-based Linux distributions.

If you run Ubuntu 19.04 (Disco Dingo) or newer, you can install the officially maintained package:

sudo apt install fd-find

Note that the binary is called fdfind as the binary name fd is already used by another package. It is recommended that after installation, you add a link to fd by executing command ln -s $(which fdfind) ~/.local/bin/fd, in order to use fd in the same way as in this documentation. Make sure that $HOME/.local/bin is in your $PATH.

If you use an older version of Ubuntu, you can download the latest .deb package from the release page and install it via:

sudo dpkg -i fd_8.3.2_amd64.deb  # adapt version number and architecture

https://github.com/sharkdp/fd#on-ubuntu

wilder.nvim

https://github.com/gelguy/wilder.nvim#advanced-config-for-neovim-only-or-vim-with-yarp

nvim-bqf

https://github.com/kevinhwang91/nvim-bqf#requirements

vista.vim

I don't know the mimimal supported version. But if you only care about the ctags related feature, vim 7.4.1154+ should be enough. If you want to ctags to run asynchonously, Vim 8.0.27+ should be enough.

Otherwise, if you want to try any LSP related features, then you certainly need some plugins to retrive the LSP symbols, e.g., coc.nvim. When you have these LSP plugins set up, vista.vim should be ok to go as well.

In addition, if you want to search the symbols via fzf, you will have to install it first. Note that fzf 0.22.0 or above is required.

Vim 8

$ mkdir -p ~/.vim/pack/git-plugins/start
$ git clone https://github.com/liuchengxu/vista.vim.git --depth=1 ~/.vim/pack/git-plugins/start/vista.vim

NeoVim

$ mkdir -p ~/.local/share/nvim/site/pack/git-plugins/start
$ git clone https://github.com/liuchengxu/vista.vim.git --depth=1 ~/.local/share/nvim/site/pack/git-plugins/start/vista.vim

https://github.com/liuchengxu/vista.vim#requirement

🚀 Keyboard shortcuts

I moved the keyboard shortcuts section to a separate file, because it's a lot of information, you can find it in keyboard-shortcuts

🖥️ Windows version

The windows version is the old version of this configuration and this is its repository, it keeps most of the keyboard shortcuts, so you can use that configuration without any problem

⭐ Special mentions

  • Using ultisnips and CoC when you complete a snippet you can use the '' key to jump to the next field to complete

  • :diffget and :diffput can be abbreviated as do and dp respectively

🔥 How to keep it updated?

To obtain the latest features of our plugins and plugin managers, we will need to update them from time to time

In order to update the plugin manager that I use (in this case it would be "Plug") we will need to put this command in the console and execute it

:PlugUpgrade (each plugin manager may have a different way to update it)

Once an update is applied, I always recommend restarting nvim so that it does not throw errors if we continue to update something else. To update the plugins we are using (for example, coc, fugitive, ctrlp, nerdtree, etc) we will have to use this other command

:PlugUpdate

And finally to update the CoC extensions we are going to use the following command (as I mentioned above it is better to restart before executing it)

:CocUpdate

🧾 Credits

References that I used to create a hybrid of configs