]> git.r.bdr.sh - rbdr/dotfiles/blame_incremental - config/nvim/init.lua
Add plan
[rbdr/dotfiles] / config / nvim / init.lua
... / ...
CommitLineData
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.cursorline = true -- Highlight cursor line
9vim.opt.colorcolumn='80,150' -- Show color columns
10
11-- Color
12vim.opt.termguicolors = true
13vim.cmd.color('tranquil')
14
15-- Tab Style (Always override with editorconfig)
16vim.opt.tabstop = 2 -- 2 Spaces per tab
17vim.opt.shiftwidth = 2 -- Spaces used in Autoindent
18vim.opt.softtabstop = 2 -- Spaces used when soft tabbing
19vim.opt.expandtab = true -- Always use spaces
20
21-------------------------------------------------------------------------------
22-- Behavior
23-------------------------------------------------------------------------------
24-- Search Behavior
25vim.opt.ignorecase = true -- Ignore case when searching
26vim.opt.smartcase = true -- Unless we use both cases in search
27
28-- Autocomplete Behavior
29vim.opt.wildmode = 'list:longest,list:full' -- Autocomplete common matching string
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-- Navigate the location list
59vim.keymap.set('n', '<M-j>', ':lnext<CR>')
60vim.keymap.set('n', '<M-k>', ':lprev<CR>')
61vim.keymap.set('n', '<M-S-j>', ':cnext<CR>')
62vim.keymap.set('n', '<M-S-k>', ':cprev<CR>')
63
64-------------------------------------------------------------------------------
65-- File Specific Behavior
66-------------------------------------------------------------------------------
67-- Makefiles
68vim.api.nvim_create_autocmd({'FileType'}, {
69 pattern = 'make',
70 callback = function () vim.opt.expandtab = false end
71})
72
73-- SNES files
74vim.api.nvim_create_autocmd({'BufNewFile', 'BufRead'}, {
75 pattern = {'*.asm', '*.s'},
76 callback = function () vim.opt.filetype = 'snes' end
77})
78
79vim.api.nvim_create_autocmd({'BufNewFile', 'BufRead'}, {
80 pattern = {'.plan'},
81 callback = function () vim.opt.filetype = 'markdown' end
82})
83
84-------------------------------------------------------------------------------
85-- Local Overrides
86-------------------------------------------------------------------------------
87pcall(require, 'init_local')
88
89-------------------------------------------------------------------------------
90-- Plugin Specific Behavior
91-------------------------------------------------------------------------------
92-- FZF
93vim.keymap.set('n', '<c-P>',
94 "<cmd>lua require('fzf-lua').files({ fzf_opts = {} })<CR>", { silent = true })
95
96-- Toggle Autosave
97vim.api.nvim_set_keymap('n', '<leader>n', ':ASToggle<CR>', {})
98
99-- Svelte Config
100vim.g.vim_svelte_plugin_use_typescript = true
101
102-- Coq
103vim.g.coq_settings = {
104 auto_start = 'shut-up',
105 clients = {
106 snippets = {
107 warn = {}
108 }
109 }
110}
111
112-- Oil
113vim.keymap.set("n", "-", "<CMD>Oil<CR>", { desc = "Open parent directory" })
114
115-- UndoTree
116vim.keymap.set('n', '<leader>U', vim.cmd.UndotreeToggle)
117
118-- Plugins
119require('plugins')
120require('treesitter_config')
121require('lsp')
122require('dap_config')
123require('calendar_tools')