summaryrefslogtreecommitdiff
path: root/lua/core/init.lua
blob: 5a762e4985fdce3d5a91b93c7dbecddbe86070dd (plain) (blame)
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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
-----------------------------------------------------------
-- General
-----------------------------------------------------------
vim.opt.mouse = "a" -- Enable mouse support
vim.opt.clipboard = "unnamedplus" -- Copy/paste to system clipboard
vim.opt.termguicolors = true -- Enable 24-bit RGB colors
vim.o.background = "dark"
vim.opt.hidden = true
vim.opt.number = true
vim.o.cursorlineopt = "both"
vim.opt.conceallevel = 0
vim.opt.relativenumber = true
vim.opt.showcmd = true
vim.opt.showmode = true
vim.opt.colorcolumn = "80"
vim.opt.cursorline = true
vim.opt.foldlevelstart = 99
vim.opt.showtabline = 1
vim.opt.laststatus = 3 -- Single status line across all buffers
vim.opt.undofile = true
vim.opt.list = true -- Show some invisible characters like tabs
vim.opt.undodir = vim.fn.stdpath("data") .. "/undo"
vim.o.sessionoptions = "blank,buffers,curdir,folds,help,tabpages,winsize,winpos,terminal"
-- TODO make it pretty with the highlights
--vim.opt.winbar = '%!luaeval("_winbar()")' -- The winbar text, I don't know if it is possible to embed it directly here :(
--vim.opt.winbar = "%=%m %t%="
-----------------------------------------------------------
-- Tabs, indent
-----------------------------------------------------------
vim.opt.expandtab = true -- Use spaces instead of tabs
vim.opt.shiftwidth = 2 -- Shift 4 spaces when tab
vim.opt.tabstop = 2 -- 1 tab == 4 spaces
vim.opt.smartindent = true -- Autoindent new lines

-----------------------------------------------------------
-- Custom keymaps
-----------------------------------------------------------
vim.api.nvim_set_keymap("i", "jk", "<Esc>", {}) -- Use jk to exit insert mode
vim.api.nvim_set_keymap("i", "kj", "<Esc>", {}) -- Use kj to exit insert mode
vim.api.nvim_set_keymap("t", "jk", "<Esc>", {}) -- Use jk to exit terminal mode
vim.api.nvim_set_keymap("t", "kj", "<Esc>", {}) -- Use kj to exit terminal mode
vim.api.nvim_set_keymap("t", "<Esc>", "<C-\\><C-n>", { noremap = true }) -- Use Esc to exit terminal mode

vim.api.nvim_set_keymap("i", "<C-t>", "<Esc>:tabnew<CR>", {}) -- New tab
vim.api.nvim_set_keymap("n", "<C-t>", ":tabnew<CR>", {}) -- New tab

-- No arrow keys for movement
--nnoremap <up> <nop>
--nnoremap <down> <nop>
--inoremap <up> <nop>
--inoremap <down> <nop>
--inoremap <left> <nop>
--inoremap <right> <nop>

--Left and right to switch buffers
--nnoremap <left> :bp<CR>
--nnoremap <right> :bn<CR>

--_winbar = function() -- My custom winbar text
--local filename = vim.fn.expand('%')
--return string.gsub(filename, 'term://.*:', '')
--end

require("core.disable_builtin")