neovim/init.lua

106 lines
3.0 KiB
Lua
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

vim.opt.termguicolors = true
vim.g.loaded_netrw = 1
vim.g.loaded_netrwPlugin = 1
require('auto-commands')
require('mappings')
require('lazy-config')
require('treesitter-config')
require('treesitter-textobjects-config')
require('noice-config')
require('plugin-mappings')
require('gopls')
-- require('code-completion')
require('commands')
require('lsp-config')
require('theme-config')
-- General
vim.opt.number = true
vim.opt.relativenumber = true
vim.opt.tabstop = 4
vim.opt.shiftwidth = 4
vim.opt.expandtab = true
-- Listchars
---@diagnostic disable-next-line: missing-fields
vim.opt.listchars = {
space = '',
eol = '',
tab = '',
trail = '·',
extends = '',
precedes = '',
nbsp = '',
}
vim.opt.list = true
-- Undo settings
vim.opt.undofile = true -- Save undo history to file
vim.opt.undolevels = 1000
-- LSP
-- Make room for signs in the gutter
vim.opt.signcolumn = "yes"
-- Disable case sensitivity
vim.opt.ignorecase = true
vim.opt.foldlevel = 99
vim.opt.hlsearch = true
vim.opt.cursorline = true
vim.opt.splitbelow = true
-- Enable spell checking
vim.opt.spell = true
-- Check if running in SSH
if vim.fn.has('unix') == 1 then
if os.getenv('SSH_CLIENT') and os.getenv('TERM_PROGRAM') == 'iTerm.app' then
-- iterm2 does not support OSC 52 pasting, it can only copy
-- it takes over 10-20 seconds to copy to the clipboard if we leave it enabled
-- NOTE: System clipboard is "+, copy with keystrokes "+y
---@diagnostic disable-next-line: lowercase-global
function no_paste(reg)
return function(lines)
-- Do nothing! We can't paste with OSC52 with iterm2
end
end
vim.g.clipboard = {
name = "OSC 52",
copy = {
["+"] = require("vim.ui.clipboard.osc52").copy("+"),
["*"] = require("vim.ui.clipboard.osc52").copy("*"),
},
paste = {
["+"] = no_paste("+"), -- Pasting disabled
["*"] = no_paste("*"), -- Pasting disabled
}
}
end
end
-- GUI operations
if vim.fn.has('gui_running') == 1 then
vim.opt.guifont = "JetBrainsMono Nerd Font:h12"
-- Clipboard mappings
vim.api.nvim_set_keymap('n', '<C-c>', '"+y', { noremap = true })
vim.api.nvim_set_keymap('v', '<C-c>', '"+y', { noremap = true })
vim.api.nvim_set_keymap('n', '<C-x>', '"+x', { noremap = true })
vim.api.nvim_set_keymap('v', '<C-x>', '"+x', { noremap = true })
vim.api.nvim_set_keymap('n', '<C-v>', '"+p', { noremap = true })
vim.api.nvim_set_keymap('v', '<C-v>', '"+p', { noremap = true })
-- MacOS CMD+V support
vim.api.nvim_set_keymap('n', '<D-v>', '"+p', { noremap = true })
vim.api.nvim_set_keymap('v', '<D-v>', '"+p', { noremap = true })
vim.api.nvim_set_keymap('n', '<D-c>', '"+y', { noremap = true })
vim.api.nvim_set_keymap('v', '<D-c>', '"+y', { noremap = true })
vim.api.nvim_set_keymap('n', '<D-x>', '"+x', { noremap = true })
vim.api.nvim_set_keymap('v', '<D-x>', '"+x', { noremap = true })
end