]>
Commit | Line | Data |
---|---|---|
ce349909 RBR |
1 | ------------------------------------------------------------------------------- |
2 | -- Style | |
3 | ------------------------------------------------------------------------------- | |
4 | -- Editor Style | |
5 | vim.opt.number = true -- Show number column | |
6 | vim.opt.wrap = false -- Don't wrap text | |
7 | vim.opt.list = true -- Display tabs and trailing space | |
04dc6d82 | 8 | vim.opt.cursorline = true -- Highlight cursor line |
ce349909 RBR |
9 | vim.opt.colorcolumn='80,150' -- Show color columns |
10 | ||
11 | -- Color | |
12 | vim.opt.termguicolors = true | |
04dc6d82 | 13 | vim.cmd.color('tranquil') |
ce349909 RBR |
14 | |
15 | -- Tab Style (Always override with editorconfig) | |
16 | vim.opt.tabstop = 2 -- 2 Spaces per tab | |
17 | vim.opt.shiftwidth = 2 -- Spaces used in Autoindent | |
18 | vim.opt.softtabstop = 2 -- Spaces used when soft tabbing | |
19 | vim.opt.expandtab = true -- Always use spaces | |
20 | ||
21 | ------------------------------------------------------------------------------- | |
22 | -- Behavior | |
23 | ------------------------------------------------------------------------------- | |
24 | -- Search Behavior | |
25 | vim.opt.ignorecase = true -- Ignore case when searching | |
26 | vim.opt.smartcase = true -- Unless we use both cases in search | |
27 | ||
28 | -- Autocomplete Behavior | |
29 | vim.opt.wildmode = 'list:longest,list:full' -- Autocomplete common matching string | |
ce349909 RBR |
30 | |
31 | -- Folding Behavior | |
32 | vim.opt.foldmethod = 'syntax' -- Use syntax highlight to define folds | |
33 | vim.opt.foldnestmax = 10 -- Max 10 folds | |
34 | vim.opt.foldlevelstart = 99 -- Start with all folds open | |
35 | ||
36 | -- Relative Number Behavior | |
37 | vim.api.nvim_create_autocmd({'FocusLost', 'InsertEnter'}, { | |
38 | pattern = '*', | |
39 | callback = function () vim.opt.relativenumber = false end, | |
40 | }) | |
41 | vim.api.nvim_create_autocmd({'InsertLeave', 'CursorMoved'}, { | |
42 | pattern = '*', | |
43 | callback = function () vim.opt.relativenumber = true end, | |
44 | }) | |
45 | ||
46 | vim.keymap.set('n', '<C-n>', function() | |
47 | vim.opt.relativenumber = not vim.opt.relativenumber | |
48 | end) | |
49 | ||
50 | -- Move lines / blocks up and down using Ctrl + Shift | |
51 | vim.keymap.set('n', '<C-S-j>', ':m .+1<CR>==') | |
52 | vim.keymap.set('n', '<C-S-k>', ':m .-2<CR>==') | |
53 | vim.keymap.set('i', '<C-S-j>', '<Esc>:m .+1<CR>==gi') | |
54 | vim.keymap.set('i', '<C-S-k>', '<Esc>:m .-2<CR>==gi') | |
55 | vim.keymap.set('v', '<C-S-j>', ':m \'>+1<CR>gv=gv') | |
56 | vim.keymap.set('v', '<C-S-k>', ':m \'<-2<CR>gv=gv') | |
57 | ||
fc82060a RBR |
58 | -- Navigate the location list |
59 | vim.keymap.set('n', '<M-j>', ':lnext<CR>') | |
60 | vim.keymap.set('n', '<M-k>', ':lprev<CR>') | |
61 | vim.keymap.set('n', '<M-S-j>', ':cnext<CR>') | |
62 | vim.keymap.set('n', '<M-S-k>', ':cprev<CR>') | |
63 | ||
ce349909 RBR |
64 | ------------------------------------------------------------------------------- |
65 | -- File Specific Behavior | |
66 | ------------------------------------------------------------------------------- | |
67 | -- Makefiles | |
68 | vim.api.nvim_create_autocmd({'FileType'}, { | |
69 | pattern = 'make', | |
70 | callback = function () vim.opt.expandtab = false end | |
71 | }) | |
72 | ||
73 | -- SNES files | |
74 | vim.api.nvim_create_autocmd({'BufNewFile', 'BufRead'}, { | |
75 | pattern = {'*.asm', '*.s'}, | |
76 | callback = function () vim.opt.filetype = 'snes' end | |
77 | }) | |
78 | ||
6cb3a2cb RBR |
79 | vim.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 | ------------------------------------------------------------------------------- | |
87 | pcall(require, 'init_local') | |
88 | ||
89 | ------------------------------------------------------------------------------- | |
90 | -- Plugin Specific Behavior | |
91 | ------------------------------------------------------------------------------- | |
92 | -- FZF | |
53d5c65e | 93 | vim.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 |
97 | vim.api.nvim_set_keymap('n', '<leader>n', ':ASToggle<CR>', {}) | |
98 | ||
ce349909 RBR |
99 | -- Svelte Config |
100 | vim.g.vim_svelte_plugin_use_typescript = true | |
101 | ||
fd61b7b4 | 102 | -- Coq |
2d56e8a7 RBR |
103 | vim.g.coq_settings = { |
104 | auto_start = 'shut-up', | |
105 | clients = { | |
106 | snippets = { | |
107 | warn = {} | |
108 | } | |
109 | } | |
110 | } | |
fd61b7b4 | 111 | |
53d5c65e RBR |
112 | -- Oil |
113 | vim.keymap.set("n", "-", "<CMD>Oil<CR>", { desc = "Open parent directory" }) | |
114 | ||
f2b3146a RBR |
115 | -- UndoTree |
116 | vim.keymap.set('n', '<leader>U', vim.cmd.UndotreeToggle) | |
117 | ||
ce349909 RBR |
118 | -- Plugins |
119 | require('plugins') | |
3c6ddc92 | 120 | require('treesitter_config') |
73a2d994 RBR |
121 | require('lsp') |
122 | require('dap_config') | |
cd4c8b13 | 123 | require('calendar_tools') |