-
Notifications
You must be signed in to change notification settings - Fork 0
/
base.lua
81 lines (65 loc) · 2.33 KB
/
base.lua
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
-- FILE: Base configs for Neovim.
vim.scriptencoding = 'utf-8'
vim.opt.encoding = 'utf-8'
vim.opt.fileencoding = 'utf-8'
-- Features
-- ========
vim.keymap.set('n', '<Space>', '<Nop>', { noremap = true, silent = true })
vim.keymap.set('x', '<Space>', '<Nop>', { noremap = true, silent = true })
-- vim.g.mapleader = ','
-- vim.g.maplocalleader = ','
vim.g.mapleader = ' ' -- <Space> -- TODO: Will trigger <Space> in visual mode.
vim.g.maplocalleader = ' ' -- <Space>
vim.opt.mouse = 'a'
-- vim.opt.mouse = 'nvi' -- to exclude Command-line mode.
vim.opt.tabstop = 2 -- aka the tab width.
vim.opt.shiftwidth = 2 -- for autoindents.
-- vim.opt.expandtab = true -- to use space instead of tab.
vim.cmd [[autocmd BufEnter * set formatoptions-=r]] -- to disable auto comment.
vim.cmd [[autocmd BufEnter * setlocal formatoptions-=r]] -- to disable auto comment.
vim.opt.ignorecase = true -- for search.
vim.opt.smartcase = true -- to override `ignorecase` when search capital letters.
-- UI
-- ==
vim.opt.linebreak = true -- to wrap line by words.
vim.opt.showbreak = ' ↪' -- for wrapped lines.
vim.opt.cc = '80,100,120' -- colorcolumn (line limit).
vim.opt.number = true -- to display line number.
vim.opt.relativenumber = true -- for line number.
vim.opt.cursorline = true -- to highlight vertically.
-- vim.opt.cursorcolumn = true -- to highlight horizontally.
vim.opt.listchars = {
tab = '→ ', -- Overrided default.
trail = '•', -- Overrided default.
nbsp = '␣', -- Overrided default.
space = '·',
precedes = '«',
extends = '»',
-- eol = '¶',
}
vim.opt.list = true -- to display special characters.
-- Just copy from `~/.vim/vimrc`:
vim.cmd [[
" Editor Command: Toogle Showing EOL Character:
let g:is_showing_eol = 0
function ToggleShowEOL()
if g:is_showing_eol
let g:is_showing_eol = 0
setlocal listchars=tab:→\ ,space:·,nbsp:␣,trail:•,precedes:«,extends:» ",eol:¶
else
let g:is_showing_eol = 1
setlocal listchars=tab:→\ ,space:·,nbsp:␣,trail:•,precedes:«,extends:»,eol:¶
endif
endfunction
command ToggleShowEOL call ToggleShowEOL()
]]
-- Nvim Defaults
-- =============
-- These options are probably default in Nvim (`:h vim-differences`):
-- set nocompatible
-- syntax on
-- vim.opt.autoindent = true
-- vim.opt.hlsearch = true
-- vim.opt.showcmd = true
-- vim.opt.wildmenu = true
-- vim.opt.wildmode seems work fine.