Skip to content

Commit

Permalink
load conf and dev conf from .config
Browse files Browse the repository at this point in the history
  • Loading branch information
21eleven committed Jan 22, 2022
1 parent 871faee commit facb888
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 44 deletions.
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
__pycache__/
*.log
data/
lua/config.lua

# Added by cargo

Expand Down
3 changes: 2 additions & 1 deletion codex
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#!/bin/sh

XDG_DATA_HOME="$HOME/.local/share/codex" nvim -u "$HOME"/gits/codex/init.lua "$@"
XDG_DATA_HOME="$HOME/.local/share/codex" CODEX_DEV="true" nvim -u "$HOME"/gits/codex/init.lua "$@"
# XDG_DATA_HOME="$HOME/.local/share/codex" nvim -u "$HOME"/gits/codex/init.lua "$@"
54 changes: 13 additions & 41 deletions init.lua
Original file line number Diff line number Diff line change
@@ -1,9 +1,4 @@
vim.opt.runtimepath= "~/.local/share/codex,/etc/xdg/nvim,/usr/local/share/nvim/site,/usr/share/nvim/site,/usr/share/nvim/runtime,/lib/nvim,/usr/share/nvim/site/after,/usr/local/share/nvim/site/after,~/gits/codex"

example_func = function(a, b)
print("A is: ", a)
print("B is: ", b)
end
vim.opt.runtimepath= "~/.local/share/codex,/etc/xdg/nvim,/usr/local/share/nvim/site,/usr/share/nvim/site,/usr/share/nvim/runtime,/lib/nvim,/usr/share/nvim/site/after,/usr/local/share/nvim/site/after,~/gits/codex,~/.config/codex"

local execute = vim.api.nvim_command
local fn = vim.fn
Expand All @@ -21,48 +16,25 @@ end

vim.cmd [[packadd packer.nvim]]

require('packer').startup(function()
use 'wbthomason/packer.nvim'
use {'dracula/vim', as = 'dracula'}
use { 'ms-jpq/chadtree', run = 'python -m chadtree deps'}
use {
'nvim-telescope/telescope.nvim',
requires = { {'nvim-lua/plenary.nvim'} }
}
end)
opt = vim.opt
g = vim.g

vim.cmd [[colorscheme dracula]]

Codex = require("lua/codex")

local opt = vim.opt
local g = vim.g

local function map(mode, lhs, rhs, opts)
function map(mode, lhs, rhs, opts)
local options = {noremap = true}
if opts then options = vim.tbl_extend('force', options, opts) end
vim.api.nvim_set_keymap(mode, lhs, rhs, options)
end

g.mapleader = ' '
map('i', 'jk', '<esc>', opt)
map('n', '<leader>e', ":bdelete!", opt)
map('n', '<left>', '0', opt)
map('n', '<right>', '$', opt)
map('n', '<up>', 'kkkkkkk', opt)
map('n', '<down>', 'jjjjjjj', opt)
map('n', '<leader>nh', '<esc>:', opt)
map('n', '<leader>nn', '<esc>/', opt)
map('n', '<leader>w', ':w!<cr>', opt)
map('n', '<leader><leader>w', ':wq!<cr>', opt)
map('n', '<leader>q', ':qa!<cr>', opt)
-- map('n', '<leader><leader>e', ':q!<cr>', opt)
Codex = require("lua/codex")

map('n', '<leader>j', ':BufferLineCyclePrev<CR>', opt)
map('n', '<leader>k', ':BufferLineCycleNext<CR>', opt)
map('n', '<leader>h', '<C-w>h<CR>0', opt)
-- map('n', '<leader>hh', '<C-w>h<CR>0', opt)
map('n', '<leader>l', '<C-w>l<CR>0', opt)
require('packer').startup(function()
use 'wbthomason/packer.nvim'
use {
'nvim-telescope/telescope.nvim',
requires = { {'nvim-lua/plenary.nvim'} }
}
Codex.config.packages(use)
end)

vim.cmd [[autocmd VimEnter * lua Codex.start()]]
vim.cmd [[autocmd VimLeave * lua Codex.stop()]]
9 changes: 8 additions & 1 deletion lua/codex.lua
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,14 @@ if vim.fn.executable(binary_path) == 0 then
binary_path = plugin_dir .. "/target/release/codex"
end

local config = require "lua/config"
if vim.fn.getenv("CODEX_DEV") == "true" then
M.config = require "dev_config"
else
M.config = require "config"
end

local config = M.config

local _t = {}
if config.git_remote ~= nil then
vim.fn.setenv("CODEX_GIT_REMOTE", config.git_remote)
Expand Down

0 comments on commit facb888

Please sign in to comment.