aboutsummaryrefslogtreecommitdiff
path: root/Common/nvim/lua/basic.lua
blob: 7633e40fffb43e477f2db3cd3a3473f155edaeda (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
--[[
  General
--]]

vim.opt.autoread = true
vim.opt.formatoptions:remove("t")
vim.opt.path:append("**")
vim.g.netrw_banner = 0
vim.opt.wildignore = '*.o,*~,*.pyc,*/.git/*,*/.hg/*,*/.svn/*,*/.DS_Store'
vim.opt.smartcase = true
vim.opt.showmatch = true
vim.opt.swapfile = false
vim.opt.smartindent = true

--[[
  Convenience stuff
--]]

-- Default to the "modern normal"
vim.opt.expandtab   = true
vim.opt.shiftwidth  = 4
vim.opt.tabstop     = 4
vim.opt.softtabstop = 4

-- Disable highlight when <leader><cr> is pressed
vim.api.nvim_set_keymap('n', '<leader><cr>', ':noh<cr>', { noremap = true, silent = true })

-- Tab commands
vim.api.nvim_set_keymap('n', '<leader>tn', ':tabnext<cr>', { noremap = true, silent = true })
vim.api.nvim_set_keymap('n', '<leader>tc',  ':tabnew<cr>', { noremap = true, silent = true })
vim.api.nvim_set_keymap('n', '<leader>tx',  ':tabclose<cr>', { noremap = true, silent = true })

-- Return to last edit position when opening files (You want this!)
vim.cmd [[
  au BufReadPost * if line("'\"") > 1 && line("'\"") <= line("$") | exe "normal! g'\"" | endif
]]

-- Debugging
vim.g.termdebug_popup = 0
vim.g.termdebug_wide = 163
vim.cmd([[:packadd! termdebug]])

-- Colorscheme
vim.cmd [[ colorscheme default ]]
vim.opt.background = "light"
vim.opt.termguicolors = true
-- No idea why, preview in fzf does at least work extremely porly without this
vim.cmd [[ let $BAT_THEME = 'gruvbox-light' ]]

-- Show colour column
vim.opt.colorcolumn = '80,120'
vim.api.nvim_set_hl(0, "ColorColumn", { ctermbg = "lightgrey", bg = "#eae7da" })