summaryrefslogtreecommitdiff
path: root/.config/nvim/lua/config/options.lua
blob: a362fcd7c0b1e2ca660977d624fb46fb49b4fc24 (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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
local opt = vim.opt

-- vim.api.nvim_set_hl(0, "ColorColumn", { ctermbg = "NONE", bg = "NONE" })

-- colorscheme gruvbox
opt.termguicolors = true
opt.background = "dark"
vim.cmd.colorscheme("gruvbox")

opt.mouse = ""             -- disable mouse
opt.encoding = "utf-8"
opt.shortmess = "atI"      -- disable intro screen
opt.inccommand = "nosplit" -- shows ex-command change previews
-- opt.inccommand = "split"
opt.smartcase = true
opt.ignorecase = true
opt.number = true
opt.relativenumber = true
opt.splitbelow = true
opt.splitright = true
opt.signcolumn = "yes"
opt.shada = { "'10", "<0", "s10", "h" }
opt.clipboard = "unnamedplus"
opt.expandtab = true -- expand tabs to spaces
opt.smarttab = false -- fuck tabs
-- opt.formatoptions:remove "o" -- Don't have `o` add a comment, should be in filetype (ftplugin)
opt.spell = false
opt.undolevels = 150
opt.lazyredraw = true -- don't redraw screen during macros
opt.sc = true         -- show incomplete command at bottom right
opt.swapfile = false
opt.backupdir = "/tmp"
opt.backupcopy = "yes"
opt.directory = "/tmp"

opt.timeoutlen = 500
opt.ttimeoutlen = 10 -- fix esc in tmux
opt.showmatch = true
opt.mat = 5

opt.visualbell = true
opt.foldenable = false
opt.foldmethod = "syntax"
opt.foldlevel = 1
opt.foldnestmax = 10
opt.tabstop = 8     -- n-space tab width
opt.shiftwidth = 2  -- allows the use of < and > for VISUAL indenting
opt.softtabstop = 2 -- counts n space when DELETE or BACKSPACE is used
opt.textwidth = 78
opt.autoindent = true
opt.smartindent = true
opt.hlsearch = false
opt.incsearch = true
opt.backspace = "indent,eol,start"

opt.history = 1000     -- 1000 lines of command history
opt.cmdheight = 1      -- command line height
opt.ruler = true       -- ruler display in statusline
opt.showmode = true    -- show mode at bottom of screen
opt.backup = false     -- don't keep backups after close
opt.writebackup = true -- do keep one while working
opt.backupdir = "/tmp"
opt.backupcopy = "yes"
opt.directory = "/tmp"
opt.showmatch = true -- show matching brackets (), {}, []
opt.whichwrap = "h,l,<,>,[,]"
opt.showcmd = true
opt.modeline = true
opt.formatoptions = "tcqjl"
opt.selection = "inclusive"
opt.autowrite = true
opt.cinoptions = "g0,:0,l1,(0,t0"
opt.shortmess = "at"
opt.complete = ".,t,i,b,w,k"
opt.wildchar = ("\t"):byte()
opt.wildmenu = true
opt.wildmode = "longest:full,full"
opt.wildignore = "*/.git/*,*/tmp/*,*.swp,*/node_modules/*"
opt.previewheight = 5
opt.joinspaces = true
opt.magic = true
opt.suffixes = ".bak,~,.o,.info,.log,.rbx,.swp"
opt.title = true
opt.scrolloff = 8 -- start scrolling at 8 lines away from margins
opt.sidescrolloff = 15
opt.sidescroll = 1
opt.cursorline = true
opt.omnifunc = "syntaxcomplete#Complete"
opt.laststatus = 3 -- 2
opt.completeopt = "menu,menuone,noselect"

-- TODO: convert to lua or get lualine plugin
-- vim.cmd [[
--     set statusline=
--     set statusline+=%#PmenuSel#
--     set statusline+=%#LineNr#
--     set statusline+=\ %F
--     set statusline+=%m
--     set statusline+=%=
--     set statusline+=%#CursorColumn#
--     set statusline+=\ %y
--     set statusline+=\ %{&fileencoding?&fileencoding:&encoding}
--     set statusline+=\ %{&fileformat}
--     set statusline+=\ %p%%
--     set statusline+=\ %l:%c
--     set statusline+=\
-- ]]

vim.cmd([[
    augroup encrypted
        au!
        autocmd BufReadPre,FileReadPre *.gpg set viminfo=
        autocmd BufReadPre,FileReadPre *.gpg set noswapfile noundofile nobackup
        autocmd BufReadPre,FileReadPre *.gpg set bin
        autocmd BufReadPre,FileReadPre *.gpg let ch_save = &ch|set ch=2
        autocmd BufReadPost,FileReadPost *.gpg '[,']!gpg --decrypt 2> /dev/null
        autocmd BufReadPost,FileReadPost *.gpg set nobin
        autocmd BufReadPost,FileReadPost *.gpg let &ch = ch_save|unlet ch_save
        autocmd BufReadPost,FileReadPost *.gpg execute ":doautocmd BufReadPost " . expand("%:r")
        autocmd BufWritePre,FileWritePre *.gpg '[,']!gpg --default-recipient-self -ae 2>/dev/null
        autocmd BufWritePost,FileWritePost *.gpg u
    augroup END
]])

-- TODO: move and convert to lua
-- vimwiki (move to vimwiki.lua config)
--local hostname = vim.fn.hostname()
--if hostname == "arcana" then
--  vim.g.vimwiki_list = { { path = "/home/moxie/wiki" } }
--elseif hostname == "hideaway" then
--  vim.g.vimwiki_list = { { path = "/stash/wiki" } }
--end

-- open vimwiki links in a new vim buffer instead of xdg-open
-- vim.cmd([[
--     fun! VimwikiLinkHandler(link)
--         let link_infos = vimwiki#base#resolve_link(a:link)
--         try
--             if link_infos.filename =~ "^http"
--                 exe '!$BROWSER "' . fnameescape(link_infos.filename) . '"'
--             else
--                 exe "e " . fnameescape(link_infos.filename)
--             endif
--             return 1
--         catch
--             echo "Failed opening " . a:link
--             return 0
--         endtry
--     endfun
-- ]])

-- remove docx and xlsx from zip.vim
vim.g.zipPlugin_ext =
"*.zip,*.jar,*.xpi,*.ja,*.war,*.ear,*.celzip,*.oxt,*.kmz,*.wsz,*.xap,*.docm,*.dotx,*.dotm,*.potx,*.potm,*.ppsx,*.ppsm,*.pptx,*.pptm,*.ppam,*.sldx,*.thmx,*.xlam,*.xlsm,*.xlsb,*.xltx,*.xltm,*.xlam,*.crtx,*.vdw,*.glox,*.gcsx,*.gqsx"

vim.cmd([[
    highlight GitGutterAdd guifg=#009900 ctermfg=2
    highlight GitGutterChange guifg=#bbbb00 ctermfg=3
    highlight GitGutterDelete guifg=#ff2222 ctermfg=1
]])