Update nvim config
parent
8bbe6c5269
commit
6a624131e3
|
@ -2,6 +2,7 @@ require('gpt')
|
|||
require('mappings')
|
||||
require('plugins')
|
||||
require('telescope_config')
|
||||
require('lualine_config')
|
||||
require('votion')
|
||||
|
||||
-- Misc commands similar to my vimrc
|
||||
|
@ -14,4 +15,18 @@ vim.opt.relativenumber = true
|
|||
vim.api.nvim_set_keymap('i', 'jk', '<Esc>', {noremap = true})
|
||||
vim.cmd.colorscheme "catppuccin-frappe"
|
||||
vim.g.markdown_folding = 1
|
||||
vim.opt.title = true
|
||||
vim.opt.titlestring="nvim %f"
|
||||
|
||||
-- treesitter setup
|
||||
require('nvim-treesitter.configs').setup {
|
||||
ensure_installed = {"python", "lua", "rust"}, -- Install these parsers
|
||||
highlight = {
|
||||
enable = true, -- Enable syntax highlighting
|
||||
},
|
||||
textobjects = {
|
||||
enable = true
|
||||
}
|
||||
}
|
||||
|
||||
require'lspconfig'.pyright.setup{}
|
||||
|
|
|
@ -2,21 +2,34 @@ function gpt_complete_file()
|
|||
-- Store the current buffer name and escape special characters
|
||||
local buf_name = vim.api.nvim_buf_get_name(0):gsub(' ', '\\ ')
|
||||
|
||||
-- Call gpt-md on the current file and capture output
|
||||
local result = vim.fn.system('gpt-md ' .. buf_name)
|
||||
local on_complete = function(err, exit_code, pid)
|
||||
|
||||
-- Check for errors and display the resulting message if any
|
||||
if vim.v.shell_error ~= 0 then
|
||||
print("Error executing gpt-md: " .. result)
|
||||
return
|
||||
-- Check for errors and display the resulting message if any
|
||||
if tonumber(err) ~= 0 then
|
||||
print("Error executing gpt-md:", err)
|
||||
return
|
||||
end
|
||||
|
||||
-- Reload the current buffer to load the updated content from gpt-md
|
||||
vim.api.nvim_command('edit')
|
||||
|
||||
-- Print the gpt-md result
|
||||
print("Buffer completed by gpt-md with exit code: " .. exit_code)
|
||||
end
|
||||
|
||||
-- Reload the current buffer to load the updated content from gpt-md
|
||||
vim.api.nvim_command('edit')
|
||||
local handle, pid
|
||||
handle, pid = vim.loop.spawn('gpt-md', {
|
||||
args = {buf_name},
|
||||
stdio = {nil, nil, vim.loop.new_pipe(false)},
|
||||
cwd = vim.fn.getcwd(),
|
||||
}, vim.schedule_wrap(on_complete))
|
||||
|
||||
-- Check if the command has started correctly
|
||||
if not handle then
|
||||
print("Failed to run gpt-md on the current file")
|
||||
end
|
||||
|
||||
-- Print the gpt-md result (or a success message if gpt-md doesn't return anything)
|
||||
local message = (#result > 0) and result or "Buffer successfully completed by gpt-md"
|
||||
print(message)
|
||||
end
|
||||
|
||||
vim.api.nvim_command('command! GptCompleteFile lua gpt_complete_file()')
|
||||
|
||||
|
|
|
@ -0,0 +1,8 @@
|
|||
require('lualine').setup {
|
||||
options = {
|
||||
theme = 'auto', -- Automatically detect color scheme
|
||||
icons_enabled = true,
|
||||
component_separators = {'', ''},
|
||||
section_separators= {'', ''},
|
||||
}
|
||||
}
|
|
@ -6,12 +6,12 @@ wk.register({
|
|||
f = {
|
||||
name = "find",
|
||||
f = { "<cmd>Telescope find_files<cr>", "File" },
|
||||
g = { "<cmd>Telescope live_grep<cr>", "Grep" },
|
||||
r = { "<cmd>Telescope live_grep<cr>", "Rip Grep" },
|
||||
b = { "<cmd>Telescope buffers<cr>", "Buffers" },
|
||||
h = { "<cmd>Telescope help_tags<cr>", "Help Tags" },
|
||||
s = { "<cmd>Telescope colorscheme<cr>", "Colorscheme" },
|
||||
c = { "<cmd>Telescope commands<cr>", "Commands" },
|
||||
p = { "<cmd>Telescope find_files search_dirs={'~/owc/gpt'}<CR>", "GPT" },
|
||||
g = { "<cmd>Telescope find_files search_dirs={'~/owc/gpt'}<CR>", "GPT" },
|
||||
},
|
||||
}, { prefix = "<leader>" })
|
||||
|
||||
|
@ -57,6 +57,7 @@ wk.register({
|
|||
n = { "<cmd>VotionNew<cr>", "New" },
|
||||
o = { "<cmd>VotionOpen<cr>", "Open" },
|
||||
g = { "<cmd>VotionGrep<cr>", "Grep" },
|
||||
i = { "<cmd>VotionInsert<cr>", "Insert" },
|
||||
r = { "<cmd>VotionRename<cr>", "Rename" },
|
||||
f = { "<cmd>VotionFollow<cr>", "Follow" },
|
||||
d = { "<cmd>VotionDelete<cr>", "Delete" },
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
return require('packer').startup(function(use)
|
||||
use 'wbthomason/packer.nvim'
|
||||
|
||||
use { 'nvim-treesitter/nvim-treesitter' }
|
||||
use { "catppuccin/nvim", name = "catppuccin" }
|
||||
use 'nvim-tree/nvim-web-devicons'
|
||||
|
||||
use {
|
||||
'nvim-telescope/telescope.nvim', branch = '0.1.x',
|
||||
|
@ -22,7 +22,8 @@ return require('packer').startup(function(use)
|
|||
config = function() require('oil').setup() end
|
||||
}
|
||||
|
||||
-- Local plugins can be included
|
||||
-- use '~/projects/personal/hover.nvim'
|
||||
use 'nvim-tree/nvim-web-devicons'
|
||||
use 'hoob3rt/lualine.nvim'
|
||||
use 'neovim/nvim-lspconfig'
|
||||
|
||||
end)
|
||||
|
|
|
@ -18,6 +18,20 @@ function votion_open()
|
|||
})
|
||||
end
|
||||
|
||||
function votion_insert()
|
||||
require("telescope.builtin").find_files({
|
||||
search_dirs = {votion_directory},
|
||||
attach_mappings = function(_, map)
|
||||
map('i', '<CR>', function(prompt_bufnr)
|
||||
local entry = require("telescope.actions.state").get_selected_entry()
|
||||
require("telescope.actions").close(prompt_bufnr)
|
||||
vim.api.nvim_put({entry.value}, "b", true, true)
|
||||
end)
|
||||
return true
|
||||
end,
|
||||
})
|
||||
end
|
||||
|
||||
function votion_grep()
|
||||
require("telescope.builtin").live_grep({
|
||||
search_dirs = {votion_directory}
|
||||
|
@ -103,3 +117,4 @@ vim.api.nvim_command("command! VotionGrep lua votion_grep()")
|
|||
vim.api.nvim_command("command! VotionRename lua votion_rename()")
|
||||
vim.api.nvim_command("command! VotionFollow lua votion_follow()")
|
||||
vim.api.nvim_command("command! VotionDelete lua votion_delete()")
|
||||
vim.api.nvim_command("command! VotionInsert lua votion_insert()")
|
||||
|
|
|
@ -91,5 +91,6 @@
|
|||
"[jsonc]": {
|
||||
"editor.defaultFormatter": "esbenp.prettier-vscode"
|
||||
},
|
||||
"workbench.startupEditor": "none"
|
||||
"workbench.startupEditor": "none",
|
||||
"window.menuBarVisibility": "toggle"
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue