Git Product home page Git Product logo

deorice's Introduction

deorice

dotfiles for *nix setup ricing

Lua Neovim

PS: For any interested readers, try to create your own configuration based on these dotfiles.

PS2: Some of these are related with neovim running under tmux.

PS3: The following is not intended to be gatekeeping how to use any of these tools. Its just a merge between a personal opinionated configuration and a tutorial for posterity.

Editors

vim

The config is pretty straight-forward: just edit the ~/.vimrc with vimscript/vimL syntax, place it in $HOME and next time you open vim it is already working. Search for the basics: the 7 vim modes, vimscript syntax, commands, etc. Read the errors and try to find the root cause. It's the best way to get out of future possible circles of the dependency hell.

neovim

Neovim adopts the ~/.config/nvim/init.vim or ~/.config/nvim/init.lua file as the default config file. It is also compatible with the vimrc; that explains the source. It means these are the files neovim uses for configuration lookups every time the editor starts.

This repository in specific migrates from the vimrc, used in vim, directly to the init.lua that uses the syntax of the language lua to program the editor. The runtime is the LuaJIT embedded in neovim and you can learn more in the docs.

To handle LSP, DAP, linters and formatters you can use mason-nvim. You can also integrate its functionality with lsp-zero into a not-bloated, fast gattai-mecha for completion.

To use the base configuration, run the playbooks, execute the scripts or do it manually:

  1. Clone this repository:
git clone [email protected]:deomorxsy/deorice.git
cd ./deorice/
  1. Copy nvim to the $HOME config dotfile:
cp -r ./.config/nvim/ ~/.config/
  1. Clone packer.
git clone --depth 1 https://github.com/wbthomason/packer.nvim \
 ~/.local/share/nvim/site/pack/packer/start/packer.nvim
  1. To avoid provider-related errors, specifically about python (ultisnips), you can use the script neovim-setup.sh, ./scripts/neovim-setup.sh, which sets up the python provider $PATH based in the hack path that python uses with the virtualenv, adapted from the docs ;)
cat > ./scripts/neovim-setup.sh << "EOF"
#!/usr/bin/sh
#
# packer plugin manager setup
git clone --depth 1 https://github.com/wbthomason/packer.nvim \
 ~/.local/share/nvim/site/pack/packer/start/packer.nvim

# setup python venv
python3 -m venv ~/.config/nvim/venv_nvim/neovim3

# source the venv activate binary
. ~/.config/nvim/venv_nvim/neovim3/bin/activate
python3 -m pip install --upgrade pynvim==0.5.0

# returns the relative $PATH of the python binary installed on the virtualenv
pyvm=$(which python)

# checks if the placeholder exists on file
roco=$(awk 'FNR==14 && $3==p3hp_placeholder' "$HOME/.config/nvim/init.lua")

# using @ as sed delimiter since the bash variable expansion already uses
# the slash "/" character for the path
[ -n "$roco" ] && sed -e "s@p3hp_placeholder@$pyvm@g" "$HOME/.config/nvim/init.lua"

# deactivate virtualenv
deactivate
EOF

chmod +x ./scripts/neovim-setup.sh
. ./scripts/neovim-setup.sh
  1. Set the python provider path
let g:python3_host_prog = "${HOME}/.config/nvim/venv_nvim/neovim3/bin/python"
  1. Source the packer.lua file to finish installing packer. Then, also in command line, synchronize plugins in the configuration with packer. I like the headless flag for this, otherwise just open the specific packer.lua file for sourcing, enter Terminal Mode and type :so. Synchronize with PackerSync in any context.
nvim --headless -c 'so' -c 'PackerSync' "${HOME}/.config/nvim/lua/user/packer.lua"

Main plugins used in this vim/neovim rice, not ordered:

  • telescope or chadtree for fuzzy search. The second is a whole completion client spawning sqlite vms in memory and integrating with other external programs;
  • nvim-R to run a R interpreter inside neovim (checkout the tmux integration);
  • vimtex for latex local editions;
  • lsp-zero as a Language Server Protocols manager (literally acts as a package manager), which are external to neovim;
  • mason.nvim as a package manager for LSP servers, DAP servers, linters, and formatters;
  • nvim-treesitter to parse all the code in the editor. It builds an incremental parsing tree that is useful for a bunch of tasks related to programming language constructs, like highlighting, indenting, folding of these constructs, text-object manipulation and others. Also fast af;
  • presence.nvim is a cool way to understand how activity logic SDKs such as discord presence works, and also lua dotfile config for other apps.
  • pio for espressif development. Install it also on the virtualenv, use it inside nvim or source outside while multiplexing with tmux. Also check xtensa-qemetsu for a CI/CD, qemu-based environment setup.

deorice's People

Contributors

deomorxsy avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.