neovim/init.lua

78 lines
2.1 KiB
Lua

vim.opt.termguicolors = true
vim.g.loaded_netrw = 1
vim.g.loaded_netrwPlugin = 1
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
-- 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') 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
function no_paste(reg)
return function(lines)
-- Do nothing! We can't paste with OSC52
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 })
end