-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinit.lua
More file actions
40 lines (34 loc) · 1.01 KB
/
init.lua
File metadata and controls
40 lines (34 loc) · 1.01 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
-- Deteksi apakah sedang di VS Code
local is_vscode = vim.g.vscode
-- Bootstrap lazy.nvim (Hanya muat plugin yang benar-benar perlu)
require("config.lazy")
require("config.keymaps")
-- JANGAN gunakan vim.on_key di VS Code
if not is_vscode then
vim.on_key(function()
if vim.fn.mode() == "n" then
vim.cmd("nohlsearch")
end
end, vim.api.nvim_create_namespace("auto_nohl"))
end
-- Manual clear with Esc (Ini jauh lebih aman dan ringan)
vim.keymap.set("n", "<Esc>", "<cmd>nohlsearch<CR>", { silent = true })
-- Clipboard: Gunakan clipboard bawaan VS Code jika tersedia
if is_vscode then
vim.opt.clipboard = "" -- Biarkan VS Code yang handle
else
vim.opt.clipboard = "unnamed,unnamedplus"
end
-- Sisa config lainnya...
vim.keymap.set("n", "x", '"_x')
vim.keymap.set("n", "X", '"_X')
vim.keymap.set("x", "p", '"_dP')
-- Highlight on yank
vim.api.nvim_create_autocmd("TextYankPost", {
callback = function()
vim.highlight.on_yank({
higroup = "IncSearch",
timeout = 200,
})
end,
})