comfortable, but python not formatting

This commit is contained in:
Oluwatobi 2023-10-06 20:38:37 +01:00
parent f15af9b8be
commit fc4c1c2612
24 changed files with 754 additions and 548 deletions

View file

@ -1,5 +0,0 @@
-- You can add your own plugins here or in other files in this directory!
-- I promise not to create any merge conflicts in this directory :)
--
-- See the kickstart.nvim README for more information
return {}

7
lua/plugins/alpha.lua Normal file
View file

@ -0,0 +1,7 @@
return {
'goolord/alpha-nvim',
dependencies = { 'nvim-tree/nvim-web-devicons' },
config = function ()
require'alpha'.setup(require'alpha.themes.startify'.config)
end
};

15
lua/plugins/autopairs.lua Normal file
View file

@ -0,0 +1,15 @@
return {
"windwp/nvim-autopairs",
-- Optional dependency
dependencies = { 'hrsh7th/nvim-cmp' },
config = function()
require("nvim-autopairs").setup {}
-- If you want to automatically add `(` after selecting a function or method
local cmp_autopairs = require('nvim-autopairs.completion.cmp')
local cmp = require('cmp')
cmp.event:on(
'confirm_done',
cmp_autopairs.on_confirm_done()
)
end,
}

18
lua/plugins/comments.lua Normal file
View file

@ -0,0 +1,18 @@
return {
'numToStr/Comment.nvim',
opts = {
toggler = {
---Line-comment toggle keymap
line = '++',
---Block-comment toggle keymap
block = '++',
},
opleader = {
---Line-comment keymap
line = '++',
---Block-comment keymap
block = '++',
},
},
lazy = false,
}

31
lua/plugins/gitsigns.lua Normal file
View file

@ -0,0 +1,31 @@
return {
-- Adds git related signs to the gutter, as well as utilities for managing changes
'lewis6991/gitsigns.nvim',
opts = {
-- See `:help gitsigns.txt`
signs = {
add = { text = '+' },
change = { text = '~' },
delete = { text = '_' },
topdelete = { text = '' },
changedelete = { text = '~' },
},
on_attach = function(bufnr)
vim.keymap.set('n', '<leader>hp', require('gitsigns').preview_hunk,
{ buffer = bufnr, desc = 'Preview git hunk' })
-- don't override the built-in and fugitive keymaps
local gs = package.loaded.gitsigns
vim.keymap.set({ 'n', 'v' }, ']c', function()
if vim.wo.diff then return ']c' end
vim.schedule(function() gs.next_hunk() end)
return '<Ignore>'
end, { expr = true, buffer = bufnr, desc = "Jump to next hunk" })
vim.keymap.set({ 'n', 'v' }, '[c', function()
if vim.wo.diff then return '[c' end
vim.schedule(function() gs.prev_hunk() end)
return '<Ignore>'
end, { expr = true, buffer = bufnr, desc = "Jump to previous hunk" })
end,
},
}

90
lua/plugins/init.lua Normal file
View file

@ -0,0 +1,90 @@
return {
-- NOTE: First, some plugins that don't require any configuration
-- Git related plugins
'tpope/vim-fugitive',
'tpope/vim-rhubarb',
-- Detect tabstop and shiftwidth automatically
'tpope/vim-sleuth',
-- Useful plugin to show you pending keybinds.
{ 'folke/which-key.nvim', opts = {} },
{ "mbbill/undotree" },
{
-- Theme inspired by Atom
'navarasu/onedark.nvim',
priority = 1000,
config = function()
vim.cmd.colorscheme 'onedark'
end,
},
{
-- Set lualine as statusline
'nvim-lualine/lualine.nvim',
-- See `:help lualine.txt`
opts = {
options = {
icons_enabled = false,
theme = 'onedark',
component_separators = '|',
section_separators = '',
},
},
},
{
-- Autocompletion
'hrsh7th/nvim-cmp',
dependencies = {
-- Snippet Engine & its associated nvim-cmp source
'L3MON4D3/LuaSnip',
'saadparwaiz1/cmp_luasnip',
-- Adds LSP completion capabilities
'hrsh7th/cmp-nvim-lsp',
-- Adds a number of user-friendly snippets
'rafamadriz/friendly-snippets',
},
},
-- Fuzzy Finder (files, lsp, etc)
{
'nvim-telescope/telescope.nvim',
branch = '0.1.x',
dependencies = {
'nvim-lua/plenary.nvim',
-- Fuzzy Finder Algorithm which requires local dependencies to be built.
-- Only load if `make` is available. Make sure you have the system
-- requirements installed.
{
'nvim-telescope/telescope-fzf-native.nvim',
-- NOTE: If you are having trouble with this installation,
-- refer to the README for telescope-fzf-native for more instructions.
build = 'make',
cond = function()
return vim.fn.executable 'make' == 1
end,
},
},
},
-- NOTE: Next Step on Your Neovim Journey: Add/Configure additional "plugins" for kickstart
-- These are some example plugins that I've included in the kickstart repository.
-- Uncomment any of the lines below to enable them.
--[[ require 'kickstart.plugins.autoformat', ]]
--[[ require 'kickstart.plugins.debug', ]]
-- NOTE: The import below can automatically add your own plugins, configuration, etc from `lua/custom/plugins/*.lua`
-- You can use this folder to prevent any conflicts with this init.lua if you're interested in keeping
-- up-to-date with whatever is in the kickstart repo.
-- Uncomment the following line and add your plugins to `lua/custom/plugins/*.lua` to get going.
--
-- For additional information see: https://github.com/folke/lazy.nvim#-structuring-your-plugins
-- { import = 'custom.plugins' },
}, {}

9
lua/plugins/lazygit.lua Normal file
View file

@ -0,0 +1,9 @@
return {
{
"kdheepak/lazygit.nvim",
-- optional for floating window border decoration
dependencies = {
"nvim-lua/plenary.nvim",
},
},
}

25
lua/plugins/lsp.lua Normal file
View file

@ -0,0 +1,25 @@
return {
'VonHeikemen/lsp-zero.nvim',
branch = 'v1.x',
dependencies = {
-- LSP Support
{ 'neovim/nvim-lspconfig' },
{ 'williamboman/mason.nvim' },
{ 'williamboman/mason-lspconfig.nvim' },
-- Autocompletion
{ 'hrsh7th/nvim-cmp' },
{ 'hrsh7th/cmp-buffer' },
{ 'hrsh7th/cmp-path' },
{ 'saadparwaiz1/cmp_luasnip' },
{ 'hrsh7th/cmp-nvim-lsp' },
{ 'hrsh7th/cmp-nvim-lua' },
-- Snippets
{ 'L3MON4D3/LuaSnip' },
{ 'rafamadriz/friendly-snippets' },
},
-- Use the lazy option to lazy-load the plugin on events or commands
lazy = true,
}

122
lua/plugins/neo-tree.lua Normal file
View file

@ -0,0 +1,122 @@
return {
"nvim-neo-tree/neo-tree.nvim",
branch = "*",
dependencies = {
"nvim-lua/plenary.nvim",
"nvim-tree/nvim-web-devicons", -- not strictly required, but recommended
"MunifTanjim/nui.nvim",
},
cmd = "Neotree",
keys = {
{
"<leader>o",
function()
if vim.bo.filetype == "neo-tree" then
vim.cmd.wincmd "p"
else
vim.cmd.Neotree "focus"
end
end,
desc = "Toggle Explorer Focus"
},
{ "<C-n>", "<cmd>Neotree toggle<cr>", desc = "Toggle Explorer" }
},
init = function() vim.g.neo_tree_remove_legacy_commands = true end,
opts = {
auto_clean_after_session_restore = true,
close_if_last_window = true,
source_selector = {
winbar = true,
content_layout = "center",
},
commands = {
--[[ system_open = function(state) require("astronvim.utils").system_open(state.tree:get_node():get_id()) end, ]]
parent_or_close = function(state)
local node = state.tree:get_node()
if (node.type == "directory" or node:has_children()) and node:is_expanded() then
state.commands.toggle_node(state)
else
require("neo-tree.ui.renderer").focus_node(state, node:get_parent_id())
end
end,
child_or_open = function(state)
local node = state.tree:get_node()
if node.type == "directory" or node:has_children() then
if not node:is_expanded() then -- if unexpanded, expand
state.commands.toggle_node(state)
else -- if expanded and has children, seleect the next child
require("neo-tree.ui.renderer").focus_node(state, node:get_child_ids()[1])
end
else -- if not a directory just open it
state.commands.open(state)
end
end,
copy_selector = function(state)
local node = state.tree:get_node()
local filepath = node:get_id()
local filename = node.name
local modify = vim.fn.fnamemodify
local results = {
e = { val = modify(filename, ":e"), msg = "Extension only" },
f = { val = filename, msg = "Filename" },
F = { val = modify(filename, ":r"), msg = "Filename w/o extension" },
h = { val = modify(filepath, ":~"), msg = "Path relative to Home" },
p = { val = modify(filepath, ":."), msg = "Path relative to CWD" },
P = { val = filepath, msg = "Absolute path" },
}
local messages = {
{ "\nChoose to copy to clipboard:\n", "Normal" },
}
for i, result in pairs(results) do
if result.val and result.val ~= "" then
vim.list_extend(messages, {
{ ("%s."):format(i), "Identifier" },
{ (" %s: "):format(result.msg) },
{ result.val, "String" },
{ "\n" },
})
end
end
vim.api.nvim_echo(messages, false, {})
local result = results[vim.fn.getcharstr()]
if result and result.val and result.val ~= "" then
vim.notify("Copied: " .. result.val)
vim.fn.setreg("+", result.val)
end
end,
},
window = {
width = 30,
mappings = {
["<space>"] = false, -- disable space until we figure out which-key disabling
["[b"] = "prev_source",
["]b"] = "next_source",
o = "open",
--[[ O = "system_open", ]]
h = "parent_or_close",
l = "child_or_open",
Y = "copy_selector",
},
},
filesystem = {
hijack_netrw_behavior = "open_current",
use_libuv_file_watcher = true,
follow_current_file = {
enabled = true, -- This will find and focus the file in the active buffer every time
-- -- the current file is changed while the tree is open.
leave_dirs_open = false, -- `false` closes auto expanded dirs, such as with `:Neotree reveal`
},
},
event_handlers = {
{
event = "neo_tree_buffer_enter",
handler = function(_)
vim.opt_local.signcolumn = "auto"
-- require("neo-tree").close_all()
end,
},
},
},
}

View file

@ -0,0 +1,36 @@
return {
-- Highlight, edit, and navigate code
'nvim-treesitter/nvim-treesitter',
dependencies = {
'nvim-treesitter/nvim-treesitter-textobjects',
"windwp/nvim-ts-autotag",
"JoosepAlviste/nvim-ts-context-commentstring",
"nvim-treesitter/nvim-treesitter-context",
},
cmd = {
"TSBufDisable",
"TSBufEnable",
"TSBufToggle",
"TSDisable",
"TSEnable",
"TSToggle",
"TSInstall",
"TSInstallInfo",
"TSInstallSync",
"TSModuleInfo",
"TSUninstall",
"TSUpdate",
"TSUpdateSync",
},
build = ":TSUpdate",
opts = {
highlight = {
enable = true,
disable = function(_, bufnr) return vim.api.nvim_buf_line_count(bufnr) > 10000 end,
},
incremental_selection = { enable = true },
indent = { enable = true },
autotag = { enable = true },
context_commentstring = { enable = true, enable_autocmd = false },
},
}

View file

@ -0,0 +1,69 @@
-- [[ Basic Keymaps ]]
vim.o.relativenumber = true
-- Set highlight on search
vim.o.hlsearch = false
-- Make line numbers default
vim.wo.number = true
-- Enable mouse mode
vim.o.mouse = 'a'
-- Enable break indent
vim.o.breakindent = true
-- Save undo history
vim.o.undofile = true
-- Case-insensitive searching UNLESS \C or capital in search
vim.o.ignorecase = true
vim.o.smartcase = true
-- Keep signcolumn on by default
vim.wo.signcolumn = 'yes'
-- Decrease update time
--[[ vim.o.timeoutlen = 300 ]]
-- Set completeopt to have a better completion experience
vim.o.completeopt = 'menuone,noselect'
-- NOTE: You should make sure your terminal supports this
vim.o.termguicolors = true
vim.opt.tabstop = 4
vim.opt.softtabstop = 4
vim.opt.shiftwidth = 4
vim.opt.expandtab = true
vim.opt.swapfile = false
vim.opt.backup = false
vim.opt.undodir = os.getenv("HOME") .. "/.vim/undodir"
vim.opt.undofile = true
vim.opt.smartindent = true
vim.opt.wrap = false
vim.opt.hlsearch = false
vim.opt.incsearch = true
vim.opt.scrolloff = 8
vim.opt.signcolumn = "yes"
vim.opt.isfname:append("@-@")
vim.opt.updatetime = 50
vim.opt.colorcolumn = "100"
-- [[ Highlight on yank ]]
-- See `:help vim.highlight.on_yank()`
local highlight_group = vim.api.nvim_create_augroup('YankHighlight', { clear = true })
vim.api.nvim_create_autocmd('TextYankPost', {
callback = function()
vim.highlight.on_yank()
end,
group = highlight_group,
pattern = '*',
})

3
lua/thrillee/init.lua Normal file
View file

@ -0,0 +1,3 @@
require("thrillee.editor-configs")
require("thrillee.remaps")
require("thrillee.splits")

33
lua/thrillee/remaps.lua Normal file
View file

@ -0,0 +1,33 @@
-- Keymaps for better default experience
-- See `:help vim.keymap.set()`
vim.keymap.set({ 'n', 'v' }, '<Space>', '<Nop>', { silent = true })
-- Remap for dealing with word wrap
vim.keymap.set('n', 'k', "v:count == 0 ? 'gk' : 'k'", { expr = true, silent = true })
vim.keymap.set('n', 'j', "v:count == 0 ? 'gj' : 'j'", { expr = true, silent = true })
vim.keymap.set("i", "jk", "<Esc>")
vim.keymap.set('n', '<leader>w', '<cmd>w!<cr>', { desc = 'Save File' })
vim.keymap.set('n', '<leader>q', "<cmd>confirm q<cr>", { desc = 'Quit File' })
vim.keymap.set('v', '<C-c>', '"*y', { desc = 'Copy to system clipboard' })
vim.keymap.set('v', '<leader>p', [["_dP]], { desc = 'Paste and retain paste in clipboard' })
vim.keymap.set("n", "<leader>s", [[:%s/\<<C-r><C-w>\>/<C-r><C-w>/gI<Left><Left><Left>]],
{ desc = 'Search and Replace Highlighted Word' })
vim.keymap.set("n", "J", "mzJ`z", { desc = 'Keep cusor in index position on J' })
-- Keep cusor in middle of buffer
vim.keymap.set('n', '<C-d>', "<C-d>zz", { desc = '⬇ middle of buffer and keep cusor in middle of buffer' })
vim.keymap.set('n', '<C-u>', '<C-u>zz', { desc = '⬆ middle of buffer and keep cusor in middle of buffer' })
vim.keymap.set('n', 'N', 'nzzzv', { desc = 'next search and keep cusor in middle of buffer' })
vim.keymap.set('n', 'n', 'Nzzzv', { desc = 'previous search and keep cusor in middle of buffer' })
-- Move highlighted up or down
vim.keymap.set("v", "J", ":m '>+1<CR>gv=gv", { desc = 'Move highlighted up' })
vim.keymap.set("v", "K", ":m '<-2<CR>gv=gv", { desc = 'Move highlighted down' })
-- Map <leader>c to close and save the buffer
vim.api.nvim_set_keymap('n', '<leader>c', [[:w | bd<CR>]], { noremap = true, silent = true })

35
lua/thrillee/splits.lua Normal file
View file

@ -0,0 +1,35 @@
--[[ Split cmd ]]
vim.opt.splitbelow = true
vim.opt.splitright = true
vim.keymap.set("n", "||", "<cmd>vsplit<cr>", { desc = 'Vertical Split' })
vim.keymap.set("n", "--", "<cmd>split<cr>", { desc = 'Horinzontal Split' })
vim.keymap.set("n", "<C-h>", "<C-w>h", { desc = "Navigate to the left" })
vim.keymap.set("n", "<C-j>", "<C-w>", { desc = "Navigate below" })
vim.keymap.set("n", "<C-k>", "<C-w>k", { desc = "Navigate up" })
vim.keymap.set("n", "<C-l>", "<C-w>l", { desc = "Navigate right" })
vim.keymap.set("n", "<leader>hh", ":vertical resize +3<CR>", { silent = true })
vim.keymap.set("n", "<leader>ll", ":vertical resize -3<CR>", { silent = true })
vim.keymap.set("n", "<leader>kk", ":resize +3<CR>", { silent = true })
vim.keymap.set("n", "<leader>jj", ":resize -3<CR>", { silent = true })
vim.g.original_size = nil
function Toggle_maximize_pane()
local winnr = vim.api.nvim_get_current_win()
local width = vim.api.nvim_win_get_width(winnr)
local height = vim.api.nvim_win_get_height(winnr)
if vim.g.original_size == nil then
vim.g.original_size = { width, height }
vim.api.nvim_win_set_width(winnr, vim.o.columns)
vim.api.nvim_win_set_height(winnr, vim.o.lines)
else
vim.api.nvim_win_set_width(winnr, vim.g.original_size[1])
vim.api.nvim_win_set_height(winnr, vim.g.original_size[2])
vim.g.original_size = nil
end
end
vim.keymap.set("n", "<C-m>", '<cmd>lua Toggle_maximize_pane()<CR>', { noremap = true, desc = "Maximize Current Split" })