mirror of
https://github.com/pojokcodeid/nvim-lazy.git
synced 2025-06-21 00:25:47 +02:00
Add files via upload
This commit is contained in:
commit
e53a643e3d
54 changed files with 5285 additions and 0 deletions
BIN
img/Spring_boot_code.jpeg
Normal file
BIN
img/Spring_boot_code.jpeg
Normal file
Binary file not shown.
After Width: | Height: | Size: 70 KiB |
BIN
img/home.png
Normal file
BIN
img/home.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 22 KiB |
BIN
img/laravel.jpeg
Normal file
BIN
img/laravel.jpeg
Normal file
Binary file not shown.
After Width: | Height: | Size: 133 KiB |
BIN
img/terminal_spring_boot.jpeg
Normal file
BIN
img/terminal_spring_boot.jpeg
Normal file
Binary file not shown.
After Width: | Height: | Size: 141 KiB |
16
init.lua
Normal file
16
init.lua
Normal file
|
@ -0,0 +1,16 @@
|
|||
local onsave = true
|
||||
require("user.options")
|
||||
require("config.lazy")
|
||||
require("user.keymaps")
|
||||
require("user.autocommands")
|
||||
require("user.colorscheme")
|
||||
require("user.snip")
|
||||
if onsave then
|
||||
require("user.format_onsave")
|
||||
end
|
||||
|
||||
-- dipindah ke plugins
|
||||
-- require("user.lualine")
|
||||
-- require("user.bufferline")
|
||||
-- require("user.cmp")
|
||||
-- require("user.lsp")
|
59
lazy-lock.json
Normal file
59
lazy-lock.json
Normal file
|
@ -0,0 +1,59 @@
|
|||
{
|
||||
"Comment.nvim": { "branch": "master", "commit": "97a188a98b5a3a6f9b1b850799ac078faa17ab67" },
|
||||
"LuaSnip": { "branch": "master", "commit": "563827f00bb4fe43269e3be653deabc0005f1302" },
|
||||
"alpha-nvim": { "branch": "main", "commit": "0bb6fc0646bcd1cdb4639737a1cee8d6e08bcc31" },
|
||||
"bufdelete.nvim": { "branch": "master", "commit": "f79e9d186b42fba5f1b1362006e7c70240db97a4" },
|
||||
"bufferline.nvim": { "branch": "main", "commit": "83bf4dc7bff642e145c8b4547aa596803a8b4dc4" },
|
||||
"cmp-buffer": { "branch": "main", "commit": "3022dbc9166796b644a841a02de8dd1cc1d311fa" },
|
||||
"cmp-nvim-lsp": { "branch": "main", "commit": "59224771f91b86d1de12570b4070fe4ad7cd1eeb" },
|
||||
"cmp-nvim-lua": { "branch": "main", "commit": "d276254e7198ab7d00f117e88e223b4bd8c02d21" },
|
||||
"cmp-path": { "branch": "main", "commit": "91ff86cd9c29299a64f968ebb45846c485725f23" },
|
||||
"cmp_luasnip": { "branch": "master", "commit": "18095520391186d634a0045dacaa346291096566" },
|
||||
"code_runner.nvim": { "branch": "main", "commit": "00d3b82cc4ff0a1e0eabd09bbf125d95490d216f" },
|
||||
"dressing.nvim": { "branch": "master", "commit": "4436d6f41e2f6b8ada57588acd1a9f8b3d21453c" },
|
||||
"friendly-snippets": { "branch": "main", "commit": "7ab483b355613ef4f74189c7789278d765724d12" },
|
||||
"gitsigns.nvim": { "branch": "main", "commit": "2c6f96dda47e55fa07052ce2e2141e8367cbaaf2" },
|
||||
"impatient.nvim": { "branch": "main", "commit": "b842e16ecc1a700f62adb9802f8355b99b52a5a6" },
|
||||
"indent-blankline.nvim": { "branch": "master", "commit": "db7cbcb40cc00fc5d6074d7569fb37197705e7f6" },
|
||||
"lazy.nvim": { "branch": "main", "commit": "0d0d5870a3265f1c92a89dccef4a592c44e70179" },
|
||||
"live-server": { "branch": "main", "commit": "ecd7c1418823b65dd2bca710587c80afe42c973e" },
|
||||
"lualine.nvim": { "branch": "master", "commit": "a52f078026b27694d2290e34efa61a6e4a690621" },
|
||||
"mason-lspconfig.nvim": { "branch": "main", "commit": "43c7f402cb9822b61b5dc05bf0b385928df256a6" },
|
||||
"mason-null-ls.nvim": { "branch": "main", "commit": "07335008824788725bfa2095e18ddbb527002d63" },
|
||||
"mason.nvim": { "branch": "main", "commit": "c2002d7a6b5a72ba02388548cfaf420b864fbc12" },
|
||||
"mini.ai": { "branch": "main", "commit": "14a1382372195573c6c7f494ab8bb298b03e6f04" },
|
||||
"mini.comment": { "branch": "main", "commit": "e5294cc3e75bafb2369f235d31a98b01a9cc67ad" },
|
||||
"mini.pairs": { "branch": "main", "commit": "fec9aba50912d8c3d92d07d6a77952de84f8d7ad" },
|
||||
"mini.surround": { "branch": "main", "commit": "df41f1c009afbb3eef39d979977fb14404576f9b" },
|
||||
"neoscroll.nvim": { "branch": "master", "commit": "54c5c419f6ee2b35557b3a6a7d631724234ba97a" },
|
||||
"null-ls.nvim": { "branch": "main", "commit": "c0c19f32b614b3921e17886c541c13a72748d450" },
|
||||
"nvim-autopairs": { "branch": "master", "commit": "4fc96c8f3df89b6d23e5092d31c866c53a346347" },
|
||||
"nvim-cmp": { "branch": "main", "commit": "983453e32cb35533a119725883c04436d16c0120" },
|
||||
"nvim-colorizer.lua": { "branch": "master", "commit": "760e27df4dd966607e8fb7fd8b6b93e3c7d2e193" },
|
||||
"nvim-lsp-installer": { "branch": "main", "commit": "17e0bfa5f2c8854d1636fcd036dc8284db136baa" },
|
||||
"nvim-lspconfig": { "branch": "master", "commit": "f11fdff7e8b5b415e5ef1837bdcdd37ea6764dda" },
|
||||
"nvim-navic": { "branch": "master", "commit": "7a2b823152fe4de65ee7925b0e32d26ed73bc57c" },
|
||||
"nvim-notify": { "branch": "master", "commit": "b005821516f1f37801a73067afd1cef2dbc4dfe8" },
|
||||
"nvim-scrollview": { "branch": "main", "commit": "ba6c48bf7919dd48a371e7b9c683b8858053e885" },
|
||||
"nvim-tree.lua": { "branch": "master", "commit": "7282f7de8aedf861fe0162a559fc2b214383c51c" },
|
||||
"nvim-treesitter": { "branch": "master", "commit": "69388e84c34d40c3d5c7d2f310db13276f2179e1" },
|
||||
"nvim-treesitter-textobjects": { "branch": "master", "commit": "a8c86f48c1030acee22b9e071e3c531de77bf253" },
|
||||
"nvim-ts-autotag": { "branch": "main", "commit": "fdefe46c6807441460f11f11a167a2baf8e4534b" },
|
||||
"nvim-ts-context-commentstring": { "branch": "main", "commit": "4a42b30376c1bd625ab5016c2079631d531d797a" },
|
||||
"nvim-ts-rainbow": { "branch": "master", "commit": "ef95c15a935f97c65a80e48e12fe72d49aacf9b9" },
|
||||
"nvim-web-devicons": { "branch": "master", "commit": "563f3635c2d8a7be7933b9e547f7c178ba0d4352" },
|
||||
"plenary.nvim": { "branch": "master", "commit": "4b7e52044bbb84242158d977a50c4cbcd85070c7" },
|
||||
"project.nvim": { "branch": "main", "commit": "628de7e433dd503e782831fe150bb750e56e55d6" },
|
||||
"smart-splits.nvim": { "branch": "master", "commit": "fdd158ce7554dc830fb86e0fe952cd9476cdf726" },
|
||||
"telescope.nvim": { "branch": "master", "commit": "76ea9a898d3307244dce3573392dcf2cc38f340f" },
|
||||
"todo-comments.nvim": { "branch": "main", "commit": "077c59586d9d0726b0696dc5680eb863f4e04bc5" },
|
||||
"toggleterm.nvim": { "branch": "main", "commit": "2a787c426ef00cb3488c11b14f5dcf892bbd0bda" },
|
||||
"tokyonight.nvim": { "branch": "main", "commit": "def91651c41f6d1d43ebcb50763324d35331baee" },
|
||||
"vim-bbye": { "branch": "master", "commit": "25ef93ac5a87526111f43e5110675032dbcacf56" },
|
||||
"vim-illuminate": { "branch": "master", "commit": "a2e8476af3f3e993bb0d6477438aad3096512e42" },
|
||||
"vim-startuptime": { "branch": "master", "commit": "5f52ed26e0296a3e1d1453935f417e5808eefab8" },
|
||||
"vim-visual-multi": { "branch": "master", "commit": "1c9207b28c8898ab01b54e6d6b61b0b820a814bc" },
|
||||
"which-key.nvim": { "branch": "main", "commit": "16ed12a8493628c377606da2ebac50d80736ed37" },
|
||||
"wilder.nvim": { "branch": "master", "commit": "679f348dc90d80ff9ba0e7c470c40a4d038dcecf" },
|
||||
"yanky.nvim": { "branch": "main", "commit": "57380fe70758dae6aeac5a304a0b28b3cff3cb5c" }
|
||||
}
|
37
lua/config/lazy.lua
Normal file
37
lua/config/lazy.lua
Normal file
|
@ -0,0 +1,37 @@
|
|||
local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim"
|
||||
if not vim.loop.fs_stat(lazypath) then
|
||||
-- bootstrap lazy.nvim
|
||||
-- stylua: ignore
|
||||
vim.fn.system({ "git", "clone", "--filter=blob:none", "https://github.com/folke/lazy.nvim.git", "--branch=stable", lazypath })
|
||||
end
|
||||
vim.opt.rtp:prepend(vim.env.LAZY or lazypath)
|
||||
vim.g.mapleader=' '
|
||||
vim.g.maplocalleader=' '
|
||||
require("lazy").setup({
|
||||
spec = {
|
||||
{
|
||||
import = "plugins",
|
||||
},
|
||||
},
|
||||
defaults = {
|
||||
lazy = true, -- every plugin is lazy-loaded by default
|
||||
version = "*", -- try installing the latest stable version for plugins that support semver
|
||||
},
|
||||
checker = { enabled = true }, -- automatically check for plugin updates
|
||||
performance = {
|
||||
rtp = {
|
||||
-- disable some rtp plugins
|
||||
disabled_plugins = {
|
||||
"gzip",
|
||||
"matchit",
|
||||
"matchparen",
|
||||
"netrwPlugin",
|
||||
"tarPlugin",
|
||||
"tohtml",
|
||||
"tutor",
|
||||
"zipPlugin",
|
||||
"lazyredraw",
|
||||
},
|
||||
},
|
||||
},
|
||||
})
|
123
lua/plugins/coding.lua
Normal file
123
lua/plugins/coding.lua
Normal file
|
@ -0,0 +1,123 @@
|
|||
return {
|
||||
-- snippets
|
||||
{
|
||||
"L3MON4D3/LuaSnip",
|
||||
dependencies = {
|
||||
"rafamadriz/friendly-snippets",
|
||||
config = function()
|
||||
require("luasnip.loaders.from_vscode").lazy_load()
|
||||
end,
|
||||
},
|
||||
opts = {
|
||||
history = true,
|
||||
delete_check_events = "TextChanged",
|
||||
},
|
||||
-- stylua: ignore
|
||||
keys = {
|
||||
{
|
||||
"<tab>",
|
||||
function()
|
||||
return require("luasnip").jumpable(1) and "<Plug>luasnip-jump-next" or "<tab>"
|
||||
end,
|
||||
expr = true, silent = true, mode = "i",
|
||||
},
|
||||
{ "<tab>", function() require("luasnip").jump(1) end, mode = "s" },
|
||||
{ "<s-tab>", function() require("luasnip").jump(-1) end, mode = { "i", "s" } },
|
||||
},
|
||||
},
|
||||
|
||||
-- auto completion
|
||||
{
|
||||
"hrsh7th/nvim-cmp",
|
||||
event = "InsertEnter",
|
||||
dependencies = {
|
||||
"hrsh7th/cmp-nvim-lsp",
|
||||
"hrsh7th/cmp-buffer",
|
||||
"hrsh7th/cmp-path",
|
||||
"saadparwaiz1/cmp_luasnip",
|
||||
},
|
||||
},
|
||||
|
||||
-- auto pairs
|
||||
{
|
||||
"echasnovski/mini.pairs",
|
||||
event = "VeryLazy",
|
||||
config = function(_, opts)
|
||||
require("mini.pairs").setup(opts)
|
||||
end,
|
||||
},
|
||||
|
||||
-- surround
|
||||
{
|
||||
"echasnovski/mini.surround",
|
||||
keys = { "gz" },
|
||||
opts = {
|
||||
mappings = {
|
||||
add = "gza", -- Add surrounding in Normal and Visual modes
|
||||
delete = "gzd", -- Delete surrounding
|
||||
find = "gzf", -- Find surrounding (to the right)
|
||||
find_left = "gzF", -- Find surrounding (to the left)
|
||||
highlight = "gzh", -- Highlight surrounding
|
||||
replace = "gzr", -- Replace surrounding
|
||||
update_n_lines = "gzn", -- Update `n_lines`
|
||||
},
|
||||
},
|
||||
config = function(_, opts)
|
||||
-- use gz mappings instead of s to prevent conflict with leap
|
||||
require("mini.surround").setup(opts)
|
||||
end,
|
||||
},
|
||||
|
||||
-- comments
|
||||
{ "JoosepAlviste/nvim-ts-context-commentstring" },
|
||||
{
|
||||
"echasnovski/mini.comment",
|
||||
event = "VeryLazy",
|
||||
opts = {
|
||||
hooks = {
|
||||
pre = function()
|
||||
require("ts_context_commentstring.internal").update_commentstring({})
|
||||
end,
|
||||
},
|
||||
},
|
||||
config = function(_, opts)
|
||||
require("mini.comment").setup(opts)
|
||||
end,
|
||||
},
|
||||
|
||||
-- better text-objects
|
||||
{
|
||||
"echasnovski/mini.ai",
|
||||
keys = {
|
||||
{ "a", mode = { "x", "o" } },
|
||||
{ "i", mode = { "x", "o" } },
|
||||
},
|
||||
dependencies = {
|
||||
{
|
||||
"nvim-treesitter/nvim-treesitter-textobjects",
|
||||
init = function()
|
||||
-- no need to load the plugin, since we only need its queries
|
||||
require("lazy.core.loader").disable_rtp_plugin("nvim-treesitter-textobjects")
|
||||
end,
|
||||
},
|
||||
},
|
||||
opts = function()
|
||||
local ai = require("mini.ai")
|
||||
return {
|
||||
n_lines = 500,
|
||||
custom_textobjects = {
|
||||
o = ai.gen_spec.treesitter({
|
||||
a = { "@block.outer", "@conditional.outer", "@loop.outer" },
|
||||
i = { "@block.inner", "@conditional.inner", "@loop.inner" },
|
||||
}, {}),
|
||||
f = ai.gen_spec.treesitter({ a = "@function.outer", i = "@function.inner" }, {}),
|
||||
c = ai.gen_spec.treesitter({ a = "@class.outer", i = "@class.inner" }, {}),
|
||||
},
|
||||
}
|
||||
end,
|
||||
config = function(_, opts)
|
||||
local ai = require("mini.ai")
|
||||
ai.setup(opts)
|
||||
end,
|
||||
},
|
||||
}
|
278
lua/plugins/init.lua
Normal file
278
lua/plugins/init.lua
Normal file
|
@ -0,0 +1,278 @@
|
|||
return {
|
||||
-- the colorscheme should be available when starting Neovim
|
||||
{
|
||||
"nvim-lua/plenary.nvim",
|
||||
commit = "4b7e52044bbb84242158d977a50c4cbcd85070c7",
|
||||
event = "BufWinEnter",
|
||||
module = "plenary",
|
||||
},
|
||||
{
|
||||
"folke/tokyonight.nvim",
|
||||
lazy = false, -- make sure we load this during startup if it is your main colorscheme
|
||||
priority = 1000, -- make sure to load this before all the other start plugins
|
||||
},
|
||||
{
|
||||
"goolord/alpha-nvim",
|
||||
commit = "0bb6fc0646bcd1cdb4639737a1cee8d6e08bcc31",
|
||||
module = "alpha",
|
||||
event = "BufWinEnter",
|
||||
config = function()
|
||||
require("user.alpha")
|
||||
end,
|
||||
},
|
||||
{
|
||||
"nvim-lualine/lualine.nvim",
|
||||
commit = "a52f078026b27694d2290e34efa61a6e4a690621",
|
||||
require = { "kyazdani42/nvim-web-devicons", opt = true },
|
||||
event = "BufWinEnter",
|
||||
opts=function()
|
||||
require("user.lualine")
|
||||
end,
|
||||
},
|
||||
{"rafamadriz/friendly-snippets"},
|
||||
{"hrsh7th/nvim-cmp",
|
||||
dependencies ="rafamadriz/friendly-snippets",
|
||||
opts=function()
|
||||
require("user.cmp")
|
||||
end,
|
||||
},
|
||||
{
|
||||
"windwp/nvim-autopairs",
|
||||
commit = "4fc96c8f3df89b6d23e5092d31c866c53a346347",
|
||||
dependencies = "hrsh7th/nvim-cmp",
|
||||
event="VeryLazy",
|
||||
init = function()
|
||||
require("user.autopairs")
|
||||
end,
|
||||
},
|
||||
{
|
||||
"numToStr/Comment.nvim",
|
||||
commit = "97a188a98b5a3a6f9b1b850799ac078faa17ab67",
|
||||
event = "BufReadPost",
|
||||
init = function()
|
||||
require("user.comment")
|
||||
end,
|
||||
},
|
||||
-- include treesitter
|
||||
require("plugins.treesitter")
|
||||
,{
|
||||
"kyazdani42/nvim-web-devicons",
|
||||
commit = "563f3635c2d8a7be7933b9e547f7c178ba0d4352",
|
||||
init = function()
|
||||
require("user.webdevicons")
|
||||
end,
|
||||
},
|
||||
{
|
||||
"kyazdani42/nvim-tree.lua",
|
||||
commit = "7282f7de8aedf861fe0162a559fc2b214383c51c",
|
||||
cmd = "NvimTreeToggle",
|
||||
dependencies = "kyazdani42/nvim-web-devicons",
|
||||
init = function()
|
||||
require("user.nvim-tree")
|
||||
end,
|
||||
},
|
||||
{
|
||||
"akinsho/bufferline.nvim",
|
||||
commit = "83bf4dc7bff642e145c8b4547aa596803a8b4dc4",
|
||||
dependencies = {"kyazdani42/nvim-web-devicons","famiu/bufdelete.nvim"},
|
||||
event = "VeryLazy",
|
||||
config=function()
|
||||
require("user.bufferline")
|
||||
end,
|
||||
},
|
||||
{ "moll/vim-bbye", commit = "25ef93ac5a87526111f43e5110675032dbcacf56" },
|
||||
{
|
||||
"akinsho/toggleterm.nvim",
|
||||
commit = "2a787c426ef00cb3488c11b14f5dcf892bbd0bda",
|
||||
cmd = "Toggleterm",
|
||||
event = "BufWinEnter",
|
||||
init = function()
|
||||
require("user.toggleterm")
|
||||
end,
|
||||
},
|
||||
{ "ahmedkhalf/project.nvim", commit = "628de7e433dd503e782831fe150bb750e56e55d6" },
|
||||
{
|
||||
"lewis6991/impatient.nvim",
|
||||
commit = "b842e16ecc1a700f62adb9802f8355b99b52a5a6",
|
||||
init = function()
|
||||
require("user.impatient")
|
||||
end,
|
||||
},
|
||||
{
|
||||
"lukas-reineke/indent-blankline.nvim",
|
||||
commit = "db7cbcb40cc00fc5d6074d7569fb37197705e7f6",
|
||||
event = "BufRead",
|
||||
init = function()
|
||||
require("user.indentline")
|
||||
end,
|
||||
},
|
||||
{
|
||||
"folke/which-key.nvim",
|
||||
event = "BufWinEnter",
|
||||
init = function()
|
||||
require("user.whichkey")
|
||||
end,
|
||||
},
|
||||
-- start programming
|
||||
{ "hrsh7th/cmp-buffer", commit = "3022dbc9166796b644a841a02de8dd1cc1d311fa", dependencies = "hrsh7th/nvim-cmp"},
|
||||
{ "hrsh7th/cmp-nvim-lua", commit = "d276254e7198ab7d00f117e88e223b4bd8c02d21", dependencies = "hrsh7th/nvim-cmp" },
|
||||
{
|
||||
"neovim/nvim-lspconfig",
|
||||
commit = "f11fdff7e8b5b415e5ef1837bdcdd37ea6764dda",
|
||||
event = "BufWinEnter",
|
||||
init = function()
|
||||
require("user.lsp")
|
||||
end,
|
||||
},
|
||||
{
|
||||
"williamboman/mason.nvim",
|
||||
commit = "c2002d7a6b5a72ba02388548cfaf420b864fbc12",
|
||||
cmd = {
|
||||
"Mason",
|
||||
"MasonInstall",
|
||||
"MasonUninstall",
|
||||
"MasonUninstallAll",
|
||||
"MasonLog",
|
||||
},
|
||||
dependencies={"williamboman/mason-lspconfig.nvim"},
|
||||
init = function()
|
||||
vim.tbl_map(function(plugin)
|
||||
pcall(require, plugin)
|
||||
end, { "lspconfig", "null-ls" })
|
||||
end,
|
||||
},
|
||||
{ "jose-elias-alvarez/null-ls.nvim", commit = "c0c19f32b614b3921e17886c541c13a72748d450" },
|
||||
{ "RRethy/vim-illuminate", commit = "a2e8476af3f3e993bb0d6477438aad3096512e42" },
|
||||
-- include for coding
|
||||
require "plugins.coding"
|
||||
|
||||
-- extra plugins
|
||||
,{
|
||||
"nvim-telescope/telescope.nvim",
|
||||
commit = "76ea9a898d3307244dce3573392dcf2cc38f340f",
|
||||
dependencies = { { "nvim-lua/plenary.nvim" } },
|
||||
cmd = "Telescope",
|
||||
init = function()
|
||||
require("user.telescope")
|
||||
end,
|
||||
},
|
||||
{ "manzeloth/live-server", cmd={"LiveServer"} },
|
||||
{ "mg979/vim-visual-multi", event = "BufWinEnter" },
|
||||
{
|
||||
"windwp/nvim-ts-autotag",
|
||||
dependencies = "nvim-treesitter",
|
||||
init=function()
|
||||
require('nvim-ts-autotag').setup()
|
||||
end,
|
||||
},
|
||||
{
|
||||
"CRAG666/code_runner.nvim",
|
||||
dependencies = "nvim-lua/plenary.nvim",
|
||||
cmd = { "RunCode", "RunFile", "RunProject", "RunClose" },
|
||||
config = function()
|
||||
require("user.coderunner")
|
||||
end,
|
||||
},
|
||||
{
|
||||
"NvChad/nvim-colorizer.lua",
|
||||
event = "BufWinEnter",
|
||||
opts = function()
|
||||
require("user.colorizer")
|
||||
end,
|
||||
},
|
||||
{ "williamboman/nvim-lsp-installer" },
|
||||
{
|
||||
"SmiteshP/nvim-navic",
|
||||
dependencies = "neovim/nvim-lspconfig",
|
||||
event = "BufRead",
|
||||
config = function()
|
||||
require("user.breadcrumb")
|
||||
require("user.winbar")
|
||||
end,
|
||||
},
|
||||
{
|
||||
"rcarriga/nvim-notify",
|
||||
event = "BufRead",
|
||||
config = function()
|
||||
vim.notify = require("notify")
|
||||
end,
|
||||
},
|
||||
{
|
||||
"mrjones2014/smart-splits.nvim",
|
||||
event = "BufWinEnter",
|
||||
config = function()
|
||||
require("user.smartspit")
|
||||
end,
|
||||
},
|
||||
{
|
||||
"jayp0521/mason-null-ls.nvim",
|
||||
dependencies = "jose-elias-alvarez/null-ls.nvim",
|
||||
event = "BufRead",
|
||||
opts = function()
|
||||
require("user.mason-null-ls")
|
||||
end,
|
||||
},
|
||||
{
|
||||
"stevearc/dressing.nvim",
|
||||
event = "BufWinEnter",
|
||||
config = function()
|
||||
require("user.dressing")
|
||||
end,
|
||||
},
|
||||
{
|
||||
"folke/todo-comments.nvim",
|
||||
event = "BufRead",
|
||||
config = function()
|
||||
require("todo-comments").setup()
|
||||
end,
|
||||
},
|
||||
{
|
||||
"karb94/neoscroll.nvim",
|
||||
event = "BufRead",
|
||||
config = function()
|
||||
require("user.neoscroll")
|
||||
end,
|
||||
},
|
||||
{
|
||||
"dstein64/nvim-scrollview",
|
||||
event = "BufRead",
|
||||
config = function()
|
||||
require("user.nvimscroll")
|
||||
end,
|
||||
},
|
||||
{
|
||||
"gelguy/wilder.nvim",
|
||||
event = "BufWinEnter",
|
||||
config = function()
|
||||
local wilder = require("wilder")
|
||||
wilder.setup({ modes = { ":", "/", "?" } })
|
||||
wilder.set_option(
|
||||
"renderer",
|
||||
wilder.popupmenu_renderer({
|
||||
highlighter = wilder.basic_highlighter(),
|
||||
left = { " ", wilder.popupmenu_devicons() },
|
||||
right = { " ", wilder.popupmenu_scrollbar() },
|
||||
})
|
||||
)
|
||||
end,
|
||||
},
|
||||
{
|
||||
"gbprod/yanky.nvim",
|
||||
event = "BufRead",
|
||||
config = function()
|
||||
require("user.yanky")
|
||||
end,
|
||||
},
|
||||
{ "dstein64/vim-startuptime", cmd="StartupTime" },
|
||||
{ "p00f/nvim-ts-rainbow", event = "BufWinEnter", dependencies = "nvim-treesitter/nvim-treesitter" },
|
||||
{
|
||||
"lewis6991/gitsigns.nvim",
|
||||
commit = "2c6f96dda47e55fa07052ce2e2141e8367cbaaf2",
|
||||
disable = vim.fn.executable("git") == 0,
|
||||
ft = "gitcommit",
|
||||
event = "VeryLazy",
|
||||
config = function()
|
||||
require("user.gitsigns")
|
||||
end,
|
||||
}
|
||||
}
|
62
lua/plugins/treesitter.lua
Normal file
62
lua/plugins/treesitter.lua
Normal file
|
@ -0,0 +1,62 @@
|
|||
return {
|
||||
{
|
||||
"nvim-treesitter/nvim-treesitter",
|
||||
build = ":TSUpdate",
|
||||
event = "BufReadPost",
|
||||
---@type TSConfig
|
||||
opts = {
|
||||
sync_install = false,
|
||||
highlight = { enable = true },
|
||||
autopairs = {
|
||||
enable = true,
|
||||
},
|
||||
indent = { enable = true, disable = { "python", "css" } },
|
||||
autotag = { enable = true },
|
||||
incremental_selection = { enable = true },
|
||||
rainbow = {
|
||||
enable = true,
|
||||
disable = { "html" },
|
||||
extended_mode = false,
|
||||
max_file_lines = nil,
|
||||
},
|
||||
context_commentstring = {
|
||||
enable = true,
|
||||
enable_autocmd = false,
|
||||
config = {
|
||||
-- Languages that have a single comment style
|
||||
typescript = "// %s",
|
||||
css = "/* %s */",
|
||||
scss = "/* %s */",
|
||||
html = "<!-- %s -->",
|
||||
svelte = "<!-- %s -->",
|
||||
vue = "<!-- %s -->",
|
||||
json = "",
|
||||
},
|
||||
},
|
||||
ensure_installed = {
|
||||
"bash",
|
||||
"html",
|
||||
"c",
|
||||
"javascript",
|
||||
"json",
|
||||
"lua",
|
||||
"python",
|
||||
"typescript",
|
||||
"tsx",
|
||||
"css",
|
||||
"rust",
|
||||
"java",
|
||||
"yaml",
|
||||
"markdown",
|
||||
"markdown_inline",
|
||||
},
|
||||
},
|
||||
---@param opts TSConfig
|
||||
config = function(plugin, opts)
|
||||
if plugin.ensure_installed then
|
||||
require("lazyvim.util").deprecate("treesitter.ensure_installed", "treesitter.opts.ensure_installed")
|
||||
end
|
||||
require("nvim-treesitter.configs").setup(opts)
|
||||
end,
|
||||
},
|
||||
}
|
45
lua/user/alpha.lua
Normal file
45
lua/user/alpha.lua
Normal file
|
@ -0,0 +1,45 @@
|
|||
local status_ok, alpha = pcall(require, "alpha")
|
||||
if not status_ok then
|
||||
return
|
||||
end
|
||||
|
||||
local dashboard = require("alpha.themes.dashboard")
|
||||
dashboard.section.header.val = {
|
||||
[[ _ _ _ ]],
|
||||
[[ (_) | | | | ]],
|
||||
[[ _ __ ___ _ ___ | | __ ___ ___ __| | ___ ]],
|
||||
[[| '_ \ / _ \| |/ _ \| |/ / / __/ _ \ / _` |/ _ \]],
|
||||
[[| |_) | (_) | | (_) | < | (_| (_) | (_| | __/]],
|
||||
[[| .__/ \___/| |\___/|_|\_\ \___\___/ \__,_|\___|]],
|
||||
[[| | _/ | ]],
|
||||
[[|_| |__/ ]],
|
||||
}
|
||||
dashboard.section.buttons.val = {
|
||||
dashboard.button("f", " Find file", ":Telescope find_files <CR>"),
|
||||
dashboard.button("e", " New file", ":ene <BAR> startinsert <CR>"),
|
||||
dashboard.button("p", " Find project", ":Telescope projects <CR>"),
|
||||
dashboard.button("r", " Recently used files", ":Telescope oldfiles <CR>"),
|
||||
dashboard.button("t", " Find text", ":Telescope live_grep <CR>"),
|
||||
dashboard.button("c", " Configuration", ":e $MYVIMRC <CR>"),
|
||||
dashboard.button("q", " Quit Neovim", ":qa<CR>"),
|
||||
}
|
||||
|
||||
local function footer()
|
||||
-- NOTE: requires the fortune-mod package to work
|
||||
-- local handle = io.popen("fortune")
|
||||
-- local fortune = handle:read("*a")
|
||||
-- handle:close()
|
||||
-- return fortune
|
||||
return "Pojok Code"
|
||||
end
|
||||
|
||||
dashboard.section.footer.val = footer()
|
||||
|
||||
dashboard.section.footer.opts.hl = "Type"
|
||||
dashboard.section.header.opts.hl = "Include"
|
||||
dashboard.section.buttons.opts.hl = "Keyword"
|
||||
|
||||
dashboard.opts.opts.noautocmd = true
|
||||
-- vim.cmd([[autocmd User AlphaReady echo 'ready']])
|
||||
alpha.setup(dashboard.opts)
|
||||
|
38
lua/user/autocommands.lua
Normal file
38
lua/user/autocommands.lua
Normal file
|
@ -0,0 +1,38 @@
|
|||
-- autocmd BufWinEnter * :set formatoptions-=cro
|
||||
vim.cmd([[
|
||||
augroup _general_settings
|
||||
autocmd!
|
||||
autocmd FileType qf,help,man,lspinfo nnoremap <silent> <buffer> q :close<CR>
|
||||
autocmd TextYankPost * silent!lua require('vim.highlight').on_yank({higroup = 'Visual', timeout = 200})
|
||||
autocmd BufWinEnter * :set formatoptions=croql
|
||||
autocmd FileType qf set nobuflisted
|
||||
augroup end
|
||||
|
||||
augroup _git
|
||||
autocmd!
|
||||
autocmd FileType gitcommit setlocal wrap
|
||||
autocmd FileType gitcommit setlocal spell
|
||||
augroup end
|
||||
|
||||
augroup _markdown
|
||||
autocmd!
|
||||
autocmd FileType markdown setlocal wrap
|
||||
autocmd FileType markdown setlocal spell
|
||||
augroup end
|
||||
|
||||
augroup _auto_resize
|
||||
autocmd!
|
||||
autocmd VimResized * tabdo wincmd =
|
||||
augroup end
|
||||
|
||||
augroup _alpha
|
||||
autocmd!
|
||||
autocmd User AlphaReady set showtabline=0 | autocmd BufUnload <buffer> set showtabline=2
|
||||
augroup end
|
||||
]])
|
||||
|
||||
-- Autoformat
|
||||
-- augroup _lsp
|
||||
-- autocmd!
|
||||
-- autocmd BufWritePre * lua vim.lsp.buf.formatting()
|
||||
-- augroup end
|
33
lua/user/autopairs.lua
Normal file
33
lua/user/autopairs.lua
Normal file
|
@ -0,0 +1,33 @@
|
|||
-- Setup nvim-cmp.
|
||||
local status_ok, npairs = pcall(require, "nvim-autopairs")
|
||||
if not status_ok then
|
||||
return
|
||||
end
|
||||
|
||||
npairs.setup({
|
||||
check_ts = true,
|
||||
ts_config = {
|
||||
lua = { "string", "source" },
|
||||
javascript = { "string", "template_string" },
|
||||
java = false,
|
||||
},
|
||||
disable_filetype = { "TelescopePrompt", "spectre_panel" },
|
||||
fast_wrap = {
|
||||
map = "<M-e>",
|
||||
chars = { "{", "[", "(", '"', "'" },
|
||||
pattern = string.gsub([[ [%'%"%)%>%]%)%}%,] ]], "%s+", ""),
|
||||
offset = 0, -- Offset from pattern match
|
||||
end_key = "$",
|
||||
keys = "qwertyuiopzxcvbnmasdfghjkl",
|
||||
check_comma = true,
|
||||
highlight = "PmenuSel",
|
||||
highlight_grey = "LineNr",
|
||||
},
|
||||
})
|
||||
|
||||
local cmp_autopairs = require("nvim-autopairs.completion.cmp")
|
||||
local cmp_status_ok, cmp = pcall(require, "cmp")
|
||||
if not cmp_status_ok then
|
||||
return
|
||||
end
|
||||
cmp.event:on("confirm_done", cmp_autopairs.on_confirm_done({ map_char = { tex = "" } }))
|
10
lua/user/autotag.lua
Normal file
10
lua/user/autotag.lua
Normal file
|
@ -0,0 +1,10 @@
|
|||
local status_ok, cfg = pcall(require, "nvim-treesitter.configs")
|
||||
if not status_ok then
|
||||
return
|
||||
end
|
||||
|
||||
cfg.setup({
|
||||
autotag = {
|
||||
enable = true,
|
||||
},
|
||||
})
|
50
lua/user/breadcrumb.lua
Normal file
50
lua/user/breadcrumb.lua
Normal file
|
@ -0,0 +1,50 @@
|
|||
local status_ok, navic = pcall(require, "nvim-navic")
|
||||
if not status_ok then
|
||||
return
|
||||
end
|
||||
|
||||
local ico = require("user.icons")
|
||||
local icons = ico.kind
|
||||
|
||||
navic.setup({
|
||||
icons = {
|
||||
Array = icons.Array .. " ",
|
||||
Boolean = icons.Boolean,
|
||||
Class = icons.Class .. " ",
|
||||
Color = icons.Color .. " ",
|
||||
Constant = icons.Constant .. " ",
|
||||
Constructor = icons.Constructor .. " ",
|
||||
Enum = icons.Enum .. " ",
|
||||
EnumMember = icons.EnumMember .. " ",
|
||||
Event = icons.Event .. " ",
|
||||
Field = icons.Field .. " ",
|
||||
File = icons.File .. " ",
|
||||
Folder = icons.Folder .. " ",
|
||||
Function = icons.Function .. " ",
|
||||
Interface = icons.Interface .. " ",
|
||||
Key = icons.Key .. " ",
|
||||
Keyword = icons.Keyword .. " ",
|
||||
Method = icons.Method .. " ",
|
||||
Module = icons.Module .. " ",
|
||||
Namespace = icons.Namespace .. " ",
|
||||
Null = icons.Null .. " ",
|
||||
Number = icons.Number .. " ",
|
||||
Object = icons.Object .. " ",
|
||||
Operator = icons.Operator .. " ",
|
||||
Package = icons.Package .. " ",
|
||||
Property = icons.Property .. " ",
|
||||
Reference = icons.Reference .. " ",
|
||||
Snippet = icons.Snippet .. " ",
|
||||
String = icons.String .. " ",
|
||||
Struct = icons.Struct .. " ",
|
||||
Text = icons.Text .. " ",
|
||||
TypeParameter = icons.TypeParameter .. " ",
|
||||
Unit = icons.Unit .. " ",
|
||||
Value = icons.Value .. " ",
|
||||
Variable = icons.Variable .. " ",
|
||||
},
|
||||
highlight = true,
|
||||
separator = " " .. ico.ui.ChevronRight .. " ",
|
||||
depth_limit = 0,
|
||||
depth_limit_indicator = "..",
|
||||
})
|
211
lua/user/bufferline.lua
Normal file
211
lua/user/bufferline.lua
Normal file
|
@ -0,0 +1,211 @@
|
|||
local status_ok, bufferline = pcall(require, "bufferline")
|
||||
if not status_ok then
|
||||
return
|
||||
end
|
||||
|
||||
local icons = require("user.icons")
|
||||
local use_icons = true
|
||||
|
||||
local function diagnostics_indicator(num, _, diagnostics, _)
|
||||
local result = {}
|
||||
local symbols = {
|
||||
error = icons.diagnostics.Error,
|
||||
warning = icons.diagnostics.Warning,
|
||||
info = icons.diagnostics.Information,
|
||||
}
|
||||
if not use_icons then
|
||||
return "(" .. num .. ")"
|
||||
end
|
||||
for name, count in pairs(diagnostics) do
|
||||
if symbols[name] and count > 0 then
|
||||
table.insert(result, symbols[name] .. " " .. count)
|
||||
end
|
||||
end
|
||||
result = table.concat(result, " ")
|
||||
return #result > 0 and result or ""
|
||||
end
|
||||
|
||||
bufferline.setup({
|
||||
options = {
|
||||
color_icons = true,
|
||||
numbers = "none", -- | "ordinal" | "buffer_id" | "both" | function({ ordinal, id, lower, raise }): string,
|
||||
--close_command = "Bdelete! %d", -- can be a string | function, see "Mouse actions"
|
||||
close_command = function(bufnum)
|
||||
require('bufdelete').bufdelete(bufnum, true)
|
||||
end,
|
||||
--right_mouse_command = "Bdelete! %d", -- can be a string | function, see "Mouse actions"
|
||||
right_mouse_command = function(bufnum)
|
||||
require('bufdelete').bufdelete(bufnum, true)
|
||||
end,
|
||||
left_mouse_command = "buffer %d", -- can be a string | function, see "Mouse actions"
|
||||
middle_mouse_command = nil, -- can be a string | function, see "Mouse actions"
|
||||
-- NOTE: this plugin is designed with this icon in mind,
|
||||
-- and so changing this is NOT recommended, this is intended
|
||||
-- as an escape hatch for people who cannot bear it for whatever reason
|
||||
indicator_icon = nil,
|
||||
indicator = { style = "icon", icon = "▎" },
|
||||
--buffer_close_icon = "",
|
||||
buffer_close_icon = icons.ui.Close,
|
||||
-- buffer_close_icon = '',
|
||||
-- modified_icon = "●",
|
||||
modified_icon = icons.ui.Circle,
|
||||
-- close_icon = "",
|
||||
close_icon = icons.ui.BoldClose,
|
||||
-- close_icon = '',
|
||||
--left_trunc_marker = "",
|
||||
left_trunc_marker = icons.ui.ArrowCircleLeft,
|
||||
--right_trunc_marker = "",
|
||||
right_trunc_marker = icons.ui.ArrowCircleRight,
|
||||
--- name_formatter can be used to change the buffer's label in the bufferline.
|
||||
--- Please note some names can/will break the
|
||||
--- bufferline so use this at your discretion knowing that it has
|
||||
--- some limitations that will *NOT* be fixed.
|
||||
-- name_formatter = function(buf) -- buf contains a "name", "path" and "bufnr"
|
||||
-- -- remove extension from markdown files for example
|
||||
-- if buf.name:match('%.md') then
|
||||
-- return vim.fn.fnamemodify(buf.name, ':t:r')
|
||||
-- end
|
||||
-- end,
|
||||
max_name_length = 30,
|
||||
max_prefix_length = 30, -- prefix used when a buffer is de-duplicated
|
||||
tab_size = 21,
|
||||
diagnostics = false, -- | "nvim_lsp" | "coc",
|
||||
diagnostics_update_in_insert = false,
|
||||
diagnostics_indicator = diagnostics_indicator,
|
||||
-- diagnostics_indicator = function(count, level, diagnostics_dict, context)
|
||||
-- return "("..count..")"
|
||||
-- end,
|
||||
-- NOTE: this will be called a lot so don't do any heavy processing here
|
||||
-- custom_filter = function(buf_number)
|
||||
-- -- filter out filetypes you don't want to see
|
||||
-- if vim.bo[buf_number].filetype ~= "<i-dont-want-to-see-this>" then
|
||||
-- return true
|
||||
-- end
|
||||
-- -- filter out by buffer name
|
||||
-- if vim.fn.bufname(buf_number) ~= "<buffer-name-I-dont-want>" then
|
||||
-- return true
|
||||
-- end
|
||||
-- -- filter out based on arbitrary rules
|
||||
-- -- e.g. filter out vim wiki buffer from tabline in your work repo
|
||||
-- if vim.fn.getcwd() == "<work-repo>" and vim.bo[buf_number].filetype ~= "wiki" then
|
||||
-- return true
|
||||
-- end
|
||||
-- end,
|
||||
offsets = { {
|
||||
filetype = "NvimTree",
|
||||
text = function()
|
||||
return vim.fn.getcwd()
|
||||
end,
|
||||
highlight = "Directory",
|
||||
text_align = "left",
|
||||
padding = 1 }
|
||||
},
|
||||
show_buffer_icons = true,
|
||||
show_buffer_close_icons = true,
|
||||
show_close_icon = true,
|
||||
show_tab_indicators = true,
|
||||
persist_buffer_sort = true, -- whether or not custom sorted buffers should persist
|
||||
-- can also be a table containing 2 custom separators
|
||||
-- [focused and unfocused]. eg: { '|', '|' }
|
||||
separator_style = "thin", -- | "thick" | "thin" | { 'any', 'any' },
|
||||
enforce_regular_tabs = true,
|
||||
always_show_bufferline = true,
|
||||
-- sort_by = 'id' | 'extension' | 'relative_directory' | 'directory' | 'tabs' | function(buffer_a, buffer_b)
|
||||
-- -- add custom logic
|
||||
-- return buffer_a.modified > buffer_b.modified
|
||||
-- end
|
||||
},
|
||||
highlights = {
|
||||
fill = {
|
||||
fg = { attribute = "fg", highlight = "#ff0000" },
|
||||
bg = { attribute = "bg", highlight = "TabLine" },
|
||||
},
|
||||
background = {
|
||||
fg = { attribute = "fg", highlight = "TabLine" },
|
||||
bg = { attribute = "bg", highlight = "TabLine" },
|
||||
},
|
||||
|
||||
-- buffer_selected = {
|
||||
-- fg = {attribute='fg',highlight='#ff0000'},
|
||||
-- bg = {attribute='bg',highlight='#0000ff'},
|
||||
-- gui = 'none'
|
||||
-- },
|
||||
buffer_visible = {
|
||||
fg = { attribute = "fg", highlight = "TabLine" },
|
||||
bg = { attribute = "bg", highlight = "TabLine" },
|
||||
},
|
||||
|
||||
close_button = {
|
||||
fg = { attribute = "fg", highlight = "TabLine" },
|
||||
bg = { attribute = "bg", highlight = "TabLine" },
|
||||
},
|
||||
close_button_visible = {
|
||||
fg = { attribute = "fg", highlight = "TabLine" },
|
||||
bg = { attribute = "bg", highlight = "TabLine" },
|
||||
},
|
||||
-- close_button_selected = {
|
||||
-- fg = {attribute='fg',highlight='TabLineSel'},
|
||||
-- bg ={attribute='bg',highlight='TabLineSel'}
|
||||
-- },
|
||||
|
||||
tab_selected = {
|
||||
fg = { attribute = "fg", highlight = "Normal" },
|
||||
bg = { attribute = "bg", highlight = "Normal" },
|
||||
},
|
||||
tab = {
|
||||
fg = { attribute = "fg", highlight = "TabLine" },
|
||||
bg = { attribute = "bg", highlight = "TabLine" },
|
||||
},
|
||||
tab_close = {
|
||||
-- fg = {attribute='fg',highlight='LspDiagnosticsDefaultError'},
|
||||
fg = { attribute = "fg", highlight = "TabLineSel" },
|
||||
bg = { attribute = "bg", highlight = "Normal" },
|
||||
},
|
||||
|
||||
duplicate_selected = {
|
||||
fg = { attribute = "fg", highlight = "TabLineSel" },
|
||||
bg = { attribute = "bg", highlight = "TabLineSel" },
|
||||
underline = true,
|
||||
},
|
||||
duplicate_visible = {
|
||||
fg = { attribute = "fg", highlight = "TabLine" },
|
||||
bg = { attribute = "bg", highlight = "TabLine" },
|
||||
underline = true,
|
||||
},
|
||||
duplicate = {
|
||||
fg = { attribute = "fg", highlight = "TabLine" },
|
||||
bg = { attribute = "bg", highlight = "TabLine" },
|
||||
underline = true,
|
||||
},
|
||||
|
||||
modified = {
|
||||
fg = { attribute = "fg", highlight = "TabLine" },
|
||||
bg = { attribute = "bg", highlight = "TabLine" },
|
||||
},
|
||||
modified_selected = {
|
||||
fg = { attribute = "fg", highlight = "Normal" },
|
||||
bg = { attribute = "bg", highlight = "Normal" },
|
||||
},
|
||||
modified_visible = {
|
||||
fg = { attribute = "fg", highlight = "TabLine" },
|
||||
bg = { attribute = "bg", highlight = "TabLine" },
|
||||
},
|
||||
|
||||
separator = {
|
||||
fg = { attribute = "bg", highlight = "TabLine" },
|
||||
bg = { attribute = "bg", highlight = "TabLine" },
|
||||
},
|
||||
separator_selected = {
|
||||
fg = { attribute = "bg", highlight = "Normal" },
|
||||
bg = { attribute = "bg", highlight = "Normal" },
|
||||
},
|
||||
-- separator_visible = {
|
||||
-- fg = {attribute='bg',highlight='TabLine'},
|
||||
-- bg = {attribute='bg',highlight='TabLine'}
|
||||
-- },
|
||||
indicator_selected = {
|
||||
fg = { attribute = "fg", highlight = "LspDiagnosticsDefaultHint" },
|
||||
bg = { attribute = "bg", highlight = "Normal" },
|
||||
},
|
||||
},
|
||||
})
|
141
lua/user/cmp.lua
Normal file
141
lua/user/cmp.lua
Normal file
|
@ -0,0 +1,141 @@
|
|||
local cmp_status_ok, cmp = pcall(require, "cmp")
|
||||
if not cmp_status_ok then
|
||||
return
|
||||
end
|
||||
|
||||
local snip_status_ok, luasnip = pcall(require, "luasnip")
|
||||
if not snip_status_ok then
|
||||
return
|
||||
end
|
||||
|
||||
require("luasnip/loaders/from_vscode").lazy_load()
|
||||
|
||||
local check_backspace = function()
|
||||
local col = vim.fn.col(".") - 1
|
||||
return col == 0 or vim.fn.getline("."):sub(col, col):match("%s")
|
||||
end
|
||||
|
||||
-- פּ ﯟ some other good icons
|
||||
-- local kind_icons = {
|
||||
-- Text = "",
|
||||
-- Method = "m",
|
||||
-- Function = "",
|
||||
-- Constructor = "",
|
||||
-- Field = "",
|
||||
-- Variable = "",
|
||||
-- Class = "",
|
||||
-- Interface = "",
|
||||
-- Module = "",
|
||||
-- Property = "",
|
||||
-- Unit = "",
|
||||
-- Value = "",
|
||||
-- Enum = "",
|
||||
-- Keyword = "",
|
||||
-- Snippet = "",
|
||||
-- Color = "",
|
||||
-- File = "",
|
||||
-- Reference = "",
|
||||
-- Folder = "",
|
||||
-- EnumMember = "",
|
||||
-- Constant = "",
|
||||
-- Struct = "",
|
||||
-- Event = "",
|
||||
-- Operator = "",
|
||||
-- TypeParameter = "",
|
||||
-- }
|
||||
-- find more here: https://www.nerdfonts.com/cheat-sheet
|
||||
local new_kind_icon = require("user.icons")
|
||||
|
||||
cmp.setup({
|
||||
snippet = {
|
||||
expand = function(args)
|
||||
luasnip.lsp_expand(args.body) -- For `luasnip` users.
|
||||
end,
|
||||
},
|
||||
mapping = {
|
||||
["<Up>"] = cmp.mapping.select_prev_item({ behavior = cmp.SelectBehavior.Select }),
|
||||
["<Down>"] = cmp.mapping.select_next_item({ behavior = cmp.SelectBehavior.Select }),
|
||||
["<C-k>"] = cmp.mapping.select_prev_item(),
|
||||
["<C-j>"] = cmp.mapping.select_next_item(),
|
||||
["<C-b>"] = cmp.mapping(cmp.mapping.scroll_docs(-1), { "i", "c" }),
|
||||
["<C-f>"] = cmp.mapping(cmp.mapping.scroll_docs(1), { "i", "c" }),
|
||||
["<C-Space>"] = cmp.mapping(cmp.mapping.complete(), { "i", "c" }),
|
||||
["<C-y>"] = cmp.config.disable, -- Specify `cmp.config.disable` if you want to remove the default `<C-y>` mapping.
|
||||
["<C-e>"] = cmp.mapping({
|
||||
i = cmp.mapping.abort(),
|
||||
c = cmp.mapping.close(),
|
||||
}),
|
||||
-- Accept currently selected item. If none selected, `select` first item.
|
||||
-- Set `select` to `false` to only confirm explicitly selected items.
|
||||
["<CR>"] = cmp.mapping.confirm({ select = true }),
|
||||
["<Tab>"] = cmp.mapping(function(fallback)
|
||||
if cmp.visible() then
|
||||
cmp.select_next_item()
|
||||
elseif luasnip.expandable() then
|
||||
luasnip.expand()
|
||||
elseif luasnip.expand_or_jumpable() then
|
||||
luasnip.expand_or_jump()
|
||||
elseif check_backspace() then
|
||||
fallback()
|
||||
else
|
||||
fallback()
|
||||
end
|
||||
end, {
|
||||
"i",
|
||||
"s",
|
||||
}),
|
||||
["<S-Tab>"] = cmp.mapping(function(fallback)
|
||||
if cmp.visible() then
|
||||
cmp.select_prev_item()
|
||||
elseif luasnip.jumpable(-1) then
|
||||
luasnip.jump(-1)
|
||||
else
|
||||
fallback()
|
||||
end
|
||||
end, {
|
||||
"i",
|
||||
"s",
|
||||
}),
|
||||
},
|
||||
formatting = {
|
||||
fields = { "kind", "abbr", "menu" },
|
||||
format = function(entry, vim_item)
|
||||
-- Kind icons
|
||||
-- vim_item.kind = string.format("%s", kind_icons[vim_item.kind])
|
||||
vim_item.kind = string.format("%s", new_kind_icon["kind"][vim_item.kind])
|
||||
-- vim_item.kind = string.format('%s %s', kind_icons[vim_item.kind], vim_item.kind) -- This concatonates the icons with the name of the item kind
|
||||
vim_item.menu = ({
|
||||
-- nvim_lsp = "[LSP]",
|
||||
-- luasnip = "[Snippet]",
|
||||
-- buffer = "[Buffer]",
|
||||
-- path = "[Path]",
|
||||
nvim_lsp = "(LSP)",
|
||||
luasnip = "(Snippet)",
|
||||
buffer = "(Buffer)",
|
||||
path = "(Path)",
|
||||
})[entry.source.name]
|
||||
return vim_item
|
||||
end,
|
||||
},
|
||||
sources = {
|
||||
{ name = "nvim_lsp" },
|
||||
{ name = "luasnip" },
|
||||
{ name = "buffer" },
|
||||
{ name = "path" },
|
||||
},
|
||||
confirm_opts = {
|
||||
behavior = cmp.ConfirmBehavior.Replace,
|
||||
select = false,
|
||||
},
|
||||
window = {
|
||||
completion = cmp.config.window.bordered(),
|
||||
documentation = cmp.config.window.bordered(),
|
||||
-- documentation = {
|
||||
-- border = { "╭", "─", "╮", "│", "╯", "─", "╰", "│" },
|
||||
-- },
|
||||
},
|
||||
experimental = {
|
||||
ghost_text = false,
|
||||
native_menu = false,
|
||||
},
|
||||
})
|
24
lua/user/coderunner.lua
Normal file
24
lua/user/coderunner.lua
Normal file
|
@ -0,0 +1,24 @@
|
|||
local status_ok, code_runner = pcall(require, "code_runner")
|
||||
if not status_ok then
|
||||
return
|
||||
end
|
||||
code_runner.setup({
|
||||
-- put here the commands by filetype
|
||||
filetype = {
|
||||
java = "cd $dir && javac $fileName && java $fileNameWithoutExt",
|
||||
python = "python3 -u",
|
||||
typescript = "deno run",
|
||||
javascript = "node $dir/$fileName",
|
||||
rust = "cd $dir && rustc $fileName && $dir/$fileNameWithoutExt",
|
||||
-- cpp="gcc $fileName -lstdc++ -o $fileNameWithoutExt && $fileNameWithoutExt"
|
||||
cpp = "g++ $fileName -o $fileNameWithoutExt && $dir/$fileNameWithoutExt",
|
||||
scss = "sass $dir/$fileName $dir/$fileNameWithoutExt.css",
|
||||
},
|
||||
mode = "term",
|
||||
focus = true,
|
||||
startinsert = true,
|
||||
term = {
|
||||
position = "vert",
|
||||
size = 50,
|
||||
},
|
||||
})
|
11
lua/user/colorizer.lua
Normal file
11
lua/user/colorizer.lua
Normal file
|
@ -0,0 +1,11 @@
|
|||
local status_ok, colorizer_cfg = pcall(require, "colorizer")
|
||||
if not status_ok then
|
||||
return
|
||||
end
|
||||
colorizer_cfg.setup({
|
||||
filetypes = {
|
||||
"*", -- Highlight all files, but customize some others.
|
||||
css = { rgb_fn = true }, -- Enable parsing rgb(...) functions in css.
|
||||
html = { names = false }, -- Disable parsing "names" like Blue or Gray
|
||||
},
|
||||
})
|
8
lua/user/colorscheme.lua
Normal file
8
lua/user/colorscheme.lua
Normal file
|
@ -0,0 +1,8 @@
|
|||
local colorscheme = "tokyonight-night"
|
||||
-- local colorscheme = "nord"
|
||||
-- local colorscheme = "lunar"
|
||||
|
||||
local status_ok, _ = pcall(vim.cmd, "colorscheme " .. colorscheme)
|
||||
if not status_ok then
|
||||
return
|
||||
end
|
32
lua/user/comment.lua
Normal file
32
lua/user/comment.lua
Normal file
|
@ -0,0 +1,32 @@
|
|||
local status_ok, comment = pcall(require, "Comment")
|
||||
if not status_ok then
|
||||
return
|
||||
end
|
||||
|
||||
comment.setup({
|
||||
pre_hook = function(ctx)
|
||||
local U = require("Comment.utils")
|
||||
|
||||
local status_utils_ok, utils = pcall(require, "ts_context_commentstring.utils")
|
||||
if not status_utils_ok then
|
||||
return
|
||||
end
|
||||
|
||||
local location = nil
|
||||
if ctx.ctype == U.ctype.block then
|
||||
location = utils.get_cursor_location()
|
||||
elseif ctx.cmotion == U.cmotion.v or ctx.cmotion == U.cmotion.V then
|
||||
location = utils.get_visual_start_location()
|
||||
end
|
||||
|
||||
local status_internals_ok, internals = pcall(require, "ts_context_commentstring.internals")
|
||||
if not status_internals_ok then
|
||||
return
|
||||
end
|
||||
|
||||
return internals.calculate_commentstring({
|
||||
key = ctx.ctype == U.ctype.line and "__default" or "__multiline",
|
||||
location = location,
|
||||
})
|
||||
end,
|
||||
})
|
15
lua/user/dressing.lua
Normal file
15
lua/user/dressing.lua
Normal file
|
@ -0,0 +1,15 @@
|
|||
local status_ok, dressing = pcall(require, "dressing")
|
||||
if not status_ok then
|
||||
return
|
||||
end
|
||||
|
||||
dressing.setup({
|
||||
input = {
|
||||
default_prompt = "➤ ",
|
||||
win_options = { winhighlight = "Normal:Normal,NormalNC:Normal" },
|
||||
},
|
||||
select = {
|
||||
backend = { "telescope", "builtin" },
|
||||
builtin = { win_options = { winhighlight = "Normal:Normal,NormalNC:Normal" } },
|
||||
},
|
||||
})
|
22
lua/user/format_onsave.lua
Normal file
22
lua/user/format_onsave.lua
Normal file
|
@ -0,0 +1,22 @@
|
|||
function format_filter(client)
|
||||
local filetype = vim.bo.filetype
|
||||
local n = require "null-ls"
|
||||
local s = require "null-ls.sources"
|
||||
local method = n.methods.FORMATTING
|
||||
local available_formatters = s.get_available(filetype, method)
|
||||
|
||||
if #available_formatters > 0 then
|
||||
return client.name == "null-ls"
|
||||
elseif client.supports_method "textDocument/formatting" then
|
||||
return true
|
||||
else
|
||||
return false
|
||||
end
|
||||
end
|
||||
vim.cmd [[
|
||||
augroup _lsp
|
||||
autocmd!
|
||||
" autocmd BufWritePre * lua vim.lsp.buf.format{timeout_ms =200, filter=format_filter}
|
||||
autocmd BufWritePre * lua vim.lsp.buf.format{filter=format_filter}
|
||||
augroup end
|
||||
]]
|
33
lua/user/functions.lua
Normal file
33
lua/user/functions.lua
Normal file
|
@ -0,0 +1,33 @@
|
|||
local M = {}
|
||||
|
||||
function M.smart_quit()
|
||||
local bufnr = vim.api.nvim_get_current_buf()
|
||||
local buf_windows = vim.call("win_findbuf", bufnr)
|
||||
local modified = vim.api.nvim_buf_get_option(bufnr, "modified")
|
||||
if modified and #buf_windows == 1 then
|
||||
vim.ui.input({
|
||||
prompt = "You have unsaved changes. Quit anyway? (y/n) ",
|
||||
}, function(input)
|
||||
if input == "y" then
|
||||
vim.cmd("q!")
|
||||
end
|
||||
end)
|
||||
else
|
||||
vim.cmd("q!")
|
||||
end
|
||||
end
|
||||
|
||||
function M.isempty(s)
|
||||
return s == nil or s == ""
|
||||
end
|
||||
|
||||
function M.get_buf_option(opt)
|
||||
local status_ok, buf_option = pcall(vim.api.nvim_buf_get_option, 0, opt)
|
||||
if not status_ok then
|
||||
return nil
|
||||
else
|
||||
return buf_option
|
||||
end
|
||||
end
|
||||
|
||||
return M
|
48
lua/user/gitsigns.lua
Normal file
48
lua/user/gitsigns.lua
Normal file
|
@ -0,0 +1,48 @@
|
|||
local status_ok, gitsigns = pcall(require, "gitsigns")
|
||||
if not status_ok then
|
||||
return
|
||||
end
|
||||
|
||||
gitsigns.setup {
|
||||
signs = {
|
||||
add = { hl = "GitSignsAdd", text = "▎", numhl = "GitSignsAddNr", linehl = "GitSignsAddLn" },
|
||||
change = { hl = "GitSignsChange", text = "▎", numhl = "GitSignsChangeNr", linehl = "GitSignsChangeLn" },
|
||||
delete = { hl = "GitSignsDelete", text = "契", numhl = "GitSignsDeleteNr", linehl = "GitSignsDeleteLn" },
|
||||
topdelete = { hl = "GitSignsDelete", text = "契", numhl = "GitSignsDeleteNr", linehl = "GitSignsDeleteLn" },
|
||||
changedelete = { hl = "GitSignsChange", text = "▎", numhl = "GitSignsChangeNr", linehl = "GitSignsChangeLn" },
|
||||
},
|
||||
signcolumn = true, -- Toggle with `:Gitsigns toggle_signs`
|
||||
numhl = false, -- Toggle with `:Gitsigns toggle_numhl`
|
||||
linehl = false, -- Toggle with `:Gitsigns toggle_linehl`
|
||||
word_diff = false, -- Toggle with `:Gitsigns toggle_word_diff`
|
||||
watch_gitdir = {
|
||||
interval = 1000,
|
||||
follow_files = true,
|
||||
},
|
||||
attach_to_untracked = true,
|
||||
current_line_blame = false, -- Toggle with `:Gitsigns toggle_current_line_blame`
|
||||
current_line_blame_opts = {
|
||||
virt_text = true,
|
||||
virt_text_pos = "eol", -- 'eol' | 'overlay' | 'right_align'
|
||||
delay = 1000,
|
||||
ignore_whitespace = false,
|
||||
},
|
||||
current_line_blame_formatter_opts = {
|
||||
relative_time = false,
|
||||
},
|
||||
sign_priority = 6,
|
||||
update_debounce = 100,
|
||||
status_formatter = nil, -- Use default
|
||||
max_file_length = 40000,
|
||||
preview_config = {
|
||||
-- Options passed to nvim_open_win
|
||||
border = "single",
|
||||
style = "minimal",
|
||||
relative = "cursor",
|
||||
row = 0,
|
||||
col = 1,
|
||||
},
|
||||
yadm = {
|
||||
enable = false,
|
||||
},
|
||||
}
|
154
lua/user/icons.lua
Normal file
154
lua/user/icons.lua
Normal file
|
@ -0,0 +1,154 @@
|
|||
return {
|
||||
kind = {
|
||||
Array = "",
|
||||
Boolean = "",
|
||||
Class = "",
|
||||
Color = "",
|
||||
Constant = "",
|
||||
Constructor = "",
|
||||
Enum = "",
|
||||
EnumMember = "",
|
||||
Event = "",
|
||||
Field = "",
|
||||
File = "",
|
||||
Folder = "",
|
||||
Function = "",
|
||||
Interface = "",
|
||||
Key = "",
|
||||
Keyword = "",
|
||||
Method = "",
|
||||
Module = "",
|
||||
Namespace = "",
|
||||
Null = "ﳠ",
|
||||
Number = "",
|
||||
Object = "",
|
||||
Operator = "",
|
||||
Package = "",
|
||||
Property = "",
|
||||
Reference = "",
|
||||
Snippet = "",
|
||||
String = "",
|
||||
Struct = "",
|
||||
Text = "",
|
||||
TypeParameter = "",
|
||||
Unit = "",
|
||||
Value = "",
|
||||
Variable = "",
|
||||
},
|
||||
git = {
|
||||
LineAdded = "",
|
||||
LineModified = "",
|
||||
LineRemoved = "",
|
||||
FileDeleted = "",
|
||||
FileIgnored = "◌",
|
||||
FileRenamed = "",
|
||||
FileStaged = "S",
|
||||
FileUnmerged = "",
|
||||
FileUnstaged = "",
|
||||
FileUntracked = "U",
|
||||
Diff = "",
|
||||
Repo = "",
|
||||
Octoface = "",
|
||||
Branch = "",
|
||||
},
|
||||
ui = {
|
||||
ArrowCircleDown = "",
|
||||
ArrowCircleLeft = "",
|
||||
ArrowCircleRight = "",
|
||||
ArrowCircleUp = "",
|
||||
BoldArrowDown = "",
|
||||
BoldArrowLeft = "",
|
||||
BoldArrowRight = "",
|
||||
BoldArrowUp = "",
|
||||
BoldClose = "",
|
||||
BoldDividerLeft = "",
|
||||
BoldDividerRight = "",
|
||||
BoldLineLeft = "▎",
|
||||
BookMark = "",
|
||||
BoxChecked = "",
|
||||
Bug = "",
|
||||
Stacks = "",
|
||||
Scopes = "",
|
||||
Watches = "",
|
||||
DebugConsole = "",
|
||||
Calendar = "",
|
||||
Check = "",
|
||||
ChevronRight = ">",
|
||||
ChevronShortDown = "",
|
||||
ChevronShortLeft = "",
|
||||
ChevronShortRight = "",
|
||||
ChevronShortUp = "",
|
||||
Circle = "",
|
||||
Close = "",
|
||||
CloudDownload = "",
|
||||
Code = "",
|
||||
Comment = "",
|
||||
Dashboard = "",
|
||||
DividerLeft = "",
|
||||
DividerRight = "",
|
||||
DoubleChevronRight = "»",
|
||||
Ellipsis = "",
|
||||
EmptyFolder = "",
|
||||
EmptyFolderOpen = "",
|
||||
File = "",
|
||||
FileSymlink = "",
|
||||
Files = "",
|
||||
FindFile = "",
|
||||
FindText = "",
|
||||
Fire = "",
|
||||
Folder = "",
|
||||
FolderOpen = "",
|
||||
FolderSymlink = "",
|
||||
Forward = "",
|
||||
Gear = "",
|
||||
History = "",
|
||||
Lightbulb = "",
|
||||
LineLeft = "▏",
|
||||
LineMiddle = "│",
|
||||
List = "",
|
||||
Lock = "",
|
||||
NewFile = "",
|
||||
Note = "",
|
||||
Package = "",
|
||||
Pencil = "",
|
||||
Plus = "",
|
||||
Project = "",
|
||||
Search = "",
|
||||
SignIn = "",
|
||||
SignOut = "",
|
||||
Tab = "",
|
||||
Table = "",
|
||||
Target = "",
|
||||
Telescope = "",
|
||||
Text = "",
|
||||
Tree = "",
|
||||
Triangle = "契",
|
||||
TriangleShortArrowDown = "",
|
||||
TriangleShortArrowLeft = "",
|
||||
TriangleShortArrowRight = "",
|
||||
TriangleShortArrowUp = "",
|
||||
},
|
||||
diagnostics = {
|
||||
BoldError = "",
|
||||
Error = "",
|
||||
BoldWarning = "",
|
||||
Warning = "",
|
||||
BoldInformation = "",
|
||||
Information = "",
|
||||
BoldQuestion = "",
|
||||
Question = "",
|
||||
BoldHint = "",
|
||||
Hint = "",
|
||||
Debug = "",
|
||||
Trace = "✎",
|
||||
},
|
||||
misc = {
|
||||
Robot = "ﮧ",
|
||||
Squirrel = "",
|
||||
Tag = "",
|
||||
Watch = "",
|
||||
Smiley = "",
|
||||
Package = "",
|
||||
CircuitBoard = "",
|
||||
},
|
||||
}
|
6
lua/user/impatient.lua
Normal file
6
lua/user/impatient.lua
Normal file
|
@ -0,0 +1,6 @@
|
|||
local status_ok, impatient = pcall(require, "impatient")
|
||||
if not status_ok then
|
||||
return
|
||||
end
|
||||
|
||||
impatient.enable_profile()
|
70
lua/user/indentline.lua
Normal file
70
lua/user/indentline.lua
Normal file
|
@ -0,0 +1,70 @@
|
|||
local status_ok, indent_blankline = pcall(require, "indent_blankline")
|
||||
if not status_ok then
|
||||
return
|
||||
end
|
||||
|
||||
vim.g.indent_blankline_buftype_exclude = { "terminal", "nofile" }
|
||||
vim.g.indent_blankline_filetype_exclude = {
|
||||
"help",
|
||||
"startify",
|
||||
"dashboard",
|
||||
"packer",
|
||||
"neogitstatus",
|
||||
"NvimTree",
|
||||
"Trouble",
|
||||
}
|
||||
vim.g.indentLine_enabled = 1
|
||||
-- vim.g.indent_blankline_char = "│"
|
||||
vim.g.indent_blankline_char = "▏"
|
||||
-- vim.g.indent_blankline_char = "▎"
|
||||
vim.g.indent_blankline_show_trailing_blankline_indent = false
|
||||
vim.g.indent_blankline_show_first_indent_level = true
|
||||
vim.g.indent_blankline_use_treesitter = true
|
||||
vim.g.indent_blankline_show_current_context = true
|
||||
vim.g.indent_blankline_context_patterns = {
|
||||
"class",
|
||||
"return",
|
||||
"function",
|
||||
"method",
|
||||
"^if",
|
||||
"^while",
|
||||
"jsx_element",
|
||||
"^for",
|
||||
"^object",
|
||||
"^table",
|
||||
"block",
|
||||
"arguments",
|
||||
"if_statement",
|
||||
"else_clause",
|
||||
"jsx_element",
|
||||
"jsx_self_closing_element",
|
||||
"try_statement",
|
||||
"catch_clause",
|
||||
"import_statement",
|
||||
"operation_type",
|
||||
}
|
||||
-- HACK: work-around for https://github.com/lukas-reineke/indent-blankline.nvim/issues/59
|
||||
vim.wo.colorcolumn = "99999"
|
||||
|
||||
-- vim.cmd [[highlight IndentBlanklineIndent1 guifg=#E06C75 gui=nocombine]]
|
||||
-- vim.cmd [[highlight IndentBlanklineIndent2 guifg=#E5C07B gui=nocombine]]
|
||||
-- vim.cmd [[highlight IndentBlanklineIndent3 guifg=#98C379 gui=nocombine]]
|
||||
-- vim.cmd [[highlight IndentBlanklineIndent4 guifg=#56B6C2 gui=nocombine]]
|
||||
-- vim.cmd [[highlight IndentBlanklineIndent5 guifg=#61AFEF gui=nocombine]]
|
||||
-- vim.cmd [[highlight IndentBlanklineIndent6 guifg=#C678DD gui=nocombine]]
|
||||
-- vim.opt.list = true
|
||||
-- vim.opt.listchars:append "space:⋅"
|
||||
-- vim.opt.listchars:append "space:"
|
||||
-- vim.opt.listchars:append "eol:↴"
|
||||
|
||||
indent_blankline.setup({
|
||||
-- show_end_of_line = true,
|
||||
-- space_char_blankline = " ",
|
||||
show_current_context = true,
|
||||
-- show_current_context_start = true,
|
||||
-- char_highlight_list = {
|
||||
-- "IndentBlanklineIndent1",
|
||||
-- "IndentBlanklineIndent2",
|
||||
-- "IndentBlanklineIndent3",
|
||||
-- },
|
||||
})
|
96
lua/user/keymaps.lua
Normal file
96
lua/user/keymaps.lua
Normal file
|
@ -0,0 +1,96 @@
|
|||
local opts = { noremap = true, silent = true }
|
||||
|
||||
local term_opts = { silent = true }
|
||||
|
||||
-- Shorten function name
|
||||
local keymap = vim.api.nvim_set_keymap
|
||||
|
||||
--Remap space as leader key
|
||||
keymap("", "<Space>", "<Nop>", opts)
|
||||
vim.g.mapleader = " "
|
||||
vim.g.maplocalleader = " "
|
||||
|
||||
-- Modes
|
||||
-- normal_mode = "n",
|
||||
-- insert_mode = "i",
|
||||
-- visual_mode = "v",
|
||||
-- visual_block_mode = "x",
|
||||
-- term_mode = "t",
|
||||
-- command_mode = "c",
|
||||
|
||||
-- Normal --
|
||||
-- Better window navigation
|
||||
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)
|
||||
|
||||
-- Resize with arrows
|
||||
-- keymap("n", "<C-Up>", ":resize -2<CR>", opts)
|
||||
-- keymap("n", "<C-Down>", ":resize +2<CR>", opts)
|
||||
-- keymap("n", "<C-Left>", ":vertical resize -2<CR>", opts)
|
||||
-- keymap("n", "<C-Right>", ":vertical resize +2<CR>", opts)
|
||||
|
||||
-- Navigate buffers
|
||||
keymap("n", "<S-l>", ":bnext<CR>", opts)
|
||||
keymap("n", "<S-h>", ":bprevious<CR>", opts)
|
||||
|
||||
-- Move text up and down
|
||||
keymap("n", "<A-j>", "<Esc>:m .+1<CR>==gi", opts)
|
||||
keymap("n", "<A-k>", "<Esc>:m .-2<CR>==gi", opts)
|
||||
|
||||
-- Insert --
|
||||
-- Press jk fast to exit insert mode
|
||||
keymap("i", "jk", "<ESC>", opts)
|
||||
keymap("i", "kj", "<ESC>", opts)
|
||||
|
||||
-- Visual --
|
||||
-- Stay in indent mode
|
||||
keymap("v", "<", "<gv", opts)
|
||||
keymap("v", ">", ">gv", opts)
|
||||
|
||||
-- Move text up and down
|
||||
keymap("v", "<A-j>", ":m .+1<CR>==", opts)
|
||||
keymap("v", "<A-k>", ":m .-2<CR>==", opts)
|
||||
keymap("v", "p", '"_dP', opts)
|
||||
|
||||
-- Visual Block --
|
||||
-- Move text up and down
|
||||
keymap("x", "J", ":move '>+1<CR>gv-gv", opts)
|
||||
keymap("x", "K", ":move '<-2<CR>gv-gv", opts)
|
||||
keymap("x", "<A-j>", ":move '>+1<CR>gv-gv", opts)
|
||||
keymap("x", "<A-Down>", ":move '>+1<CR>gv-gv", opts)
|
||||
keymap("x", "<A-k>", ":move '<-2<CR>gv-gv", opts)
|
||||
keymap("x", "<A-Up>", ":move '<-2<CR>gv-gv", opts)
|
||||
|
||||
keymap("n", "<S-Down>", "<cmd>t.<cr>", opts)
|
||||
keymap("i", "<S-Down>", "<cmd>t.<cr>", opts)
|
||||
keymap("n", "<S-Up>", "<cmd>t -1<cr>", opts)
|
||||
keymap("i", "<S-Up>", "<cmd>t -1<cr>", opts)
|
||||
keymap("n", "<M-J>", "<cmd>t.<cr>", opts)
|
||||
keymap("n", "<M-K>", "<cmd>t -1<cr>", opts)
|
||||
keymap("n", "<M-Down>", "<cmd>m+<cr>", opts)
|
||||
keymap("i", "<M-Down>", "<cmd>m+<cr>", opts)
|
||||
keymap("n", "<M-Up>", "<cmd>m-2<cr>", opts)
|
||||
keymap("i", "<M-Up>", "<cmd>m-2<cr>", opts)
|
||||
keymap("n", "<M-j>", "<cmd>m+<cr>", opts)
|
||||
keymap("n", "<M-k>", "<cmd>m-2<cr>", opts)
|
||||
keymap("i", "<C-s>", "<cmd>w<cr>", opts)
|
||||
keymap("n", "<C-s>", "<cmd>w<cr>", opts)
|
||||
keymap("i", "<C-l>", "<cmd>LiveServer start<cr><cr>", opts)
|
||||
keymap("n", "q", "<cmd>q<cr>", opts)
|
||||
keymap("x", "<S-Down>", ":'<,'>t'><cr>", opts)
|
||||
|
||||
-- Visual Block --
|
||||
-- Move text up and down
|
||||
keymap("x", "J", ":move '>+1<CR>gv-gv", opts)
|
||||
keymap("x", "K", ":move '<-2<CR>gv-gv", opts)
|
||||
keymap("x", "<A-j>", ":move '>+1<CR>gv-gv", opts)
|
||||
keymap("x", "<A-k>", ":move '<-2<CR>gv-gv", opts)
|
||||
|
||||
-- Terminal --
|
||||
-- Better terminal navigation
|
||||
-- keymap("t", "<C-h>", "<C-\\><C-N><C-w>h", term_opts)
|
||||
-- keymap("t", "<C-j>", "<C-\\><C-N><C-w>j", term_opts)
|
||||
-- keymap("t", "<C-k>", "<C-\\><C-N><C-w>k", term_opts)
|
||||
-- keymap("t", "<C-l>", "<C-\\><C-N><C-w>l", term_opts)
|
25
lua/user/lsp/config.lua
Normal file
25
lua/user/lsp/config.lua
Normal file
|
@ -0,0 +1,25 @@
|
|||
local status_ok, lsp_installer = pcall(require, "nvim-lsp-installer")
|
||||
if not status_ok then
|
||||
return
|
||||
end
|
||||
|
||||
local lspconfig = require("lspconfig")
|
||||
|
||||
-- local servers = { "jsonls", "sumneko_lua","html","cssls","tsserver"}
|
||||
local servers = { "jdtls" }
|
||||
|
||||
lsp_installer.setup({
|
||||
ensure_installed = servers,
|
||||
})
|
||||
|
||||
for _, server in pairs(servers) do
|
||||
local opts = {
|
||||
on_attach = require("user.lsp.handlers").on_attach,
|
||||
capabilities = require("user.lsp.handlers").capabilities,
|
||||
}
|
||||
local has_custom_opts, server_custom_opts = pcall(require, "user.lsp.settings." .. server)
|
||||
if has_custom_opts then
|
||||
opts = vim.tbl_deep_extend("force", opts, server_custom_opts)
|
||||
end
|
||||
lspconfig[server].setup(opts)
|
||||
end
|
106
lua/user/lsp/handlers.lua
Normal file
106
lua/user/lsp/handlers.lua
Normal file
|
@ -0,0 +1,106 @@
|
|||
local M = {}
|
||||
|
||||
local status_cmp_ok, cmp_nvim_lsp = pcall(require, "cmp_nvim_lsp")
|
||||
if not status_cmp_ok then
|
||||
return
|
||||
end
|
||||
|
||||
local icons = require("user.icons")
|
||||
|
||||
M.capabilities = vim.lsp.protocol.make_client_capabilities()
|
||||
M.capabilities.textDocument.completion.completionItem.snippetSupport = true
|
||||
M.capabilities = cmp_nvim_lsp.default_capabilities(M.capabilities)
|
||||
|
||||
M.setup = function()
|
||||
local signs = {
|
||||
|
||||
-- { name = "DiagnosticSignError", text = "" },
|
||||
-- { name = "DiagnosticSignWarn", text = "" },
|
||||
-- { name = "DiagnosticSignHint", text = "" },
|
||||
-- { name = "DiagnosticSignInfo", text = "" },
|
||||
{ name = "DiagnosticSignError", text = icons.diagnostics.Error },
|
||||
{ name = "DiagnosticSignWarn", text = icons.diagnostics.Warning },
|
||||
{ name = "DiagnosticSignHint", text = icons.diagnostics.Hint },
|
||||
{ name = "DiagnosticSignInfo", text = icons.diagnostics.Info },
|
||||
}
|
||||
|
||||
for _, sign in ipairs(signs) do
|
||||
vim.fn.sign_define(sign.name, { texthl = sign.name, text = sign.text, numhl = "" })
|
||||
end
|
||||
|
||||
local config = {
|
||||
virtual_text = false, -- disable virtual text
|
||||
signs = {
|
||||
active = signs, -- show signs
|
||||
},
|
||||
update_in_insert = true,
|
||||
underline = true,
|
||||
severity_sort = true,
|
||||
float = {
|
||||
focusable = true,
|
||||
style = "minimal",
|
||||
border = "rounded",
|
||||
source = "always",
|
||||
header = "",
|
||||
prefix = "",
|
||||
},
|
||||
}
|
||||
|
||||
vim.diagnostic.config(config)
|
||||
|
||||
vim.lsp.handlers["textDocument/hover"] = vim.lsp.with(vim.lsp.handlers.hover, {
|
||||
border = "rounded",
|
||||
})
|
||||
|
||||
vim.lsp.handlers["textDocument/signatureHelp"] = vim.lsp.with(vim.lsp.handlers.signature_help, {
|
||||
border = "rounded",
|
||||
})
|
||||
end
|
||||
|
||||
local function attach_navic(client, bufnr)
|
||||
vim.g.navic_silence = true
|
||||
local status_ok, navic = pcall(require, "nvim-navic")
|
||||
if not status_ok then
|
||||
return
|
||||
end
|
||||
navic.attach(client, bufnr)
|
||||
end
|
||||
|
||||
local function lsp_keymaps(bufnr)
|
||||
local opts = { noremap = true, silent = true }
|
||||
local keymap = vim.api.nvim_buf_set_keymap
|
||||
keymap(bufnr, "n", "gD", "<cmd>lua vim.lsp.buf.declaration()<CR>", opts)
|
||||
keymap(bufnr, "n", "gd", "<cmd>lua vim.lsp.buf.definition()<CR>", opts)
|
||||
keymap(bufnr, "n", "K", "<cmd>lua vim.lsp.buf.hover()<CR>", opts)
|
||||
keymap(bufnr, "n", "gI", "<cmd>lua vim.lsp.buf.implementation()<CR>", opts)
|
||||
keymap(bufnr, "n", "gr", "<cmd>lua vim.lsp.buf.references()<CR>", opts)
|
||||
keymap(bufnr, "n", "gl", "<cmd>lua vim.diagnostic.open_float()<CR>", opts)
|
||||
keymap(bufnr, "n", "<leader>lf", "<cmd>lua vim.lsp.buf.format{ async = true }<cr>", opts)
|
||||
keymap(bufnr, "n", "<leader>li", "<cmd>LspInfo<cr>", opts)
|
||||
keymap(bufnr, "n", "<leader>lI", "<cmd>LspInstallInfo<cr>", opts)
|
||||
keymap(bufnr, "n", "<leader>la", "<cmd>lua vim.lsp.buf.code_action()<cr>", opts)
|
||||
keymap(bufnr, "n", "<leader>lj", "<cmd>lua vim.diagnostic.goto_next({buffer=0})<cr>", opts)
|
||||
keymap(bufnr, "n", "<leader>lk", "<cmd>lua vim.diagnostic.goto_prev({buffer=0})<cr>", opts)
|
||||
keymap(bufnr, "n", "<leader>lr", "<cmd>lua vim.lsp.buf.rename()<cr>", opts)
|
||||
keymap(bufnr, "n", "<leader>ls", "<cmd>lua vim.lsp.buf.signature_help()<CR>", opts)
|
||||
keymap(bufnr, "n", "<leader>lq", "<cmd>lua vim.diagnostic.setloclist()<CR>", opts)
|
||||
end
|
||||
M.on_attach = function(client, bufnr)
|
||||
attach_navic(client, bufnr)
|
||||
if client.name == "tsserver" then
|
||||
client.server_capabilities.documentFormattingProvider = false
|
||||
end
|
||||
|
||||
if client.name == "sumneko_lua" then
|
||||
client.server_capabilities.documentFormattingProvider = false
|
||||
end
|
||||
|
||||
lsp_keymaps(bufnr)
|
||||
local status_ok, illuminate = pcall(require, "illuminate")
|
||||
if not status_ok then
|
||||
return
|
||||
end
|
||||
illuminate.on_attach(client)
|
||||
end
|
||||
|
||||
return M
|
9
lua/user/lsp/init.lua
Normal file
9
lua/user/lsp/init.lua
Normal file
|
@ -0,0 +1,9 @@
|
|||
local status_ok, _ = pcall(require, "lspconfig")
|
||||
if not status_ok then
|
||||
return
|
||||
end
|
||||
|
||||
require "user.lsp.mason"
|
||||
require "user.lsp.config" -- ini hanya untuk windows supaya jdtls jalan, kalau pakai linu x remark saja
|
||||
require("user.lsp.handlers").setup()
|
||||
require "user.lsp.null-ls"
|
56
lua/user/lsp/mason.lua
Normal file
56
lua/user/lsp/mason.lua
Normal file
|
@ -0,0 +1,56 @@
|
|||
local servers = {
|
||||
"sumneko_lua",
|
||||
"cssls",
|
||||
"html",
|
||||
"tsserver",
|
||||
"pyright",
|
||||
-- "bashls",
|
||||
"jsonls",
|
||||
-- "yamlls",
|
||||
-- "jdtls",
|
||||
"emmet_ls",
|
||||
"intelephense",
|
||||
"marksman",
|
||||
}
|
||||
|
||||
local settings = {
|
||||
ui = {
|
||||
border = "none",
|
||||
icons = {
|
||||
package_installed = "◍",
|
||||
package_pending = "◍",
|
||||
package_uninstalled = "◍",
|
||||
},
|
||||
},
|
||||
log_level = vim.log.levels.INFO,
|
||||
max_concurrent_installers = 4,
|
||||
}
|
||||
|
||||
require("mason").setup(settings)
|
||||
require("mason-lspconfig").setup({
|
||||
ensure_installed = servers,
|
||||
automatic_installation = true,
|
||||
})
|
||||
|
||||
local lspconfig_status_ok, lspconfig = pcall(require, "lspconfig")
|
||||
if not lspconfig_status_ok then
|
||||
return
|
||||
end
|
||||
|
||||
local opts = {}
|
||||
|
||||
for _, server in pairs(servers) do
|
||||
opts = {
|
||||
on_attach = require("user.lsp.handlers").on_attach,
|
||||
capabilities = require("user.lsp.handlers").capabilities,
|
||||
}
|
||||
|
||||
server = vim.split(server, "@")[1]
|
||||
|
||||
local require_ok, conf_opts = pcall(require, "user.lsp.settings." .. server)
|
||||
if require_ok then
|
||||
opts = vim.tbl_deep_extend("force", conf_opts, opts)
|
||||
end
|
||||
|
||||
lspconfig[server].setup(opts)
|
||||
end
|
44
lua/user/lsp/null-ls.lua
Normal file
44
lua/user/lsp/null-ls.lua
Normal file
|
@ -0,0 +1,44 @@
|
|||
local null_ls_status_ok, null_ls = pcall(require, "null-ls")
|
||||
if not null_ls_status_ok then
|
||||
return
|
||||
end
|
||||
|
||||
-- https://github.com/jose-elias-alvarez/null-ls.nvim/tree/main/lua/null-ls/builtins/formatting
|
||||
local formatting = null_ls.builtins.formatting
|
||||
-- https://github.com/jose-elias-alvarez/null-ls.nvim/tree/main/lua/null-ls/builtins/diagnostics
|
||||
local diagnostics = null_ls.builtins.diagnostics
|
||||
|
||||
local augroup = vim.api.nvim_create_augroup("LspFormatting", {})
|
||||
|
||||
null_ls.setup({
|
||||
debug = false,
|
||||
sources = {
|
||||
--formatting.prettier.with({ extra_args = { "--no-semi", "--single-quote", "--jsx-single-quote" } }),
|
||||
formatting.prettier,
|
||||
formatting.prettierd,
|
||||
formatting.black.with({ extra_args = { "--fast" } }),
|
||||
formatting.stylua,
|
||||
formatting.eslint_d,
|
||||
formatting.google_java_format,
|
||||
formatting.phpcbf,
|
||||
-- formatting.clang_format,
|
||||
-- diagnostics.flake8
|
||||
},
|
||||
|
||||
on_attach = function(client, bufnr)
|
||||
--if client.resolved_capabilities.document_formatting then
|
||||
--vim.cmd("autocmd BufWritePre <buffer> lua vim.lsp.buf.format{async=true}")
|
||||
--end
|
||||
if client.supports_method("textDocument/formatting") then
|
||||
vim.api.nvim_clear_autocmds({ group = augroup, buffer = bufnr })
|
||||
vim.api.nvim_create_autocmd("BufWritePre", {
|
||||
group = augroup,
|
||||
buffer = bufnr,
|
||||
callback = function()
|
||||
vim.lsp.buf.format({ bufnr = bufnr })
|
||||
-- vim.lsp.buf.formatting_sync()
|
||||
end,
|
||||
})
|
||||
end
|
||||
end,
|
||||
})
|
197
lua/user/lsp/settings/jsonls.lua
Normal file
197
lua/user/lsp/settings/jsonls.lua
Normal file
|
@ -0,0 +1,197 @@
|
|||
local default_schemas = nil
|
||||
local status_ok, jsonls_settings = pcall(require, "nlspsettings.jsonls")
|
||||
if status_ok then
|
||||
default_schemas = jsonls_settings.get_default_schemas()
|
||||
end
|
||||
|
||||
local schemas = {
|
||||
{
|
||||
description = "TypeScript compiler configuration file",
|
||||
fileMatch = {
|
||||
"tsconfig.json",
|
||||
"tsconfig.*.json",
|
||||
},
|
||||
url = "https://json.schemastore.org/tsconfig.json",
|
||||
},
|
||||
{
|
||||
description = "Lerna config",
|
||||
fileMatch = { "lerna.json" },
|
||||
url = "https://json.schemastore.org/lerna.json",
|
||||
},
|
||||
{
|
||||
description = "Babel configuration",
|
||||
fileMatch = {
|
||||
".babelrc.json",
|
||||
".babelrc",
|
||||
"babel.config.json",
|
||||
},
|
||||
url = "https://json.schemastore.org/babelrc.json",
|
||||
},
|
||||
{
|
||||
description = "ESLint config",
|
||||
fileMatch = {
|
||||
".eslintrc.json",
|
||||
".eslintrc",
|
||||
},
|
||||
url = "https://json.schemastore.org/eslintrc.json",
|
||||
},
|
||||
{
|
||||
description = "Bucklescript config",
|
||||
fileMatch = { "bsconfig.json" },
|
||||
url = "https://raw.githubusercontent.com/rescript-lang/rescript-compiler/8.2.0/docs/docson/build-schema.json",
|
||||
},
|
||||
{
|
||||
description = "Prettier config",
|
||||
fileMatch = {
|
||||
".prettierrc",
|
||||
".prettierrc.json",
|
||||
"prettier.config.json",
|
||||
},
|
||||
url = "https://json.schemastore.org/prettierrc",
|
||||
},
|
||||
{
|
||||
description = "Vercel Now config",
|
||||
fileMatch = { "now.json" },
|
||||
url = "https://json.schemastore.org/now",
|
||||
},
|
||||
{
|
||||
description = "Stylelint config",
|
||||
fileMatch = {
|
||||
".stylelintrc",
|
||||
".stylelintrc.json",
|
||||
"stylelint.config.json",
|
||||
},
|
||||
url = "https://json.schemastore.org/stylelintrc",
|
||||
},
|
||||
{
|
||||
description = "A JSON schema for the ASP.NET LaunchSettings.json files",
|
||||
fileMatch = { "launchsettings.json" },
|
||||
url = "https://json.schemastore.org/launchsettings.json",
|
||||
},
|
||||
{
|
||||
description = "Schema for CMake Presets",
|
||||
fileMatch = {
|
||||
"CMakePresets.json",
|
||||
"CMakeUserPresets.json",
|
||||
},
|
||||
url = "https://raw.githubusercontent.com/Kitware/CMake/master/Help/manual/presets/schema.json",
|
||||
},
|
||||
{
|
||||
description = "Configuration file as an alternative for configuring your repository in the settings page.",
|
||||
fileMatch = {
|
||||
".codeclimate.json",
|
||||
},
|
||||
url = "https://json.schemastore.org/codeclimate.json",
|
||||
},
|
||||
{
|
||||
description = "LLVM compilation database",
|
||||
fileMatch = {
|
||||
"compile_commands.json",
|
||||
},
|
||||
url = "https://json.schemastore.org/compile-commands.json",
|
||||
},
|
||||
{
|
||||
description = "Config file for Command Task Runner",
|
||||
fileMatch = {
|
||||
"commands.json",
|
||||
},
|
||||
url = "https://json.schemastore.org/commands.json",
|
||||
},
|
||||
{
|
||||
description = "AWS CloudFormation provides a common language for you to describe and provision all the infrastructure resources in your cloud environment.",
|
||||
fileMatch = {
|
||||
"*.cf.json",
|
||||
"cloudformation.json",
|
||||
},
|
||||
url = "https://raw.githubusercontent.com/awslabs/goformation/v5.2.9/schema/cloudformation.schema.json",
|
||||
},
|
||||
{
|
||||
description = "The AWS Serverless Application Model (AWS SAM, previously known as Project Flourish) extends AWS CloudFormation to provide a simplified way of defining the Amazon API Gateway APIs, AWS Lambda functions, and Amazon DynamoDB tables needed by your serverless application.",
|
||||
fileMatch = {
|
||||
"serverless.template",
|
||||
"*.sam.json",
|
||||
"sam.json",
|
||||
},
|
||||
url = "https://raw.githubusercontent.com/awslabs/goformation/v5.2.9/schema/sam.schema.json",
|
||||
},
|
||||
{
|
||||
description = "Json schema for properties json file for a GitHub Workflow template",
|
||||
fileMatch = {
|
||||
".github/workflow-templates/**.properties.json",
|
||||
},
|
||||
url = "https://json.schemastore.org/github-workflow-template-properties.json",
|
||||
},
|
||||
{
|
||||
description = "golangci-lint configuration file",
|
||||
fileMatch = {
|
||||
".golangci.toml",
|
||||
".golangci.json",
|
||||
},
|
||||
url = "https://json.schemastore.org/golangci-lint.json",
|
||||
},
|
||||
{
|
||||
description = "JSON schema for the JSON Feed format",
|
||||
fileMatch = {
|
||||
"feed.json",
|
||||
},
|
||||
url = "https://json.schemastore.org/feed.json",
|
||||
versions = {
|
||||
["1"] = "https://json.schemastore.org/feed-1.json",
|
||||
["1.1"] = "https://json.schemastore.org/feed.json",
|
||||
},
|
||||
},
|
||||
{
|
||||
description = "Packer template JSON configuration",
|
||||
fileMatch = {
|
||||
"packer.json",
|
||||
},
|
||||
url = "https://json.schemastore.org/packer.json",
|
||||
},
|
||||
{
|
||||
description = "NPM configuration file",
|
||||
fileMatch = {
|
||||
"package.json",
|
||||
},
|
||||
url = "https://json.schemastore.org/package.json",
|
||||
},
|
||||
{
|
||||
description = "JSON schema for Visual Studio component configuration files",
|
||||
fileMatch = {
|
||||
"*.vsconfig",
|
||||
},
|
||||
url = "https://json.schemastore.org/vsconfig.json",
|
||||
},
|
||||
{
|
||||
description = "Resume json",
|
||||
fileMatch = { "resume.json" },
|
||||
url = "https://raw.githubusercontent.com/jsonresume/resume-schema/v1.0.0/schema.json",
|
||||
},
|
||||
}
|
||||
|
||||
local function extend(tab1, tab2)
|
||||
for _, value in ipairs(tab2 or {}) do
|
||||
table.insert(tab1, value)
|
||||
end
|
||||
return tab1
|
||||
end
|
||||
|
||||
local extended_schemas = extend(schemas, default_schemas)
|
||||
|
||||
local opts = {
|
||||
settings = {
|
||||
json = {
|
||||
schemas = extended_schemas,
|
||||
},
|
||||
},
|
||||
setup = {
|
||||
commands = {
|
||||
Format = {
|
||||
function()
|
||||
vim.lsp.buf.range_formatting({}, { 0, 0 }, { vim.fn.line "$", 0 })
|
||||
end,
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
return opts
|
9
lua/user/lsp/settings/pyright.lua
Normal file
9
lua/user/lsp/settings/pyright.lua
Normal file
|
@ -0,0 +1,9 @@
|
|||
return {
|
||||
settings = {
|
||||
python = {
|
||||
analysis = {
|
||||
typeCheckingMode = "off",
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
16
lua/user/lsp/settings/sumneko_lua.lua
Normal file
16
lua/user/lsp/settings/sumneko_lua.lua
Normal file
|
@ -0,0 +1,16 @@
|
|||
return {
|
||||
settings = {
|
||||
|
||||
Lua = {
|
||||
diagnostics = {
|
||||
globals = { "vim" },
|
||||
},
|
||||
workspace = {
|
||||
library = {
|
||||
[vim.fn.expand("$VIMRUNTIME/lua")] = true,
|
||||
[vim.fn.stdpath("config") .. "/lua"] = true,
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
163
lua/user/lualine.lua
Normal file
163
lua/user/lualine.lua
Normal file
|
@ -0,0 +1,163 @@
|
|||
local status_ok, lualine = pcall(require, "lualine")
|
||||
if not status_ok then
|
||||
return
|
||||
end
|
||||
local icons = require("user.icons")
|
||||
local hide_in_width = function()
|
||||
return vim.fn.winwidth(0) > 80
|
||||
end
|
||||
|
||||
local conditions = {
|
||||
buffer_not_empty = function()
|
||||
return vim.fn.empty(vim.fn.expand("%:t")) ~= 1
|
||||
end,
|
||||
hide_in_width = function()
|
||||
return vim.fn.winwidth(0) > 80
|
||||
end,
|
||||
check_git_workspace = function()
|
||||
local filepath = vim.fn.expand("%:p:h")
|
||||
local gitdir = vim.fn.finddir(".git", filepath .. ";")
|
||||
return gitdir and #gitdir > 0 and #gitdir < #filepath
|
||||
end,
|
||||
}
|
||||
|
||||
local diagnostics = {
|
||||
"diagnostics",
|
||||
sources = { "nvim_diagnostic" },
|
||||
sections = { "error", "warn" },
|
||||
-- symbols = { error = " ", warn = " " },
|
||||
symbols = {
|
||||
error = icons.diagnostics.BoldError .. " ",
|
||||
warn = icons.diagnostics.BoldWarning .. " ",
|
||||
},
|
||||
colored = true,
|
||||
update_in_insert = false,
|
||||
always_visible = false,
|
||||
}
|
||||
|
||||
local diff = {
|
||||
"diff",
|
||||
colored = true,
|
||||
-- symbols = { added = " ", modified = " ", removed = " " }, -- changes diff symbols
|
||||
symbols = {
|
||||
added = icons.git.LineAdded .. " ",
|
||||
modified = icons.git.LineModified .. " ",
|
||||
removed = icons.git.LineRemoved .. " ",
|
||||
}, -- changes diff symbols
|
||||
cond = hide_in_width,
|
||||
}
|
||||
|
||||
local mode = {
|
||||
"mode",
|
||||
fmt = function(str)
|
||||
return "-- " .. str .. " --"
|
||||
end,
|
||||
}
|
||||
|
||||
local filetype = {
|
||||
"filetype",
|
||||
icons_enabled = true,
|
||||
icon = nil,
|
||||
}
|
||||
|
||||
local branch = {
|
||||
"branch",
|
||||
icons_enabled = true,
|
||||
--icon = "",
|
||||
icon = icons.git.Branch,
|
||||
}
|
||||
|
||||
local location = {
|
||||
"location",
|
||||
padding = 0,
|
||||
}
|
||||
|
||||
-- cool function for progress
|
||||
local progress = function()
|
||||
local current_line = vim.fn.line(".")
|
||||
local total_lines = vim.fn.line("$")
|
||||
local chars = { "__", "▁▁", "▂▂", "▃▃", "▄▄", "▅▅", "▆▆", "▇▇", "██" }
|
||||
local line_ratio = current_line / total_lines
|
||||
local index = math.ceil(line_ratio * #chars)
|
||||
return chars[index]
|
||||
end
|
||||
|
||||
local spaces = function()
|
||||
-- return "->| " .. vim.api.nvim_buf_get_option(0, "shiftwidth")
|
||||
return icons.ui.Tab .. " " .. vim.api.nvim_buf_get_option(0, "shiftwidth")
|
||||
end
|
||||
|
||||
local file_name = {
|
||||
"filename",
|
||||
cond = conditions.buffer_not_empty,
|
||||
}
|
||||
|
||||
local lsp_info = {
|
||||
function()
|
||||
--local msg = "No Active Lsp"
|
||||
local msg = "LS Inactive"
|
||||
local buf_ft = vim.api.nvim_buf_get_option(0, "filetype")
|
||||
local clients = vim.lsp.get_active_clients()
|
||||
if next(clients) == nil then
|
||||
for i, name in ipairs(clients) do
|
||||
msg = msg .. " " .. name
|
||||
end
|
||||
return msg
|
||||
end
|
||||
for _, client in ipairs(clients) do
|
||||
local filetypes = client.config.filetypes
|
||||
if filetypes and vim.fn.index(filetypes, buf_ft) ~= -1 then
|
||||
if msg == "LS Inactive" then
|
||||
msg = ""
|
||||
msg = msg .. client.name
|
||||
else
|
||||
msg = msg .. ", " .. client.name
|
||||
end
|
||||
end
|
||||
end
|
||||
return msg
|
||||
end,
|
||||
--icon = " ",
|
||||
icon = icons.ui.Gear .. "",
|
||||
}
|
||||
|
||||
lualine.setup({
|
||||
options = {
|
||||
icons_enabled = true,
|
||||
theme = "auto",
|
||||
component_separators = { left = "", right = "" },
|
||||
section_separators = { left = "", right = "" },
|
||||
disabled_filetypes = {
|
||||
"TelescopePrompt",
|
||||
"packer",
|
||||
"alpha",
|
||||
"dashboard",
|
||||
"NvimTree",
|
||||
"Outline",
|
||||
"DressingInput",
|
||||
"toggleterm",
|
||||
"lazy",
|
||||
},
|
||||
always_divide_middle = true,
|
||||
},
|
||||
sections = {
|
||||
lualine_a = { branch },
|
||||
lualine_b = { mode },
|
||||
lualine_c = { diagnostics, lsp_info },
|
||||
-- lualine_c = { file_name, lsp_info },
|
||||
-- lualine_x = { "encoding", "fileformat", "filetype" },
|
||||
lualine_x = { diff, spaces, "encoding", filetype },
|
||||
lualine_y = { location },
|
||||
lualine_z = { progress },
|
||||
},
|
||||
inactive_sections = {
|
||||
lualine_a = {},
|
||||
lualine_b = {},
|
||||
lualine_c = { "filename" },
|
||||
lualine_x = { "location" },
|
||||
lualine_y = {},
|
||||
lualine_z = {},
|
||||
},
|
||||
tabline = {},
|
||||
extensions = {},
|
||||
})
|
6
lua/user/mason-null-ls.lua
Normal file
6
lua/user/mason-null-ls.lua
Normal file
|
@ -0,0 +1,6 @@
|
|||
local status_ok, mason_null_ls = pcall(require, "mason-null-ls")
|
||||
if not status_ok then
|
||||
return
|
||||
end
|
||||
mason_null_ls.setup({ automatic_setup = true })
|
||||
mason_null_ls.setup_handlers({})
|
5
lua/user/neoscroll.lua
Normal file
5
lua/user/neoscroll.lua
Normal file
|
@ -0,0 +1,5 @@
|
|||
local status_ok, neoscroll = pcall(require, "neoscroll")
|
||||
if not status_ok then
|
||||
return
|
||||
end
|
||||
neoscroll.setup()
|
87
lua/user/nvim-tree.lua
Normal file
87
lua/user/nvim-tree.lua
Normal file
|
@ -0,0 +1,87 @@
|
|||
local status_ok, nvim_tree = pcall(require, "nvim-tree")
|
||||
if not status_ok then
|
||||
return
|
||||
end
|
||||
|
||||
local config_status_ok, nvim_tree_config = pcall(require, "nvim-tree.config")
|
||||
if not config_status_ok then
|
||||
return
|
||||
end
|
||||
|
||||
local tree_cb = nvim_tree_config.nvim_tree_callback
|
||||
local icons = require("user.icons")
|
||||
|
||||
nvim_tree.setup({
|
||||
update_focused_file = {
|
||||
enable = true,
|
||||
update_cwd = true,
|
||||
},
|
||||
renderer = {
|
||||
root_folder_modifier = ":t",
|
||||
indent_markers = {
|
||||
enable = true,
|
||||
inline_arrows = true,
|
||||
icons = {
|
||||
corner = "└",
|
||||
edge = "│",
|
||||
item = "│",
|
||||
bottom = "─",
|
||||
none = " ",
|
||||
},
|
||||
},
|
||||
icons = {
|
||||
webdev_colors = true,
|
||||
show = {
|
||||
git = true,
|
||||
folder = true,
|
||||
file = true,
|
||||
folder_arrow = true,
|
||||
},
|
||||
glyphs = {
|
||||
default = icons.ui.Text,
|
||||
symlink = icons.ui.FileSymlink,
|
||||
folder = {
|
||||
arrow_open = icons.ui.ChevronShortDown,
|
||||
arrow_closed = icons.ui.ChevronShortRight,
|
||||
default = icons.ui.Folder,
|
||||
empty = icons.ui.EmptyFolder,
|
||||
empty_open = icons.ui.EmptyFolderOpen,
|
||||
open = icons.ui.FolderOpen,
|
||||
symlink = icons.ui.FolderSymlink,
|
||||
symlink_open = icons.ui.FolderSymlink,
|
||||
},
|
||||
git = {
|
||||
deleted = icons.git.FileDeleted,
|
||||
ignored = icons.git.FileIgnored,
|
||||
renamed = icons.git.FileRenamed,
|
||||
staged = icons.git.FileStaged,
|
||||
unmerged = icons.git.FileUnmerged,
|
||||
unstaged = icons.git.FileUnstaged,
|
||||
untracked = icons.git.FileUntracked,
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
diagnostics = {
|
||||
enable = true,
|
||||
show_on_dirs = true,
|
||||
icons = {
|
||||
hint = icons.diagnostics.BoldHint,
|
||||
info = icons.diagnostics.BoldInformation,
|
||||
warning = icons.diagnostics.BoldWarning,
|
||||
error = icons.diagnostics.BoldError,
|
||||
},
|
||||
},
|
||||
view = {
|
||||
width = 30,
|
||||
hide_root_folder = true,
|
||||
side = "left",
|
||||
mappings = {
|
||||
list = {
|
||||
{ key = { "l", "<CR>", "o" }, cb = tree_cb("edit") },
|
||||
{ key = "h", cb = tree_cb("close_node") },
|
||||
{ key = "v", cb = tree_cb("vsplit") },
|
||||
},
|
||||
},
|
||||
},
|
||||
})
|
9
lua/user/nvimscroll.lua
Normal file
9
lua/user/nvimscroll.lua
Normal file
|
@ -0,0 +1,9 @@
|
|||
local status_ok, scrollview = pcall(require, "scrollview")
|
||||
if not status_ok then
|
||||
return
|
||||
end
|
||||
scrollview.setup({
|
||||
bg = "LightCyan",
|
||||
ctermbg = 160,
|
||||
})
|
||||
vim.g.scrollview_excluded_filetypes = { "NvimTree", "vista_kind" }
|
55
lua/user/options.lua
Normal file
55
lua/user/options.lua
Normal file
|
@ -0,0 +1,55 @@
|
|||
local options = {
|
||||
backspace = vim.opt.backspace + { "nostop" }, -- Don't stop backspace at insert
|
||||
clipboard = "unnamedplus", -- Connection to the system clipboard
|
||||
cmdheight = 0, -- hide command line unless needed
|
||||
completeopt = { "menuone", "noselect" }, -- Options for insert mode completion
|
||||
copyindent = true, -- Copy the previous indentation on autoindenting
|
||||
cursorline = true, -- Highlight the text line of the cursor
|
||||
expandtab = true, -- Enable the use of space in tab
|
||||
fileencoding = "utf-8", -- File content encoding for the buffer
|
||||
fillchars = { eob = " " }, -- Disable `~` on nonexistent lines
|
||||
history = 100, -- Number of commands to remember in a history table
|
||||
ignorecase = true, -- Case insensitive searching
|
||||
laststatus = 3, -- globalstatus
|
||||
lazyredraw = true, -- lazily redraw screen
|
||||
mouse = "a", -- Enable mouse support
|
||||
number = true, -- Show numberline
|
||||
preserveindent = true, -- Preserve indent structure as much as possible
|
||||
pumheight = 10, -- Height of the pop up menu
|
||||
relativenumber = true, -- Show relative numberline
|
||||
scrolloff = 8, -- Number of lines to keep above and below the cursor
|
||||
shiftwidth = 2, -- Number of space inserted for indentation
|
||||
showmode = false, -- Disable showing modes in command line
|
||||
showtabline = 2, -- always display tabline
|
||||
sidescrolloff = 8, -- Number of columns to keep at the sides of the cursor
|
||||
signcolumn = "yes", -- Always show the sign column
|
||||
smartcase = true, -- Case sensitivie searching
|
||||
splitbelow = true, -- Splitting a new window below the current one
|
||||
splitright = true, -- Splitting a new window at the right of the current one
|
||||
swapfile = false, -- Disable use of swapfile for the buffer
|
||||
tabstop = 2, -- Number of space in a tab
|
||||
termguicolors = true, -- Enable 24-bit RGB color in the TUI
|
||||
timeoutlen = 300, -- Length of time to wait for a mapped sequence
|
||||
undofile = true, -- Enable persistent undo
|
||||
updatetime = 300, -- Length of time to wait before triggering the plugin
|
||||
wrap = true, -- Disable wrapping of lines longer than the width of window
|
||||
writebackup = false, -- Disable making a backup before overwriting a file
|
||||
-- minimal number of screen columns either side of cursor if wrap is `false`
|
||||
-- guifont = "monospace:h17", -- the font used in graphical neovim applications
|
||||
-- guifont = "Source_Code_Pro:h17", -- the font used in graphical neovim applications
|
||||
guifont = "Hack_Nerd_Font:h17", -- the font used in graphical neovim applications
|
||||
whichwrap = "bs<>[]hl", -- which "horizontal" keys are allowed to travel to prev/next line -- which "horizontal" keys are allowed to travel to prev/next line
|
||||
}
|
||||
|
||||
for k, v in pairs(options) do
|
||||
vim.opt[k] = v
|
||||
end
|
||||
|
||||
-- vim.opt.shortmess = "ilmnrx" -- flags to shorten vim messages, see :help 'shortmess'
|
||||
-- vim.o.winbar = "%{%v:lua.require'nvim-navic'.get_location()%}"
|
||||
vim.opt.shortmess:append("c") -- don't give |ins-completion-menu| messages
|
||||
vim.opt.iskeyword:append("-") -- hyphenated words recognized by searches
|
||||
vim.opt.formatoptions:remove({ "t", "c", "q", "j" })
|
||||
vim.opt.formatoptions = "croql"
|
||||
-- vim.opt.formatoptions:remove({ "c", "r", "o" }) -- don't insert the current comment leader automatically for auto-wrapping comments using 'textwidth', hitting <Enter> in insert mode, or hitting 'o' or 'O' in normal mode.
|
||||
vim.opt.runtimepath:remove("/usr/share/vim/vimfiles") -- separate vim plugins from neovim in case vim still in use
|
396
lua/user/plugins.lua
Normal file
396
lua/user/plugins.lua
Normal file
|
@ -0,0 +1,396 @@
|
|||
local fn = vim.fn
|
||||
|
||||
-- Automatically install packer
|
||||
local install_path = fn.stdpath("data") .. "/site/pack/packer/start/packer.nvim"
|
||||
if fn.empty(fn.glob(install_path)) > 0 then
|
||||
PACKER_BOOTSTRAP = fn.system({
|
||||
"git",
|
||||
"clone",
|
||||
"--depth",
|
||||
"1",
|
||||
"https://github.com/wbthomason/packer.nvim",
|
||||
install_path,
|
||||
})
|
||||
print("Installing packer close and reopen Neovim...")
|
||||
vim.cmd([[packadd packer.nvim]])
|
||||
end
|
||||
|
||||
-- Autocommand that reloads neovim whenever you save the plugins.lua file
|
||||
vim.cmd([[
|
||||
augroup packer_user_config
|
||||
autocmd!
|
||||
autocmd BufWritePost plugins.lua source <afile> | PackerSync
|
||||
augroup end
|
||||
]])
|
||||
|
||||
-- Use a protected call so we don't error out on first use
|
||||
local status_ok, packer = pcall(require, "packer")
|
||||
if not status_ok then
|
||||
return
|
||||
end
|
||||
|
||||
-- Have packer use a popup window
|
||||
packer.init({
|
||||
display = {
|
||||
open_fn = function()
|
||||
return require("packer.util").float({ border = "rounded" })
|
||||
end,
|
||||
},
|
||||
})
|
||||
|
||||
-- Install your plugins here
|
||||
return packer.startup(function(use)
|
||||
use({
|
||||
"wbthomason/packer.nvim",
|
||||
commit = "6afb67460283f0e990d35d229fd38fdc04063e0a",
|
||||
-- config = function()
|
||||
-- require("user.plugins")
|
||||
-- end,
|
||||
}) -- Have packer manage itself
|
||||
use({
|
||||
"nvim-lua/plenary.nvim",
|
||||
commit = "4b7e52044bbb84242158d977a50c4cbcd85070c7",
|
||||
event = "BufWinEnter",
|
||||
module = "plenary",
|
||||
}) -- Useful lua functions used by lots of plugins
|
||||
use({
|
||||
"windwp/nvim-autopairs",
|
||||
commit = "4fc96c8f3df89b6d23e5092d31c866c53a346347",
|
||||
after = "nvim-cmp",
|
||||
config = function()
|
||||
require("user.autopairs")
|
||||
end,
|
||||
}) -- Autopairs, integrates with both cmp and treesitter
|
||||
use({
|
||||
"numToStr/Comment.nvim",
|
||||
commit = "97a188a98b5a3a6f9b1b850799ac078faa17ab67",
|
||||
event = "BufReadPost",
|
||||
config = function()
|
||||
require("user.comment")
|
||||
end,
|
||||
})
|
||||
use({
|
||||
"JoosepAlviste/nvim-ts-context-commentstring",
|
||||
commit = "4d3a68c41a53add8804f471fcc49bb398fe8de08",
|
||||
event = "BufReadPost",
|
||||
after = "nvim-treesitter",
|
||||
})
|
||||
use({
|
||||
"kyazdani42/nvim-web-devicons",
|
||||
commit = "563f3635c2d8a7be7933b9e547f7c178ba0d4352",
|
||||
module = "nvim-web-devicons",
|
||||
config = function()
|
||||
require("user.webdevicons")
|
||||
end,
|
||||
})
|
||||
use({
|
||||
"kyazdani42/nvim-tree.lua",
|
||||
commit = "7282f7de8aedf861fe0162a559fc2b214383c51c",
|
||||
-- ini dirimak karena jadi tab tidak kebuka full
|
||||
-- on = { "NvimTreeToggle" },
|
||||
-- cmd = "NvimTreeToggle",
|
||||
require = "kyazdani42/nvim-web-devicons",
|
||||
config = function()
|
||||
require("user.nvim-tree")
|
||||
end,
|
||||
})
|
||||
use({
|
||||
"akinsho/bufferline.nvim",
|
||||
commit = "83bf4dc7bff642e145c8b4547aa596803a8b4dc4",
|
||||
require = "kyazdani42/nvim-web-devicons",
|
||||
event = "BufWinEnter",
|
||||
config = function()
|
||||
require("user.bufferline")
|
||||
end,
|
||||
})
|
||||
use({ "moll/vim-bbye", commit = "25ef93ac5a87526111f43e5110675032dbcacf56" })
|
||||
use({
|
||||
"nvim-lualine/lualine.nvim",
|
||||
commit = "a52f078026b27694d2290e34efa61a6e4a690621",
|
||||
require = { "kyazdani42/nvim-web-devicons", opt = true },
|
||||
event = "BufWinEnter",
|
||||
config = function()
|
||||
require("user.lualine")
|
||||
end,
|
||||
})
|
||||
use({
|
||||
"akinsho/toggleterm.nvim",
|
||||
commit = "2a787c426ef00cb3488c11b14f5dcf892bbd0bda",
|
||||
module = "toggleterm",
|
||||
cmd = "Toggleterm",
|
||||
event = "BufWinEnter",
|
||||
config = function()
|
||||
require("user.toggleterm")
|
||||
end,
|
||||
})
|
||||
use({ "ahmedkhalf/project.nvim", commit = "628de7e433dd503e782831fe150bb750e56e55d6" })
|
||||
use({
|
||||
"lewis6991/impatient.nvim",
|
||||
commit = "b842e16ecc1a700f62adb9802f8355b99b52a5a6",
|
||||
config = function()
|
||||
require("user.impatient")
|
||||
end,
|
||||
})
|
||||
use({
|
||||
"lukas-reineke/indent-blankline.nvim",
|
||||
commit = "db7cbcb40cc00fc5d6074d7569fb37197705e7f6",
|
||||
event = "BufRead",
|
||||
config = function()
|
||||
require("user.indentline")
|
||||
end,
|
||||
})
|
||||
use({
|
||||
"goolord/alpha-nvim",
|
||||
commit = "0bb6fc0646bcd1cdb4639737a1cee8d6e08bcc31",
|
||||
module = "alpha",
|
||||
event = "BufWinEnter",
|
||||
config = function()
|
||||
require("user.alpha")
|
||||
end,
|
||||
})
|
||||
use({
|
||||
"folke/which-key.nvim",
|
||||
event = "BufWinEnter",
|
||||
config = function()
|
||||
require("user.whichkey")
|
||||
end,
|
||||
})
|
||||
|
||||
-- Colorschemes
|
||||
use({
|
||||
"folke/tokyonight.nvim",
|
||||
commit = "66bfc2e8f754869c7b651f3f47a2ee56ae557764",
|
||||
-- ini diremark karena tab diatas jadi tidak ada warnanya
|
||||
-- event = "BufWinEnter",
|
||||
config = function()
|
||||
require("user.tokyonight")
|
||||
-- require("user.colorscheme")
|
||||
end,
|
||||
})
|
||||
|
||||
-- Cmp
|
||||
use({
|
||||
"hrsh7th/nvim-cmp",
|
||||
commit = "b0dff0ec4f2748626aae13f011d1a47071fe9abc",
|
||||
event = "BufWinEnter",
|
||||
config = function()
|
||||
require("user.cmp")
|
||||
end,
|
||||
}) -- The completion plugin
|
||||
use({ "hrsh7th/cmp-buffer", commit = "3022dbc9166796b644a841a02de8dd1cc1d311fa", after = "nvim-cmp" }) -- buffer completions
|
||||
use({ "hrsh7th/cmp-path", commit = "447c87cdd6e6d6a1d2488b1d43108bfa217f56e1", after = "nvim-cmp" }) -- path completions
|
||||
use({ "saadparwaiz1/cmp_luasnip", commit = "a9de941bcbda508d0a45d28ae366bb3f08db2e36", after = "nvim-cmp" }) -- snippet completions
|
||||
use({
|
||||
"hrsh7th/cmp-nvim-lsp",
|
||||
commit = "3cf38d9c957e95c397b66f91967758b31be4abe6",
|
||||
after = "nvim-cmp",
|
||||
event = "BufWinEnter",
|
||||
})
|
||||
use({ "hrsh7th/cmp-nvim-lua", commit = "d276254e7198ab7d00f117e88e223b4bd8c02d21", after = "nvim-cmp" })
|
||||
|
||||
-- Snippets
|
||||
use({
|
||||
"L3MON4D3/LuaSnip",
|
||||
commit = "8f8d493e7836f2697df878ef9c128337cbf2bb84",
|
||||
module = "luasnip",
|
||||
wants = "friendly-snippets",
|
||||
config = function()
|
||||
require("user.snip")
|
||||
end,
|
||||
}) --snippet engine
|
||||
use({ "rafamadriz/friendly-snippets", commit = "2be79d8a9b03d4175ba6b3d14b082680de1b31b1", opt = true }) -- a bunch of snippets to use
|
||||
|
||||
-- LSP
|
||||
use({
|
||||
"neovim/nvim-lspconfig",
|
||||
commit = "f11fdff7e8b5b415e5ef1837bdcdd37ea6764dda",
|
||||
module = "lspconfig",
|
||||
event = "BufWinEnter",
|
||||
config = function()
|
||||
require("user.lsp")
|
||||
end,
|
||||
}) -- enable LSP
|
||||
use({
|
||||
"williamboman/mason.nvim",
|
||||
commit = "c2002d7a6b5a72ba02388548cfaf420b864fbc12",
|
||||
module = "mason",
|
||||
cmd = {
|
||||
"Mason",
|
||||
"MasonInstall",
|
||||
"MasonUninstall",
|
||||
"MasonUninstallAll",
|
||||
"MasonLog",
|
||||
},
|
||||
config = function()
|
||||
vim.tbl_map(function(plugin)
|
||||
pcall(require, plugin)
|
||||
end, { "lspconfig", "null-ls" })
|
||||
end,
|
||||
}) -- simple to use language server installer
|
||||
use({ "williamboman/mason-lspconfig.nvim", commit = "0051870dd728f4988110a1b2d47f4a4510213e31" })
|
||||
use({ "jose-elias-alvarez/null-ls.nvim", commit = "c0c19f32b614b3921e17886c541c13a72748d450" }) -- for formatters and linters
|
||||
use({ "RRethy/vim-illuminate", commit = "a2e8476af3f3e993bb0d6477438aad3096512e42" })
|
||||
|
||||
-- Telescope
|
||||
use({
|
||||
"nvim-telescope/telescope.nvim",
|
||||
commit = "76ea9a898d3307244dce3573392dcf2cc38f340f",
|
||||
require = { { "nvim-lua/plenary.nvim" } },
|
||||
cmd = "Telescope",
|
||||
config = function()
|
||||
require("user.telescope")
|
||||
end,
|
||||
})
|
||||
|
||||
-- Treesitter
|
||||
use({
|
||||
"nvim-treesitter/nvim-treesitter",
|
||||
commit = "8e763332b7bf7b3a426fd8707b7f5aa85823a5ac",
|
||||
run = ":TSUpdate",
|
||||
event = "BufWinEnter",
|
||||
config = function()
|
||||
require("user.treesitter")
|
||||
end,
|
||||
})
|
||||
|
||||
-- custom akn
|
||||
use({ "manzeloth/live-server" })
|
||||
use({ "mg979/vim-visual-multi", event = "BufWinEnter" })
|
||||
use({
|
||||
"windwp/nvim-ts-autotag",
|
||||
event = "InsertEnter",
|
||||
after = "nvim-treesitter",
|
||||
-- config dipindah ke treesitter config
|
||||
-- config = function()
|
||||
-- require("user.autotag")
|
||||
-- end,
|
||||
})
|
||||
use({
|
||||
"CRAG666/code_runner.nvim",
|
||||
requires = "nvim-lua/plenary.nvim",
|
||||
cmd = { "RunCode", "RunFile", "RunProject", "RunClose" },
|
||||
config = function()
|
||||
require("user.coderunner")
|
||||
end,
|
||||
})
|
||||
use({
|
||||
"NvChad/nvim-colorizer.lua",
|
||||
event = "BufWinEnter",
|
||||
config = function()
|
||||
require("user.colorizer")
|
||||
end,
|
||||
})
|
||||
use({ "williamboman/nvim-lsp-installer" })
|
||||
use({
|
||||
"SmiteshP/nvim-navic",
|
||||
requires = "neovim/nvim-lspconfig",
|
||||
event = "BufRead",
|
||||
config = function()
|
||||
require("user.breadcrumb")
|
||||
require("user.winbar")
|
||||
end,
|
||||
})
|
||||
use({
|
||||
"rcarriga/nvim-notify",
|
||||
module = "notify",
|
||||
event = "BufRead",
|
||||
config = function()
|
||||
vim.notify = require("notify")
|
||||
end,
|
||||
})
|
||||
use({
|
||||
"mrjones2014/smart-splits.nvim",
|
||||
event = "BufWinEnter",
|
||||
config = function()
|
||||
require("user.smartspit")
|
||||
end,
|
||||
})
|
||||
-- null-ls manager
|
||||
use({
|
||||
"jayp0521/mason-null-ls.nvim",
|
||||
after = "null-ls.nvim",
|
||||
event = "BufRead",
|
||||
config = function()
|
||||
require("user.mason-null-ls")
|
||||
end,
|
||||
})
|
||||
use({
|
||||
"stevearc/dressing.nvim",
|
||||
event = "BufWinEnter",
|
||||
config = function()
|
||||
require("user.dressing")
|
||||
end,
|
||||
})
|
||||
|
||||
use({
|
||||
"folke/todo-comments.nvim",
|
||||
event = "BufRead",
|
||||
config = function()
|
||||
require("todo-comments").setup()
|
||||
end,
|
||||
})
|
||||
use({
|
||||
"karb94/neoscroll.nvim",
|
||||
event = "BufRead",
|
||||
config = function()
|
||||
require("user.neoscroll")
|
||||
end,
|
||||
})
|
||||
use({
|
||||
"dstein64/nvim-scrollview",
|
||||
event = "BufRead",
|
||||
config = function()
|
||||
require("user.nvimscroll")
|
||||
end,
|
||||
})
|
||||
use({
|
||||
"gelguy/wilder.nvim",
|
||||
event = "BufWinEnter",
|
||||
config = function()
|
||||
local wilder = require("wilder")
|
||||
wilder.setup({ modes = { ":", "/", "?" } })
|
||||
wilder.set_option(
|
||||
"renderer",
|
||||
wilder.popupmenu_renderer({
|
||||
highlighter = wilder.basic_highlighter(),
|
||||
left = { " ", wilder.popupmenu_devicons() },
|
||||
right = { " ", wilder.popupmenu_scrollbar() },
|
||||
})
|
||||
)
|
||||
end,
|
||||
})
|
||||
use({
|
||||
"gbprod/yanky.nvim",
|
||||
event = "BufRead",
|
||||
config = function()
|
||||
require("user.yanky")
|
||||
end,
|
||||
})
|
||||
use({ "dstein64/vim-startuptime" })
|
||||
use({ "p00f/nvim-ts-rainbow", event = "BufWinEnter", after = "nvim-treesitter" })
|
||||
|
||||
-- ini plugins alternatif yang tidak digunakan lagi
|
||||
-- use({ "rebelot/kanagawa.nvim" })
|
||||
-- use({ "mfussenegger/nvim-jdtls" })
|
||||
-- use({ "ellisonleao/gruvbox.nvim" })
|
||||
-- use({ "EdenEast/nightfox.nvim" })
|
||||
-- use({ "morhetz/gruvbox" })
|
||||
|
||||
-- Git
|
||||
use({
|
||||
"lewis6991/gitsigns.nvim",
|
||||
commit = "2c6f96dda47e55fa07052ce2e2141e8367cbaaf2",
|
||||
disable = vim.fn.executable("git") == 0,
|
||||
ft = "gitcommit",
|
||||
event = "BufWinEnter",
|
||||
config = function()
|
||||
require("user.gitsigns")
|
||||
end,
|
||||
})
|
||||
|
||||
-- Automatically set up your configuration after cloning packer.nvim
|
||||
-- Put this at the end after all plugins
|
||||
if PACKER_BOOTSTRAP then
|
||||
require("packer").sync()
|
||||
end
|
||||
end)
|
48
lua/user/project.lua
Normal file
48
lua/user/project.lua
Normal file
|
@ -0,0 +1,48 @@
|
|||
local status_ok, project = pcall(require, "project_nvim")
|
||||
if not status_ok then
|
||||
return
|
||||
end
|
||||
project.setup({
|
||||
---@usage set to false to disable project.nvim.
|
||||
--- This is on by default since it's currently the expected behavior.
|
||||
active = true,
|
||||
|
||||
on_config_done = nil,
|
||||
|
||||
---@usage set to true to disable setting the current-woriking directory
|
||||
--- Manual mode doesn't automatically change your root directory, so you have
|
||||
--- the option to manually do so using `:ProjectRoot` command.
|
||||
manual_mode = false,
|
||||
|
||||
---@usage Methods of detecting the root directory
|
||||
--- Allowed values: **"lsp"** uses the native neovim lsp
|
||||
--- **"pattern"** uses vim-rooter like glob pattern matching. Here
|
||||
--- order matters: if one is not detected, the other is used as fallback. You
|
||||
--- can also delete or rearangne the detection methods.
|
||||
-- detection_methods = { "lsp", "pattern" }, -- NOTE: lsp detection will get annoying with multiple langs in one project
|
||||
detection_methods = { "pattern" },
|
||||
|
||||
---@usage patterns used to detect root dir, when **"pattern"** is in detection_methods
|
||||
patterns = { ".git", "_darcs", ".hg", ".bzr", ".svn", "Makefile", "package.json" ,"main*" },
|
||||
|
||||
---@ Show hidden files in telescope when searching for files in a project
|
||||
show_hidden = false,
|
||||
|
||||
---@usage When set to false, you will get a message when project.nvim changes your directory.
|
||||
-- When set to false, you will get a message when project.nvim changes your directory.
|
||||
silent_chdir = true,
|
||||
|
||||
---@usage list of lsp client names to ignore when using **lsp** detection. eg: { "efm", ... }
|
||||
ignore_lsp = {},
|
||||
|
||||
---@type string
|
||||
---@usage path to store the project history for use in telescope
|
||||
datapath = vim.fn.stdpath("data"),
|
||||
})
|
||||
|
||||
local tele_status_ok, telescope = pcall(require, "telescope")
|
||||
if not tele_status_ok then
|
||||
return
|
||||
end
|
||||
|
||||
telescope.load_extension('projects')
|
18
lua/user/smartspit.lua
Normal file
18
lua/user/smartspit.lua
Normal file
|
@ -0,0 +1,18 @@
|
|||
local status_ok, smart_splits = pcall(require, "smart-splits")
|
||||
if not status_ok then
|
||||
return
|
||||
end
|
||||
smart_splits.setup({
|
||||
ignored_filetypes = {
|
||||
"nofile",
|
||||
"quickfix",
|
||||
"qf",
|
||||
"prompt",
|
||||
},
|
||||
ignored_buftypes = { "nofile" },
|
||||
})
|
||||
|
||||
vim.keymap.set("n", "<C-Left>", require("smart-splits").resize_left)
|
||||
vim.keymap.set("n", "<C-Down>", require("smart-splits").resize_down)
|
||||
vim.keymap.set("n", "<C-Up", require("smart-splits").resize_up)
|
||||
vim.keymap.set("n", "<C-Right>", require("smart-splits").resize_right)
|
49
lua/user/snip/init.lua
Normal file
49
lua/user/snip/init.lua
Normal file
|
@ -0,0 +1,49 @@
|
|||
local status_ok = pcall(require, "luasnip")
|
||||
if not status_ok then
|
||||
return
|
||||
end
|
||||
|
||||
local lpath = vim.fn.stdpath("config") .. "/my-snippets"
|
||||
|
||||
|
||||
-- kalau mau di pakai snipetnya baru di buaka remarknya karena bikin berat kalau load terus dan ga di pakai
|
||||
|
||||
-- require("luasnip.loaders.from_vscode").lazy_load()
|
||||
-- -- specify the full path...
|
||||
-- require("luasnip.loaders.from_vscode").lazy_load({
|
||||
-- paths = lpath .. "/B5-Snippets",
|
||||
-- })
|
||||
-- require("luasnip.loaders.from_vscode").lazy_load({
|
||||
-- paths = lpath .. "/laravel-blade",
|
||||
-- })
|
||||
-- require("luasnip.loaders.from_vscode").lazy_load({
|
||||
-- paths = lpath .. "/laravel-blade2",
|
||||
-- })
|
||||
-- require("luasnip.loaders.from_vscode").lazy_load({
|
||||
-- paths = lpath .. "/laravel5",
|
||||
-- })
|
||||
-- require("luasnip.loaders.from_vscode").lazy_load({
|
||||
-- paths = lpath .. "/javascript",
|
||||
-- })
|
||||
require("luasnip.loaders.from_vscode").lazy_load({
|
||||
paths = lpath .. "/html",
|
||||
})
|
||||
require("luasnip.loaders.from_vscode").lazy_load({
|
||||
paths = lpath .. "/javascript-snippet",
|
||||
})
|
||||
-- require("luasnip.loaders.from_vscode").lazy_load({
|
||||
-- paths = lpath .. "/codeigniter4",
|
||||
-- })
|
||||
-- require("luasnip.loaders.from_vscode").lazy_load({
|
||||
-- paths = lpath .. "/font-awesome",
|
||||
-- })
|
||||
-- or relative to the directory of $MYVIMRC
|
||||
--require("luasnip.loaders.from_vscode").load({ paths = lpath .. "/B5-Snippets" })
|
||||
--require("luasnip.loaders.from_vscode").load({ paths = lpath .. "/laravel-blade" })
|
||||
--require("luasnip.loaders.from_vscode").load({ paths = lpath .. "/laravel-blade2" })
|
||||
--require("luasnip.loaders.from_vscode").load({ paths = lpath .. "/laravel5" })
|
||||
--require("luasnip.loaders.from_vscode").load({ paths = lpath .. "/javascript" })
|
||||
require("luasnip.loaders.from_vscode").load({ paths = lpath .. "/html" })
|
||||
--require("luasnip.loaders.from_vscode").load({ paths = lpath .. "/codeigniter4" })
|
||||
--require("luasnip.loaders.from_vscode").load({ paths = lpath .. "/font-awesome" })
|
||||
require("luasnip.loaders.from_vscode").load({ paths = lpath .. "/javascript-snippet" })
|
96
lua/user/telescope.lua
Normal file
96
lua/user/telescope.lua
Normal file
|
@ -0,0 +1,96 @@
|
|||
local status_ok, telescope = pcall(require, "telescope")
|
||||
if not status_ok then
|
||||
return
|
||||
end
|
||||
|
||||
local actions = require "telescope.actions"
|
||||
|
||||
telescope.setup {
|
||||
defaults = {
|
||||
|
||||
prompt_prefix = " ",
|
||||
selection_caret = " ",
|
||||
path_display = { "smart" },
|
||||
|
||||
mappings = {
|
||||
i = {
|
||||
["<C-n>"] = actions.cycle_history_next,
|
||||
["<C-p>"] = actions.cycle_history_prev,
|
||||
|
||||
["<C-j>"] = actions.move_selection_next,
|
||||
["<C-k>"] = actions.move_selection_previous,
|
||||
|
||||
["<C-c>"] = actions.close,
|
||||
|
||||
["<Down>"] = actions.move_selection_next,
|
||||
["<Up>"] = actions.move_selection_previous,
|
||||
|
||||
["<CR>"] = actions.select_default,
|
||||
["<C-x>"] = actions.select_horizontal,
|
||||
["<C-v>"] = actions.select_vertical,
|
||||
["<C-t>"] = actions.select_tab,
|
||||
|
||||
["<C-u>"] = actions.preview_scrolling_up,
|
||||
["<C-d>"] = actions.preview_scrolling_down,
|
||||
|
||||
["<PageUp>"] = actions.results_scrolling_up,
|
||||
["<PageDown>"] = actions.results_scrolling_down,
|
||||
|
||||
["<Tab>"] = actions.toggle_selection + actions.move_selection_worse,
|
||||
["<S-Tab>"] = actions.toggle_selection + actions.move_selection_better,
|
||||
["<C-q>"] = actions.send_to_qflist + actions.open_qflist,
|
||||
["<M-q>"] = actions.send_selected_to_qflist + actions.open_qflist,
|
||||
["<C-l>"] = actions.complete_tag,
|
||||
["<C-_>"] = actions.which_key, -- keys from pressing <C-/>
|
||||
},
|
||||
|
||||
n = {
|
||||
["<esc>"] = actions.close,
|
||||
["<CR>"] = actions.select_default,
|
||||
["<C-x>"] = actions.select_horizontal,
|
||||
["<C-v>"] = actions.select_vertical,
|
||||
["<C-t>"] = actions.select_tab,
|
||||
|
||||
["<Tab>"] = actions.toggle_selection + actions.move_selection_worse,
|
||||
["<S-Tab>"] = actions.toggle_selection + actions.move_selection_better,
|
||||
["<C-q>"] = actions.send_to_qflist + actions.open_qflist,
|
||||
["<M-q>"] = actions.send_selected_to_qflist + actions.open_qflist,
|
||||
|
||||
["j"] = actions.move_selection_next,
|
||||
["k"] = actions.move_selection_previous,
|
||||
["H"] = actions.move_to_top,
|
||||
["M"] = actions.move_to_middle,
|
||||
["L"] = actions.move_to_bottom,
|
||||
|
||||
["<Down>"] = actions.move_selection_next,
|
||||
["<Up>"] = actions.move_selection_previous,
|
||||
["gg"] = actions.move_to_top,
|
||||
["G"] = actions.move_to_bottom,
|
||||
|
||||
["<C-u>"] = actions.preview_scrolling_up,
|
||||
["<C-d>"] = actions.preview_scrolling_down,
|
||||
|
||||
["<PageUp>"] = actions.results_scrolling_up,
|
||||
["<PageDown>"] = actions.results_scrolling_down,
|
||||
|
||||
["?"] = actions.which_key,
|
||||
},
|
||||
},
|
||||
},
|
||||
pickers = {
|
||||
-- Default configuration for builtin pickers goes here:
|
||||
-- picker_name = {
|
||||
-- picker_config_key = value,
|
||||
-- ...
|
||||
-- }
|
||||
-- Now the picker_config_key will be applied every time you call this
|
||||
-- builtin picker
|
||||
},
|
||||
extensions = {
|
||||
-- Your extension configuration goes here:
|
||||
-- extension_name = {
|
||||
-- extension_config_key = value,
|
||||
-- }
|
||||
-- please take a look at the readme of the extension you want to configure
|
||||
},
|
||||
}
|
70
lua/user/toggleterm.lua
Normal file
70
lua/user/toggleterm.lua
Normal file
|
@ -0,0 +1,70 @@
|
|||
local status_ok, toggleterm = pcall(require, "toggleterm")
|
||||
if not status_ok then
|
||||
return
|
||||
end
|
||||
|
||||
toggleterm.setup({
|
||||
size = 20,
|
||||
open_mapping = [[<c-\>]],
|
||||
hide_numbers = true,
|
||||
shade_filetypes = {},
|
||||
shade_terminals = true,
|
||||
shading_factor = 2,
|
||||
start_in_insert = true,
|
||||
insert_mappings = true,
|
||||
persist_size = true,
|
||||
direction = "float",
|
||||
close_on_exit = true,
|
||||
shell = vim.o.shell,
|
||||
float_opts = {
|
||||
border = "curved",
|
||||
winblend = 0,
|
||||
highlights = {
|
||||
border = "Normal",
|
||||
background = "Normal",
|
||||
},
|
||||
},
|
||||
})
|
||||
|
||||
function _G.set_terminal_keymaps()
|
||||
local opts = {noremap = true}
|
||||
vim.api.nvim_buf_set_keymap(0, 't', '<esc>', [[<C-\><C-n>]], opts)
|
||||
vim.api.nvim_buf_set_keymap(0, 't', 'jk', [[<C-\><C-n>]], opts)
|
||||
vim.api.nvim_buf_set_keymap(0, 't', '<C-h>', [[<C-\><C-n><C-W>h]], opts)
|
||||
vim.api.nvim_buf_set_keymap(0, 't', '<C-j>', [[<C-\><C-n><C-W>j]], opts)
|
||||
vim.api.nvim_buf_set_keymap(0, 't', '<C-k>', [[<C-\><C-n><C-W>k]], opts)
|
||||
vim.api.nvim_buf_set_keymap(0, 't', '<C-l>', [[<C-\><C-n><C-W>l]], opts)
|
||||
end
|
||||
|
||||
vim.cmd('autocmd! TermOpen term://* lua set_terminal_keymaps()')
|
||||
|
||||
local Terminal = require("toggleterm.terminal").Terminal
|
||||
local lazygit = Terminal:new({ cmd = "lazygit", hidden = true })
|
||||
|
||||
function _LAZYGIT_TOGGLE()
|
||||
lazygit:toggle()
|
||||
end
|
||||
|
||||
local node = Terminal:new({ cmd = "node", hidden = true })
|
||||
|
||||
function _NODE_TOGGLE()
|
||||
node:toggle()
|
||||
end
|
||||
|
||||
local ncdu = Terminal:new({ cmd = "ncdu", hidden = true })
|
||||
|
||||
function _NCDU_TOGGLE()
|
||||
ncdu:toggle()
|
||||
end
|
||||
|
||||
local htop = Terminal:new({ cmd = "htop", hidden = true })
|
||||
|
||||
function _HTOP_TOGGLE()
|
||||
htop:toggle()
|
||||
end
|
||||
|
||||
local python = Terminal:new({ cmd = "python", hidden = true })
|
||||
|
||||
function _PYTHON_TOGGLE()
|
||||
python:toggle()
|
||||
end
|
40
lua/user/tokyonight.lua
Normal file
40
lua/user/tokyonight.lua
Normal file
|
@ -0,0 +1,40 @@
|
|||
local status_ok, tokyonight = pcall(require, "tokyonight")
|
||||
if not status_ok then
|
||||
return
|
||||
end
|
||||
tokyonight.setup({
|
||||
-- your configuration comes here
|
||||
-- or leave it empty to use the default settings
|
||||
style = "storm", -- The theme comes in three styles, `storm`, `moon`, a darker variant `night` and `day`
|
||||
light_style = "day", -- The theme is used when the background is set to light
|
||||
transparent = false, -- Enable this to disable setting the background color
|
||||
terminal_colors = true, -- Configure the colors used when opening a `:terminal` in Neovim
|
||||
styles = {
|
||||
-- Style to be applied to different syntax groups
|
||||
-- Value is any valid attr-list value for `:help nvim_set_hl`
|
||||
-- comments = { italic = true },
|
||||
comments = { italic = true },
|
||||
keywords = { italic = true },
|
||||
functions = {},
|
||||
variables = {},
|
||||
-- Background styles. Can be "dark", "transparent" or "normal"
|
||||
sidebars = "dark", -- style for sidebars, see below
|
||||
floats = "dark", -- style for floating windows
|
||||
},
|
||||
sidebars = { "qf", "help" }, -- Set a darker background on sidebar-like windows. For example: `["qf", "vista_kind", "terminal", "packer"]`
|
||||
day_brightness = 0.2, -- Adjusts the brightness of the colors of the **Day** style. Number between 0 and 1, from dull to vibrant colors
|
||||
hide_inactive_statusline = false, -- Enabling this option, will hide inactive statuslines and replace them with a thin border instead. Should work with the standard **StatusLine** and **LuaLine**.
|
||||
dim_inactive = false, -- dims inactive windows
|
||||
lualine_bold = false, -- When `true`, section headers in the lualine theme will be bold
|
||||
|
||||
--- You can override specific color groups to use other groups or a hex color
|
||||
--- function will be called with a ColorScheme table
|
||||
--@param colors ColorScheme
|
||||
--on_colors = function(colors) end,
|
||||
|
||||
--- You can override specific highlights to use other groups or a hex color
|
||||
--- function will be called with a Highlights and ColorScheme table
|
||||
--@param highlights Highlights
|
||||
--@param colors ColorScheme
|
||||
--on_highlights = function(highlights, colors) end,
|
||||
})
|
1764
lua/user/webdevicons.lua
Normal file
1764
lua/user/webdevicons.lua
Normal file
File diff suppressed because it is too large
Load diff
227
lua/user/whichkey.lua
Normal file
227
lua/user/whichkey.lua
Normal file
|
@ -0,0 +1,227 @@
|
|||
local status_ok, which_key = pcall(require, "which-key")
|
||||
if not status_ok then
|
||||
return
|
||||
end
|
||||
|
||||
local setup = {
|
||||
plugins = {
|
||||
marks = true, -- shows a list of your marks on ' and `
|
||||
registers = true, -- shows your registers on " in NORMAL or <C-r> in INSERT mode
|
||||
spelling = {
|
||||
enabled = true, -- enabling this will show WhichKey when pressing z= to select spelling suggestions
|
||||
suggestions = 20, -- how many suggestions should be shown in the list?
|
||||
},
|
||||
-- the presets plugin, adds help for a bunch of default keybindings in Neovim
|
||||
-- No actual key bindings are created
|
||||
presets = {
|
||||
operators = false, -- adds help for operators like d, y, ... and registers them for motion / text object completion
|
||||
motions = true, -- adds help for motions
|
||||
text_objects = true, -- help for text objects triggered after entering an operator
|
||||
windows = true, -- default bindings on <c-w>
|
||||
nav = true, -- misc bindings to work with windows
|
||||
z = true, -- bindings for folds, spelling and others prefixed with z
|
||||
g = true, -- bindings for prefixed with g
|
||||
},
|
||||
},
|
||||
-- add operators that will trigger motion and text object completion
|
||||
-- to enable all native operators, set the preset / operators plugin above
|
||||
-- operators = { gc = "Comments" },
|
||||
key_labels = {
|
||||
-- override the label used to display some keys. It doesn't effect WK in any other way.
|
||||
-- For example:
|
||||
-- ["<space>"] = "SPC",
|
||||
-- ["<cr>"] = "RET",
|
||||
-- ["<tab>"] = "TAB",
|
||||
},
|
||||
icons = {
|
||||
breadcrumb = "»", -- symbol used in the command line area that shows your active key combo
|
||||
separator = "➜", -- symbol used between a key and it's label
|
||||
group = "+", -- symbol prepended to a group
|
||||
},
|
||||
popup_mappings = {
|
||||
scroll_down = "<c-d>", -- binding to scroll down inside the popup
|
||||
scroll_up = "<c-u>", -- binding to scroll up inside the popup
|
||||
},
|
||||
window = {
|
||||
border = "rounded", -- none, single, double, shadow
|
||||
position = "bottom", -- bottom, top
|
||||
margin = { 1, 0, 1, 0 }, -- extra window margin [top, right, bottom, left]
|
||||
padding = { 2, 2, 2, 2 }, -- extra window padding [top, right, bottom, left]
|
||||
winblend = 0,
|
||||
},
|
||||
layout = {
|
||||
height = { min = 4, max = 25 }, -- min and max height of the columns
|
||||
width = { min = 20, max = 50 }, -- min and max width of the columns
|
||||
spacing = 3, -- spacing between columns
|
||||
align = "left", -- align columns left, center or right
|
||||
},
|
||||
ignore_missing = true, -- enable this to hide mappings for which you didn't specify a label
|
||||
hidden = { "<silent>", "<cmd>", "<Cmd>", "<CR>", "call", "lua", "^:", "^ " }, -- hide mapping boilerplate
|
||||
show_help = true, -- show help message on the command line when the popup is visible
|
||||
triggers = "auto", -- automatically setup triggers
|
||||
-- triggers = {"<leader>"} -- or specify a list manually
|
||||
triggers_blacklist = {
|
||||
-- list of mode / prefixes that should never be hooked by WhichKey
|
||||
-- this is mostly relevant for key maps that start with a native binding
|
||||
-- most people should not need to change this
|
||||
i = { "j", "k" },
|
||||
v = { "j", "k" },
|
||||
},
|
||||
}
|
||||
|
||||
local opts = {
|
||||
mode = "n", -- NORMAL mode
|
||||
prefix = "<leader>",
|
||||
buffer = nil, -- Global mappings. Specify a buffer number for buffer local mappings
|
||||
silent = true, -- use `silent` when creating keymaps
|
||||
noremap = true, -- use `noremap` when creating keymaps
|
||||
nowait = true, -- use `nowait` when creating keymaps
|
||||
}
|
||||
|
||||
local opts2 = {
|
||||
mode = "v", -- NORMAL mode
|
||||
prefix = "<leader>",
|
||||
buffer = nil, -- Global mappings. Specify a buffer number for buffer local mappings
|
||||
silent = true, -- use `silent` when creating keymaps
|
||||
noremap = true, -- use `noremap` when creating keymaps
|
||||
nowait = true, -- use `nowait` when creating keymaps
|
||||
}
|
||||
|
||||
local trn = ""
|
||||
if vim.fn.has("win32") then
|
||||
trn = "pwsh<cr>"
|
||||
end
|
||||
|
||||
local mappings2 = {
|
||||
["/"] = { "<esc><cmd>lua require('Comment.api').toggle.linewise(vim.fn.visualmode())<cr>", "Commet Block" },
|
||||
}
|
||||
local mappings = {
|
||||
["a"] = { "<cmd>Alpha<cr>", "Alpha" },
|
||||
["b"] = {
|
||||
"<cmd>lua require('telescope.builtin').buffers(require('telescope.themes').get_dropdown{previewer = false})<cr>",
|
||||
"Buffers",
|
||||
},
|
||||
--["e"] = { "<cmd>NvimTreeToggle<cr>", "Explorer" },
|
||||
["e"] = { "<cmd>NvimTreeToggle<cr>", "Explorer" },
|
||||
["w"] = { "<cmd>w!<CR>", "Save" },
|
||||
["q"] = { "<cmd>q!<CR>", "Quit" },
|
||||
["c"] = { "<cmd>Bdelete!<CR>", "Close Buffer" },
|
||||
["h"] = { "<cmd>nohlsearch<CR>", "No Highlight" },
|
||||
["f"] = {
|
||||
"<cmd>Telescope find_files <CR>",
|
||||
"Find files",
|
||||
},
|
||||
["F"] = { "<cmd>Telescope live_grep theme=ivy<cr>", "Find Text" },
|
||||
["P"] = { "<cmd>lua require('telescope').extensions.projects.projects()<cr>", "Projects" },
|
||||
|
||||
["/"] = {
|
||||
function()
|
||||
require("Comment.api").toggle.linewise.current()
|
||||
end,
|
||||
"Coment line",
|
||||
},
|
||||
p = {
|
||||
name = "Packer",
|
||||
c = { "<cmd>PackerCompile<cr>", "Compile" },
|
||||
i = { "<cmd>PackerInstall<cr>", "Install" },
|
||||
s = { "<cmd>PackerSync<cr>", "Sync" },
|
||||
S = { "<cmd>PackerStatus<cr>", "Status" },
|
||||
u = { "<cmd>PackerUpdate<cr>", "Update" },
|
||||
},
|
||||
|
||||
g = {
|
||||
name = "Git",
|
||||
g = { "<cmd>lua _LAZYGIT_TOGGLE()<CR>", "Lazygit" },
|
||||
j = { "<cmd>lua require 'gitsigns'.next_hunk()<cr>", "Next Hunk" },
|
||||
k = { "<cmd>lua require 'gitsigns'.prev_hunk()<cr>", "Prev Hunk" },
|
||||
l = { "<cmd>lua require 'gitsigns'.blame_line()<cr>", "Blame" },
|
||||
p = { "<cmd>lua require 'gitsigns'.preview_hunk()<cr>", "Preview Hunk" },
|
||||
r = { "<cmd>lua require 'gitsigns'.reset_hunk()<cr>", "Reset Hunk" },
|
||||
R = { "<cmd>lua require 'gitsigns'.reset_buffer()<cr>", "Reset Buffer" },
|
||||
s = { "<cmd>lua require 'gitsigns'.stage_hunk()<cr>", "Stage Hunk" },
|
||||
u = {
|
||||
"<cmd>lua require 'gitsigns'.undo_stage_hunk()<cr>",
|
||||
"Undo Stage Hunk",
|
||||
},
|
||||
o = { "<cmd>Telescope git_status<cr>", "Open changed file" },
|
||||
b = { "<cmd>Telescope git_branches<cr>", "Checkout branch" },
|
||||
c = { "<cmd>Telescope git_commits<cr>", "Checkout commit" },
|
||||
d = {
|
||||
"<cmd>Gitsigns diffthis HEAD<cr>",
|
||||
"Diff",
|
||||
},
|
||||
},
|
||||
|
||||
l = {
|
||||
name = "LSP",
|
||||
a = { "<cmd>lua vim.lsp.buf.code_action()<cr>", "Code Action" },
|
||||
d = {
|
||||
"<cmd>Telescope diagnostics bufnr=0<cr>",
|
||||
"Document Diagnostics",
|
||||
},
|
||||
w = {
|
||||
"<cmd>Telescope diagnostics<cr>",
|
||||
"Workspace Diagnostics",
|
||||
},
|
||||
f = { "<cmd>lua vim.lsp.buf.format{async=true}<cr>", "Format" },
|
||||
i = { "<cmd>LspInfo<cr>", "Info" },
|
||||
I = { "<cmd>Mason<cr>", "Installer Info" },
|
||||
j = {
|
||||
"<cmd>lua vim.lsp.diagnostic.goto_next()<CR>",
|
||||
"Next Diagnostic",
|
||||
},
|
||||
k = {
|
||||
"<cmd>lua vim.lsp.diagnostic.goto_prev()<cr>",
|
||||
"Prev Diagnostic",
|
||||
},
|
||||
l = { "<cmd>lua vim.lsp.codelens.run()<cr>", "CodeLens Action" },
|
||||
q = { "<cmd>lua vim.diagnostic.setloclist()<cr>", "Quickfix" },
|
||||
r = { "<cmd>lua vim.lsp.buf.rename()<cr>", "Rename" },
|
||||
s = { "<cmd>Telescope lsp_document_symbols<cr>", "Document Symbols" },
|
||||
S = {
|
||||
"<cmd>Telescope lsp_dynamic_workspace_symbols<cr>",
|
||||
"Workspace Symbols",
|
||||
},
|
||||
},
|
||||
s = {
|
||||
name = "Search",
|
||||
b = { "<cmd>Telescope git_branches<cr>", "Checkout branch" },
|
||||
c = { "<cmd>Telescope colorscheme<cr>", "Colorscheme" },
|
||||
h = { "<cmd>Telescope help_tags<cr>", "Find Help" },
|
||||
M = { "<cmd>Telescope man_pages<cr>", "Man Pages" },
|
||||
r = { "<cmd>Telescope oldfiles<cr>", "Open Recent File" },
|
||||
R = { "<cmd>Telescope registers<cr>", "Registers" },
|
||||
k = { "<cmd>Telescope keymaps<cr>", "Keymaps" },
|
||||
C = { "<cmd>Telescope commands<cr>", "Commands" },
|
||||
},
|
||||
|
||||
t = {
|
||||
name = "Terminal",
|
||||
n = { "<cmd>lua _NODE_TOGGLE()<cr>", "Node" },
|
||||
u = { "<cmd>lua _NCDU_TOGGLE()<cr>", "NCDU" },
|
||||
t = { "<cmd>lua _HTOP_TOGGLE()<cr>", "Htop" },
|
||||
p = { "<cmd>lua _PYTHON_TOGGLE()<cr>", "Python" },
|
||||
f = { "<cmd>ToggleTerm direction=float<cr>" .. trn, "Float" },
|
||||
h = { "<cmd>ToggleTerm size=10 direction=horizontal<cr>", "Horizontal" },
|
||||
v = { "<cmd>ToggleTerm size=80 direction=vertical<cr>" .. trn, "Vertical" },
|
||||
},
|
||||
r = {
|
||||
name = "Run",
|
||||
s = {
|
||||
'<cmd>autocmd bufwritepost [^_]*.sass,[^_]*.scss silent exec "!sass %:p %:r.css"<CR>',
|
||||
"Auto Compile Sass",
|
||||
},
|
||||
r = { "<cmd>RunCode<CR>", "Run Code" },
|
||||
f = { "<cmd>RunFile<CR>", "Run File" },
|
||||
p = { "<cmd>RunProject<CR>", "Run Project" },
|
||||
g = { "<cmd>ToggleTerm size=70 direction=vertical<cr>gradle run<cr>" .. trn, "Run Gradle" },
|
||||
m = {
|
||||
"<cmd>ToggleTerm size=70 direction=vertical<cr>mvn exec:java -Dexec.mainClass=com.pojokcode.App<cr>",
|
||||
"Run MVN",
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
which_key.setup(setup)
|
||||
which_key.register(mappings, opts)
|
||||
which_key.register(mappings2, opts2)
|
151
lua/user/winbar.lua
Normal file
151
lua/user/winbar.lua
Normal file
|
@ -0,0 +1,151 @@
|
|||
local active = true
|
||||
local icons = require("user.icons")
|
||||
local excludes = function()
|
||||
return vim.tbl_contains({
|
||||
"help",
|
||||
"startify",
|
||||
"dashboard",
|
||||
"packer",
|
||||
"neo-tree",
|
||||
"neogitstatus",
|
||||
"NvimTree",
|
||||
"Trouble",
|
||||
"alpha",
|
||||
"lir",
|
||||
"Outline",
|
||||
"spectre_panel",
|
||||
"toggleterm",
|
||||
"DressingSelect",
|
||||
"Jaq",
|
||||
"harpoon",
|
||||
"dap-repl",
|
||||
"dap-terminal",
|
||||
"dapui_console",
|
||||
"dapui_hover",
|
||||
"lab",
|
||||
"notify",
|
||||
"noice",
|
||||
"",
|
||||
} or {}, vim.bo.filetype)
|
||||
end
|
||||
|
||||
local get_filename = function()
|
||||
local filename = vim.fn.expand("%:t")
|
||||
local extension = vim.fn.expand("%:e")
|
||||
local f = require("user.functions")
|
||||
|
||||
if not f.isempty(filename) then
|
||||
local file_icon, hl_group = require("nvim-web-devicons").get_icon(filename, extension, { default = true })
|
||||
|
||||
if f.isempty(file_icon) then
|
||||
file_icon = icons.kind.File
|
||||
end
|
||||
|
||||
local buf_ft = vim.bo.filetype
|
||||
|
||||
if buf_ft == "dapui_breakpoints" then
|
||||
file_icon = icons.ui.Bug
|
||||
end
|
||||
|
||||
if buf_ft == "dapui_stacks" then
|
||||
file_icon = icons.ui.Stacks
|
||||
end
|
||||
|
||||
if buf_ft == "dapui_scopes" then
|
||||
file_icon = icons.ui.Scopes
|
||||
end
|
||||
|
||||
if buf_ft == "dapui_watches" then
|
||||
file_icon = icons.ui.Watches
|
||||
end
|
||||
|
||||
-- if buf_ft == "dapui_console" then
|
||||
-- file_icon = lvim.icons.ui.DebugConsole
|
||||
-- end
|
||||
|
||||
local navic_text = vim.api.nvim_get_hl_by_name("Normal", true)
|
||||
vim.api.nvim_set_hl(0, "Winbar", { fg = navic_text.foreground })
|
||||
|
||||
return " " .. "%#" .. hl_group .. "#" .. file_icon .. "%*" .. " " .. "%#Winbar#" .. filename .. "%*"
|
||||
end
|
||||
end
|
||||
|
||||
local get_gps = function()
|
||||
local status_gps_ok, gps = pcall(require, "nvim-navic")
|
||||
if not status_gps_ok then
|
||||
return ""
|
||||
end
|
||||
|
||||
local status_ok, gps_location = pcall(gps.get_location, {})
|
||||
if not status_ok then
|
||||
return ""
|
||||
end
|
||||
|
||||
if not gps.is_available() or gps_location == "error" then
|
||||
return ""
|
||||
end
|
||||
|
||||
if not require("user.functions").isempty(gps_location) then
|
||||
return "%#NavicSeparator#" .. icons.ui.ChevronRight .. "%* " .. gps_location
|
||||
else
|
||||
return ""
|
||||
end
|
||||
end
|
||||
|
||||
local get_winbar = function()
|
||||
if excludes() then
|
||||
return
|
||||
end
|
||||
local f = require("user.functions")
|
||||
local value = get_filename()
|
||||
|
||||
local gps_added = false
|
||||
if not f.isempty(value) then
|
||||
local gps_value = get_gps()
|
||||
value = value .. " " .. gps_value
|
||||
if not f.isempty(gps_value) then
|
||||
gps_added = true
|
||||
end
|
||||
end
|
||||
|
||||
if not f.isempty(value) and f.get_buf_option("mod") then
|
||||
-- TODO: replace with circle
|
||||
local mod = "%#LspCodeLens#" .. icons.ui.Circle .. "%*"
|
||||
if gps_added then
|
||||
value = value .. " " .. mod
|
||||
else
|
||||
value = value .. mod
|
||||
end
|
||||
end
|
||||
|
||||
local num_tabs = #vim.api.nvim_list_tabpages()
|
||||
|
||||
if num_tabs > 1 and not f.isempty(value) then
|
||||
local tabpage_number = tostring(vim.api.nvim_tabpage_get_number(0))
|
||||
value = value .. "%=" .. tabpage_number .. "/" .. tostring(num_tabs)
|
||||
end
|
||||
|
||||
local status_ok, _ = pcall(vim.api.nvim_set_option_value, "winbar", value, { scope = "local" })
|
||||
if not status_ok then
|
||||
return
|
||||
end
|
||||
end
|
||||
|
||||
vim.api.nvim_create_augroup("_winbar", {})
|
||||
if vim.fn.has("nvim-0.8") == 1 then
|
||||
vim.api.nvim_create_autocmd(
|
||||
{ "CursorHoldI", "CursorHold", "BufWinEnter", "BufFilePost", "InsertEnter", "BufWritePost", "TabClosed" },
|
||||
{
|
||||
group = "_winbar",
|
||||
callback = function()
|
||||
if active then
|
||||
local status_ok, _ = pcall(vim.api.nvim_buf_get_var, 0, "lsp_floating_window")
|
||||
if not status_ok then
|
||||
-- TODO:
|
||||
get_winbar()
|
||||
end
|
||||
end
|
||||
end,
|
||||
}
|
||||
)
|
||||
end
|
17
lua/user/yanky.lua
Normal file
17
lua/user/yanky.lua
Normal file
|
@ -0,0 +1,17 @@
|
|||
local status_ok, yanky = pcall(require, "yanky")
|
||||
if not status_ok then
|
||||
return
|
||||
end
|
||||
yanky.setup({
|
||||
ring = {
|
||||
history_length = 50,
|
||||
storage = "memory",
|
||||
},
|
||||
preserve_cursor_position = {
|
||||
enabled = false,
|
||||
},
|
||||
})
|
||||
|
||||
-- cycle through the yank history, only work after paste
|
||||
vim.keymap.set("n", "[y", "<Plug>(YankyCycleForward)")
|
||||
vim.keymap.set("n", "]y", "<Plug>(YankyCycleBackward)")
|
Loading…
Add table
Add a link
Reference in a new issue