Compare commits

...

2 Commits

Author SHA1 Message Date
2cb7fd90b3 temp! 2024-03-09 11:32:35 +00:00
51ae7955f7 Tweak kanagawa theme 2024-03-08 20:12:40 +00:00
6 changed files with 112 additions and 14 deletions

1
after/ftplugin/c.lua Normal file
View File

@ -0,0 +1 @@
require('build').create_commands()

View File

@ -1 +1,3 @@
vim.bo.commentstring = '//%s' vim.bo.commentstring = '//%s'
require('build').create_commands()

View File

@ -2,6 +2,7 @@ require('settings')
require('mappings') require('mappings')
require('netrw') require('netrw')
require('autocmds') require('autocmds')
require('build')
local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim" local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim"
if not vim.loop.fs_stat(lazypath) then if not vim.loop.fs_stat(lazypath) then

80
lua/build.lua Normal file
View File

@ -0,0 +1,80 @@
local build = {}
function build.dir(opts)
print(vim.inspect(opts))
local num_fargs = table.maxn(opts.fargs)
local dir = nil
for index, arg in ipairs(opts.fargs) do
print(index, arg)
end
if num_fargs == 0 then
-- Find build directories
local dirs = build.list_dirs()
local num_dirs = table.maxn(dirs)
if num_dirs == 0 then
vim.cmd.echoerr('no build directories found')
elseif num_dirs == 1 then
-- One build directory found, use it
dir = dirs[1]
else
-- TODO: Implement Telescope picker
-- Prompt user to choose dir with to inputlist
local choices = {}
for index, choice in ipairs(dirs) do
table.insert(choices, tostring(index) .. ': ' .. choice)
end
local index = vim.fn.inputlist(choices)
dir = dirs[index]
print(' ' .. dir)
end
elseif num_fargs == 1 then
-- Single argument, invoked as :BuildDir <dir>
dir = opts.fargs[1]
else
error('build#dir called with too many arguments')
end
if not dir then
return
end
-- TODO: Set build directory
-- TODO: Post-process compile_commands.json with compdb
end
function build.run(opts)
print(vim.inspect(opts))
end
function build.list_dirs()
local dirs = vim.fn.globpath('.', 'build*')
dirs = vim.fn.substitute(dirs, '\\.\\/', '', 'g')
return vim.fn.split(dirs)
end
function build.list_targets()
return {}
end
function build.create_commands()
local buffer = vim.api.nvim_get_current_buf()
-- Create :BuildDir command
vim.api.nvim_buf_create_user_command(buffer, 'BuildDir', build.dir, {
bang = true, nargs = '?', complete = build.list_dirs,
})
-- Create :Build command
vim.api.nvim_buf_create_user_command(buffer, 'Build', build.run, {
bang = true, nargs = '*', complete = build.list_targets,
})
end
return build

View File

@ -1,26 +1,39 @@
return { return {
-- 'rose-pine/neovim', name = 'rose-pine', -- 'rose-pine/neovim',
-- config = function() -- name = 'rose-pine',
-- require('rose-pine').setup({ -- config = function()
-- styles = { -- require('rose-pine').setup({
-- transparency = true, -- styles = {
-- }, -- transparency = true,
-- -- TODO: Ideally only certain groups would have italics disabled -- },
-- disable_italics = true, -- -- TODO: Ideally only certain groups would have italics disabled
-- }) -- disable_italics = true,
-- vim.cmd('colorscheme rose-pine') -- })
-- end -- vim.cmd('colorscheme rose-pine')
-- end
'rebelot/kanagawa.nvim', 'rebelot/kanagawa.nvim',
config = function() config = function()
local kanagawa = require('kanagawa') local kanagawa = require('kanagawa')
local dragon = {
ui = {
bg = '#080808',
bg_m3 = '#262626',
bg_gutter = '#121212',
},
}
kanagawa.setup({ kanagawa.setup({
commentStyle = { italic = false }, commentStyle = { italic = false },
keywordStyle = { italic = false}, keywordStyle = { italic = false },
-- TODO: make background darker colors = { theme = { dragon = dragon } },
}) })
kanagawa.load('dragon') kanagawa.load('dragon')
end
-- Override highlight groups
vim.cmd('highlight WinSeparator guifg=' .. dragon.ui.bg_m3 .. ' guibg=' .. dragon.ui.bg_m3)
vim.cmd('highlight MsgSeparator guifg=' .. dragon.ui.bg_m3 .. ' guibg=' .. dragon.ui.bg_m3)
end
} }

View File

@ -4,6 +4,7 @@ return {
'nvim-lua/plenary.nvim', 'nvim-lua/plenary.nvim',
'nvim-telescope/telescope-fzy-native.nvim', 'nvim-telescope/telescope-fzy-native.nvim',
'nvim-tree/nvim-web-devicons', 'nvim-tree/nvim-web-devicons',
'axkirillov/easypick.nvim',
}, },
config = function() config = function()
local telescope = require('telescope') local telescope = require('telescope')