summaryrefslogtreecommitdiff
path: root/lua/tjk/options.lua
blob: da821818ea038174d793019523a6a7c2e1f40c8a (plain)
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
-- misc
vim.o.autochdir = true             -- stay in current directory when opening a file
vim.o.splitright = true            -- open splits on right instead of left
vim.o.splitbelow = true            -- open splits on bottom instead of top
vim.o.termguicolors = true         -- truecolor in terminal emulator, will be disabled in tty
vim.o.wrap = false                 -- disable word wrapping
vim.o.cursorline = true            -- highlight current line
vim.o.title = true                 -- set window title of the terminal emulator to current nvim buffer
vim.cmd.aunmenu "PopUp"            -- disable right click menu

-- line numbers
vim.o.number = true                -- enable line numbers
vim.o.relativenumber = true        -- enable relative line numbers

-- show whitespace characters
vim.o.list = true                  -- show whitespace characters defined in listchars
vim.o.listchars = "tab:│ ,space:·" -- highlight tabs and spaces

-- tabbing
vim.o.tabstop = 4                  -- set tabwidth to 4 instead of 8
vim.o.shiftwidth = 4               -- tab key will only insert one tab

-- search
vim.o.ignorecase = true            -- case-insensitive search...
vim.o.smartcase = true             -- ...unless the search term is capital

-- experimental
vim.o.smartindent = true
vim.opt.wildmode = { "list:longest", "list:full" } -- Better auto-complete

-- dont continue comments on to new lines (:help fo-table)
vim.api.nvim_create_autocmd("FileType", { pattern = "*", callback = function()
	vim.opt.formatoptions:remove { "c", "r", "o" }
end})

-- ignore __pycache__ directories in file listings
vim.opt.wildignore = { "__pycache__/", "*/__pycache__/" }

-- for running in tty
if os.getenv "TERM" == "linux" then
	vim.cmd.colorscheme "vim"
	vim.o.termguicolors = false
	vim.o.list = false
else
	vim.g.clipboard = "osc52"      -- force osc52 support for copying to clipboard in remote terminals. # TODO this should be auto-detected
end