]> git.r.bdr.sh - rbdr/dotfiles/blame - config/nvim/init.lua
Use cmd for kitty layout shortcuts
[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
04dc6d82 8vim.opt.cursorline = true -- Highlight cursor line
ce349909
RBR
9vim.opt.colorcolumn='80,150' -- Show color columns
10
11-- Color
12vim.opt.termguicolors = true
04dc6d82 13vim.cmd.color('tranquil')
ce349909
RBR
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
ce349909
RBR
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
fc82060a
RBR
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
ce349909
RBR
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
6cb3a2cb
RBR
79vim.api.nvim_create_autocmd({'BufNewFile', 'BufRead'}, {
80 pattern = {'.plan'},
81 callback = function () vim.opt.filetype = 'markdown' end
82})
83
ce349909
RBR
84-------------------------------------------------------------------------------
85-- Local Overrides
86-------------------------------------------------------------------------------
87pcall(require, 'init_local')
88
89-------------------------------------------------------------------------------
90-- Plugin Specific Behavior
91-------------------------------------------------------------------------------
92-- FZF
53d5c65e 93vim.keymap.set('n', '<c-P>',
af913f93 94 "<cmd>lua require('fzf-lua').files({ fzf_opts = {} })<CR>", { silent = true })
ce349909 95
7d35a7fc
RBR
96-- Toggle Autosave
97vim.api.nvim_set_keymap('n', '<leader>n', ':ASToggle<CR>', {})
98
ce349909
RBR
99-- Svelte Config
100vim.g.vim_svelte_plugin_use_typescript = true
101
fd61b7b4 102-- Coq
2d56e8a7
RBR
103vim.g.coq_settings = {
104 auto_start = 'shut-up',
105 clients = {
106 snippets = {
107 warn = {}
108 }
109 }
110}
fd61b7b4 111
53d5c65e
RBR
112-- Oil
113vim.keymap.set("n", "-", "<CMD>Oil<CR>", { desc = "Open parent directory" })
114
f2b3146a
RBR
115-- UndoTree
116vim.keymap.set('n', '<leader>U', vim.cmd.UndotreeToggle)
117
ce349909
RBR
118-- Plugins
119require('plugins')
3c6ddc92 120require('treesitter_config')
73a2d994
RBR
121require('lsp')
122require('dap_config')
cd4c8b13 123require('calendar_tools')