]> git.r.bdr.sh - rbdr/dotfiles/blame - config/nvim/init.lua
Update the goyo config
[rbdr/dotfiles] / config / nvim / init.lua
CommitLineData
ce349909
RBR
1-------------------------------------------------------------------------------
2-- Style
3-------------------------------------------------------------------------------
4-- Editor Style
5vim.opt.number = true -- Show number column
6vim.opt.wrap = false -- Don't wrap text
7vim.opt.list = true -- Display tabs and trailing space
8vim.opt.colorcolumn='80,150' -- Show color columns
9
10-- Color
11vim.opt.termguicolors = true
12vim.cmd.color('rbdr')
13
14-- Tab Style (Always override with editorconfig)
15vim.opt.tabstop = 2 -- 2 Spaces per tab
16vim.opt.shiftwidth = 2 -- Spaces used in Autoindent
17vim.opt.softtabstop = 2 -- Spaces used when soft tabbing
18vim.opt.expandtab = true -- Always use spaces
19
20-------------------------------------------------------------------------------
21-- Behavior
22-------------------------------------------------------------------------------
23-- Search Behavior
24vim.opt.ignorecase = true -- Ignore case when searching
25vim.opt.smartcase = true -- Unless we use both cases in search
26
27-- Autocomplete Behavior
28vim.opt.wildmode = 'list:longest,list:full' -- Autocomplete common matching string
29 -- first, and then the full match.
30
31-- Folding Behavior
32vim.opt.foldmethod = 'syntax' -- Use syntax highlight to define folds
33vim.opt.foldnestmax = 10 -- Max 10 folds
34vim.opt.foldlevelstart = 99 -- Start with all folds open
35
36-- Relative Number Behavior
37vim.api.nvim_create_autocmd({'FocusLost', 'InsertEnter'}, {
38 pattern = '*',
39 callback = function () vim.opt.relativenumber = false end,
40})
41vim.api.nvim_create_autocmd({'InsertLeave', 'CursorMoved'}, {
42 pattern = '*',
43 callback = function () vim.opt.relativenumber = true end,
44})
45
46vim.keymap.set('n', '<C-n>', function()
47 vim.opt.relativenumber = not vim.opt.relativenumber
48end)
49
50-- Move lines / blocks up and down using Ctrl + Shift
51vim.keymap.set('n', '<C-S-j>', ':m .+1<CR>==')
52vim.keymap.set('n', '<C-S-k>', ':m .-2<CR>==')
53vim.keymap.set('i', '<C-S-j>', '<Esc>:m .+1<CR>==gi')
54vim.keymap.set('i', '<C-S-k>', '<Esc>:m .-2<CR>==gi')
55vim.keymap.set('v', '<C-S-j>', ':m \'>+1<CR>gv=gv')
56vim.keymap.set('v', '<C-S-k>', ':m \'<-2<CR>gv=gv')
57
58-------------------------------------------------------------------------------
59-- File Specific Behavior
60-------------------------------------------------------------------------------
61-- Makefiles
62vim.api.nvim_create_autocmd({'FileType'}, {
63 pattern = 'make',
64 callback = function () vim.opt.expandtab = false end
65})
66
67-- SNES files
68vim.api.nvim_create_autocmd({'BufNewFile', 'BufRead'}, {
69 pattern = {'*.asm', '*.s'},
70 callback = function () vim.opt.filetype = 'snes' end
71})
72
73-------------------------------------------------------------------------------
74-- Local Overrides
75-------------------------------------------------------------------------------
76pcall(require, 'init_local')
77
78-------------------------------------------------------------------------------
79-- Plugin Specific Behavior
80-------------------------------------------------------------------------------
81-- FZF
82vim.keymap.set('', '<C-P>', ':FZF <CR>')
83vim.g.fzf_layout = { down = '40%' }
84vim.g.fzf_colors = {
85 fg = {'fg', 'Normal'},
86 bg = {'bg', 'Normal'},
87 hl = {'fg', 'Comment'},
88 ['fg+'] = {'fg', 'CursorLine', 'CursorColumn', 'Normal'},
89 ['bg+'] = {'bg', 'CursorLine', 'CursorColumn'},
90 ['hl+'] = {'fg', 'Statement'},
91 info = {'fg', 'PreProc'},
92 border = {'fg', 'Ignore'},
93 prompt = {'fg', 'Conditional'},
94 pointer = {'fg', 'Exception'},
95 marker = {'fg', 'Keyword'},
96 spinner = {'fg', 'Label'},
97 header = {'fg', 'Comment'}
98}
99
100
101-- Svelte Config
102vim.g.vim_svelte_plugin_use_typescript = true
103
104-- Limelight / Goyo config
105
106vim.g.limelight_conceal_ctermfg = 'gray'
107vim.g.limelight_conceal_guifg = 'DarkGray'
108
109vim.api.nvim_create_autocmd({'User'}, {
110 pattern = 'GoyoEnter',
9603dc4b 111 command = 'Limelight'
ce349909
RBR
112})
113vim.api.nvim_create_autocmd({'User'}, {
114 pattern = 'GoyoLeave',
9603dc4b 115 command = 'Limelight!'
ce349909 116})
9603dc4b
RBR
117
118vim.keymap.set('n', '<leader>i', ':Limelight!!<CR>==')
119vim.keymap.set('i', '<leader>i', '<Esc>:Limelight!!<CR>==gi')
120vim.keymap.set('v', '<leader>i', ':<C-u>Limelight!!<CR>gv=gv')
121vim.keymap.set('n', '<leader>g', ':Goyo<CR>==')
122vim.keymap.set('i', '<leader>g', '<Esc>:Goyo<CR>==gi')
123vim.keymap.set('v', '<leader>g', ':<C-u>Goyo<CR>gv=gv')
ce349909
RBR
124
125-- Plugins
126require('plugins')