pojokcodeid.nvim-lazy/README.md
asep komarudin 7ec02abae7 update
2023-02-24 23:09:05 +07:00

13 KiB

Nvim-Lazy

Neovim Lua

HOME

home!

Plugins Manager

PlugManaget!

Layout

PlugManaget!

PHP

LARAVEL!

Panduan Install Dan Konfigurasi NeoVim

Daftar Isi

Penjelsan Lebih Detail Silahkan Kunjungi Wiki

Kebutuhan Dasar

  1. Install Neovim 8.0+ https://github.com/neovim/neovim/releases/tag/v0.8.2
  2. C++ (windows) Compiler https://www.msys2.org/
  3. GIT https://git-scm.com/download/win
  4. NodeJs https://nodejs.org/en/
  5. Ripgrep https://github.com/BurntSushi/ripgrep
  6. Lazygit https://github.com/jesseduffield/lazygit
  7. Nerd Font https://github.com/ryanoasis/nerd-fonts
  8. Windows Terminal (Windows) https://apps.microsoft.com/store/detail/windows-terminal/9N0DX20HK701?hl=en-id&gl=id
  9. Powershell (windows) https://apps.microsoft.com/store/detail/powershell/9MZ1SNWT0N5D?hl=en-id&gl=id

Panduan Windows

  • Pastikan sudah menginstall kebutuhan dasar diatas
  • Jalankan Script Dibawah pada Powershell
git clone https://github.com/pojokcodeid/nvim-lazy-basic.git "$env:LOCALAPPDATA\nvim"
nvim

Panduan Linux Debian Based

  1. Pastikan Acess Administrator
visudo
[nama user] ALL=(ALL:ALL) ALL
[nama user] ALL=(ALL) NOPASSWD:ALL
  1. Install Neovim
sudo apt-get install wget
mkdir download
cd download
wget https://github.com/neovim/neovim/releases/download/v0.8.1/nvim-linux64.deb
sudo apt-get install ./nvim-linux64.deb
nvim --version
  1. Check G++
g++ --version
  1. Install NodeJS
sudo apt-get install curl
sudo apt install build-essential libssl-dev
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.35.3/install.sh | bash
source ~/.bashrc
nvm install 18.13.0
node --version
npm --version
  1. Install unzip, ripgrep
sudo apt-get install unzip
sudo apt-get install ripgrep
  1. Install lazygit
LAZYGIT_VERSION=$(curl -s "https://api.github.com/repos/jesseduffield/lazygit/releases/latest" | grep '"tag_name":' |  sed -E 's/.*"v*([^"]+)".*/\1/')
curl -Lo lazygit.tar.gz "https://github.com/jesseduffield/lazygit/releases/latest/download/lazygit_${LAZYGIT_VERSION}_Linux_x86_64.tar.gz"
sudo tar xf lazygit.tar.gz -C /usr/local/bin lazygit
lazygit --version
  1. Install Git
sudo apt-get install git
git --version
  1. Clone Config
git clone https://github.com/pojokcodeid/nvim-lazy-basic.git ~/.config/nvim

Configurasi

  • Struktur File
  .
  ├── init.lua                    * Ini pintu masuk config
  ├── lazy-lock.json              * Ini file generate dari lazy.nvim
  ├── lua
  │   ├── custom
  │   │   ├── dashboard.lua       * Ini untuk custom dashboard
  │   │   ├── format_onsave.lua   * Ini untuk custom format ketika save
  │   │   ├── lsp_installer.lua   * Ini untuk config LSP tidak support mason
  │   │   ├── null-ls.lua         * Ini untuk config linter dan formatter
  │   │   └── register_lsp.lua    * Ini untuk registrasi LSP install dari mason
  │   ├── default
  │   │   ├── autocommands.lua    * Ini untuk custom auto command
  │   │   ├── init.lua            * Ini pintu masuk untuk semua config
  │   │   ├── keymaps.lua         * Ini untuk custom keymaps
  │   │   ├── lazy.lua            * Ini config plugins manager (jangan diubah)
  │   │   └── options.lua         * Ini untuk custom config default neovim
  │   └── plugin
  │       ├── dapui.lua           * Ini contoh plugin
  │       ├── init.lua            * Ini untuk menambah, disable dan overide plugins
  │       └── lualine.lua         * Ini contoh plugin

KeyMap

  • leader = space bar
  • n = normal mode
  • i = insert mode
  • v = visual mode
Mode Key Keterangan
n leader Membuka Wich Key
n leader + / Comment String
n leader + a Alpha dashboard
n leader + b Buffer
n leader + c Close Buffer
n leader + e Exploler (Nvim Tree)
n leader + e Exploler (Nvim Tree)
n leader + F Pencarian Text
n leader + f Pencarian File
n leader + h Tidak ada hilight
n leader + o Symbol Outline
n leader + q Keluar Neovim
n leader + w Simpan File
n leader + g git
n leader + l LSP
n leader + p Plugin (Lazy)
n leader + r Run Program
n leader + s Pencarian
n leader + t Terminal
v leader + / Comment Blok String
i ctrl + l Live Server

Config LSP

  • Jalankan dengan commond mode
:MasonInstall html-lsp css-lsp typescript-language-server

Comfig Treesitter

  • Jalankan Code Berikut pada command
:TSInstall html css javascript ..... dst

Ubah Dashboard

Cari File lua/custom/dashboard.lua

  • Edit Bagian ini
M.dashboard = {
	[[                               __                ]],
	[[  ___     ___    ___   __  __ /\_\    ___ ___    ]],
	[[ / _ `\  / __`\ / __`\/\ \/\ \\/\ \  / __` __`\  ]],
	[[/\ \/\ \/\  __//\ \_\ \ \ \_/ |\ \ \/\ \/\ \/\ \ ]],
	[[\ \_\ \_\ \____\ \____/\ \___/  \ \_\ \_\ \_\ \_\]],
	[[ \/_/\/_/\/____/\/___/  \/__/    \/_/\/_/\/_/\/_/]],
}

Custom Null-ls

cari file lua/custom/null-ls.lua

  • tambahkan pada bagian berikut
local m = {
	sources = {
		formatting.stylua, -- tambahkan di bawah sini
		diagnostics.flake8, -- tambahkan di bawah sini
	},
}

Register LSP

Cari file lua/custom/register_lsp.lua

  • ini dilakukan jika LSP tidak terbaca
local m = {
	lspreg = {
		"yamlls",
		"jdtls",
		"intelephense",
		"marksman",
		"csharp_ls",
		"clangd",
		"dartls",
		"kotlin_language_server",
		-- tambahkan di bawah sini setelah melakukan :masoninstall
	},
}

Whichkey

cari file lua/custom/whichkey.lua

-- file ini digunakan untuk registrasi key mapping

["k"] = {
	name = "Example",
	k = { '<cmd>lua print("Testing")<cr>', "Example" },
},

Format On Save

cari file lua/custom/format_onsave.lua

  • lakukan enable atau disable
local M = {
	disable = 0, -- 0 ( format jalan)  1 (fromat off)
}

Custom Autocommand

cari file lua/default/autocommand.lua

  • Lakukan config sesuai kebutuhan

Cutom Default Option

cari file lua/default/options.lua

-- custom oprion disini

vim.g.mapleader = " "
vim.g.maplocalleader = " "

local opt = vim.opt
opt.cmdheight = 0

Custom Key Mapping

cari file lua/dafault/keymaps.lua

-- custom key maps disini
local function map(mode, l, r, desc)
	vim.keymap.set(mode, l, r, { desc = desc })
end
-- ini adalah contoh
map("n", "]h", '<cmd>lua print("Testing")<cr>', "Testing Mapping")

Custom Plugins

cari file lua/plugin/*

  • masukan semua plugin pada folder tersebut
  • disable plugins
{ "folke/trouble.nvim", enabled = false }, -- ini untuk disable plugin
  • tambah plugins
{"nvim-treesitter/nvim-treesitter"},

untuk panduan silahkan cek
https://github.com/folke/lazy.nvim#Examples

Custom-Snippets

Cari File nvim/my-snippet/package.json

  • tambahkan custom snippets pada bagian berikut
"contributes": {
  "snippets": [
    {
      "language": "html",
      "path": "./html/snippets/javascript.json"
    },
    {
      "language": "html",
      "path": "./html/javascript/javascript.json"
    },
  ]
}

Seting Bahasa Pemprograman

List Plugins

LinkKeterangan
https://github.com/folke/lazy.nvimLazy
https://github.com/nvim-lua/plenary.nvimPlenary
https://github.com/windwp/nvim-autopairsNvim-Autopairs
https://github.com/numToStr/Comment.nvimComment.nvim
https://github.com/JoosepAlviste/nvim-ts-context-commentstringnvim-ts-context-commentstring
https://github.com/nvim-tree/nvim-web-deviconsnvim-web-devicons
https://github.com/nvim-tree/nvim-tree.luanvim-tree.lua
https://github.com/akinsho/bufferline.nvimbufferline.nvim
https://github.com/moll/vim-bbyevim-bbye
https://github.com/akinsho/toggleterm.nvimtoggleterm.nvim
https://github.com/lewis6991/impatient.nvimimpatient.nvim
https://github.com/lukas-reineke/indent-blankline.nvimindent-blankline.nvim
https://github.com/goolord/alpha-nvimalpha-nvim
https://github.com/folke/which-key.nvimwhich-key.nvim
https://github.com/folke/tokyonight.nvimtokyonight.nvim
https://github.com/hrsh7th/nvim-cmpnvim-cmp
https://github.com/hrsh7th/cmp-buffercmp-buffer
https://github.com/nvim-treesitter/nvim-treesitternvim-treesitter
https://github.com/L3MON4D3/LuaSnipLuaSnip
https://github.com/windwp/nvim-autopairsnvim-autopairs
https://github.com/hrsh7th/cmp-nvim-luacmp-nvim-lua
https://github.com/neovim/nvim-lspconfignvim-lspconfig
https://github.com/williamboman/mason-lspconfig.nvimmason-lspconfig.nvim
https://github.com/williamboman/mason.nvimwilliamboman/mason.nvim
https://github.com/jose-elias-alvarez/null-ls.nvimnull-ls.nvim
https://github.com/jayp0521/mason-null-ls.nvimmason-null-ls.nvim

key lazygit

Key Lazygit

Terima Kasih

https://github.com/LunarVim/Neovim-from-scratch
https://github.com/AstroNvim/AstroNvim