Coder Social home page Coder Social logo

dot-nvim's Introduction

Neovim Setup

Neovim 0.5.0+ New Features

  • all the IDE-like goodies:
  • LSP completion, go to def, hover and rename
  • treesitter syntax highlighting
  • ctrlp-like fuzzy finding
  • embedded terminals

Reference

Installation

Install Dependency Packages

# MacOS
brew install --HEAD tree-sitter luajit neovim fzf fd

# Archlinux
sudo pacman -S tree-sitter luajit neovim fzf fd
Install nvim-lspconfig

reference: https://github.com/neovim/nvim-lspconfig

Install nvim-lsp-installer

reference: https://github.com/williamboman/nvim-lsp-installer

Getting Started with Lua-Based Neovim config

Benefits

  • Lua is a much nicer language
  • More modular
  • Easier to customize
  • Easier to configure lua plugins

Lua Keybings

Set using vim.api.nvim_set_keymap({mode}, {keymap}, {mapped to}, {options})

Example
" Ctrl-s to Save
nmap <c-s> :w<CR>
imap <C-s> <Esc>:w<CR>a

" Ctrl+hjkl to navigate splits
nnoremap <c-h> <c-w>h
nnoremap <c-j> <c-w>j
nnoremap <c-k> <c-w>k
nnoremap <c-l> <c-w>l

Now converted to

local keymap = vim.api.nvim_set_keymap
keymap('n', '<c-s>', ':w<CR>', {})
keymap('i', '<c-s>', ':<Esc>:w<CR>a', {})

local opts = {noremap = true}
keymap('n', '<c-h>', '<c-w>h', opts)
keymap('n', '<c-j>', '<c-w>j', opts)
keymap('n', '<c-k>', '<c-w>k', opts)
keymap('n', '<c-l>', '<c-w>l', opts)

Package Management

Use Packer as the default plugin manager

In Archlinux, we can install from AUR: yay -S nvim-packer-git

Start with having packer manage itself:

require('packer').startup(function()
  use 'wbthomason/packer.nvim'
  -- add other use ... for other packages
end)

Then we can run :PackerSync which will download/install the list of defined plugins

Plugins

Core

Lua Native

  • lualine - a blazing fast and easy to configure Neovim statusline written in Lua

Editing Addons

Prerequisite:

  • nodejs
  • npm
  • yarn
# Install yarn
sudo npm i -g yarn

LSP Addons

# gopls
go install golang.org/x/tools/gopls@latest
# golangci-lint
go install github.com/golangci/golangci-lint/cmd/golangci-lint@lastet

Formatter Addons

# go formatter (comes with the go binary)
sudo pacman -S go
# lua formatter
sudo pacman -S stylua
# shell script formatter
sudo pacman -S shfmt
# ctags
sudo pacman -S ctags
# typescript, javascript, markdown, JSON formatter
sudo npm install -g prettier
# yamlfmt
pip3 install yamlfmt
# python formatter
sudo pacman -S python-black
# ruby formatter (required PATH setup)
gem install rubocop
# terragrunt(terraform) formatter (comes with terragrunt/terraform)
sudo pacman -S terraform terragrunt

Extra Addons

dot-nvim's People

Contributors

miooochi avatar

Watchers

 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.