cleanup
This commit is contained in:
parent
d0a67da1e1
commit
9bb85c1faa
|
@ -1,26 +1,26 @@
|
||||||
local dap = require('dap')
|
-- local dap = require('dap')
|
||||||
dap.configurations.python = {
|
-- dap.configurations.python = {
|
||||||
{
|
-- {
|
||||||
-- The first three options are required by nvim-dap
|
-- -- The first three options are required by nvim-dap
|
||||||
type = 'python'; -- the type here established the link to the adapter definition: `dap.adapters.python`
|
-- type = 'python'; -- the type here established the link to the adapter definition: `dap.adapters.python`
|
||||||
request = 'launch';
|
-- request = 'launch';
|
||||||
name = "Launch file";
|
-- name = "Launch file";
|
||||||
|
--
|
||||||
-- Options below are for debugpy, see https://github.com/microsoft/debugpy/wiki/Debug-configuration-settings for supported options
|
-- -- Options below are for debugpy, see https://github.com/microsoft/debugpy/wiki/Debug-configuration-settings for supported options
|
||||||
|
--
|
||||||
program = "${file}"; -- This configuration will launch the current file if used.
|
-- program = "${file}"; -- This configuration will launch the current file if used.
|
||||||
pythonPath = function()
|
-- pythonPath = function()
|
||||||
-- debugpy supports launching an application with a different interpreter then the one used to launch debugpy itself.
|
-- -- debugpy supports launching an application with a different interpreter then the one used to launch debugpy itself.
|
||||||
-- The code below looks for a `venv` or `.venv` folder in the current directly and uses the python within.
|
-- -- The code below looks for a `venv` or `.venv` folder in the current directly and uses the python within.
|
||||||
-- You could adapt this - to for example use the `VIRTUAL_ENV` environment variable.
|
-- -- You could adapt this - to for example use the `VIRTUAL_ENV` environment variable.
|
||||||
local cwd = vim.fn.getcwd()
|
-- local cwd = vim.fn.getcwd()
|
||||||
if vim.fn.executable(cwd .. '/venv/bin/python') == 1 then
|
-- if vim.fn.executable(cwd .. '/venv/bin/python') == 1 then
|
||||||
return cwd .. '/venv/bin/python'
|
-- return cwd .. '/venv/bin/python'
|
||||||
elseif vim.fn.executable(cwd .. '/.venv/bin/python') == 1 then
|
-- elseif vim.fn.executable(cwd .. '/.venv/bin/python') == 1 then
|
||||||
return cwd .. '/.venv/bin/python'
|
-- return cwd .. '/.venv/bin/python'
|
||||||
else
|
-- else
|
||||||
return '/usr/bin/python'
|
-- return '/usr/bin/python'
|
||||||
end
|
-- end
|
||||||
end;
|
-- end;
|
||||||
},
|
-- },
|
||||||
}
|
-- }
|
||||||
|
|
|
@ -2,28 +2,64 @@ local keymap = vim.api.nvim_set_keymap
|
||||||
local default_ops = { noremap = true, silent = true }
|
local default_ops = { noremap = true, silent = true }
|
||||||
local settings = vim.opt
|
local settings = vim.opt
|
||||||
|
|
||||||
vim.g.mapleader = '\\'
|
-- PEP8 column
|
||||||
|
|
||||||
-- Set up
|
|
||||||
settings.colorcolumn = "80"
|
settings.colorcolumn = "80"
|
||||||
|
|
||||||
-- Execute file
|
|
||||||
keymap('n', '<F5>', ":w<CR>:exec '!clear;python' shellescape(@%, 1)<CR>", default_ops)
|
|
||||||
|
|
||||||
-- Handy stuff
|
-- Handy stuff
|
||||||
keymap('n', '<Leader>m', 'iif __name__ == "__main__":<Esc>o<Tab>main()<Esc>o<Bs><Bs><Esc>', default_ops)
|
keymap('n', '<Leader>m', 'iif __name__ == "__main__":<Esc>o main()<Esc>o<Bs><Bs><Esc>', default_ops)
|
||||||
-- keymap('n', '<Leader>f', 'idef ():<Esc>bi', default_ops)
|
-- keymap('n', '<Leader>f', 'idef ():<Esc>bi', default_ops)
|
||||||
|
|
||||||
-- Comment/Uncomment
|
|
||||||
keymap('n', '<Leader>\\', '0i# <Esc>', default_ops)
|
|
||||||
keymap('n', '<Leader>-', '0xx', default_ops)
|
|
||||||
keymap('v', '<Leader>\\', '<C-v>kI# <Esc>', default_ops)
|
|
||||||
keymap('v', '<Leader>-', '<C-v>klx<Esc>', default_ops)
|
|
||||||
|
|
||||||
-- Indenting
|
-- Indenting
|
||||||
keymap('v', '<', '<gv', default_ops)
|
keymap('v', '<', '<gv', default_ops)
|
||||||
keymap('v', '>', '>gv', default_ops)
|
keymap('v', '>', '>gv', default_ops)
|
||||||
|
|
||||||
-- REPL
|
-- [[ F1 - Execute current file ]]
|
||||||
keymap('v', '<CR>', ':ToggleTermSendVisualLines 100<CR><CR>', default_ops)
|
-- Execute file
|
||||||
|
local Terminal = require('toggleterm.terminal').Terminal
|
||||||
|
local exec_python = Terminal:new({
|
||||||
|
cmd = "echo %",
|
||||||
|
direction = "float",
|
||||||
|
count = 100,
|
||||||
|
float_opts = { border = "curved" },
|
||||||
|
close_on_exit = false
|
||||||
|
})
|
||||||
|
function _exec_python_toggle()
|
||||||
|
exec_python:toggle()
|
||||||
|
end
|
||||||
|
|
||||||
|
-- keymap('n', '<F1>', ":w<CR>:exec '!clear;python3' shellescape(@%, 1)<CR>", default_ops)
|
||||||
|
keymap('n', '<F1>', ":lua _exec_python_toggle()<CR>", default_ops)
|
||||||
|
|
||||||
|
-- [[ F2 - iPython Terminal ]]
|
||||||
|
-- Toggle a custom Terminal with ipython
|
||||||
|
local ipython = Terminal:new({
|
||||||
|
cmd = "ipython",
|
||||||
|
direction = "horizontal",
|
||||||
|
count = 200
|
||||||
|
})
|
||||||
|
function _ipython_toggle()
|
||||||
|
ipython:toggle()
|
||||||
|
end
|
||||||
|
|
||||||
|
keymap('n', '<F2>', ":lua _ipython_toggle()<CR>", default_ops)
|
||||||
|
keymap('i', '<F2>', "<Esc>:lua _ipython_toggle()<CR><Cmd>wincmd k<CR>", default_ops)
|
||||||
|
keymap('t', '<F2>', "<Esc><Cmd>wincmd k<CR>:lua _ipython_toggle()<CR>", default_ops)
|
||||||
|
|
||||||
|
-- REPL to the ipython terminal
|
||||||
|
keymap('v', '<Leader>x', ':ToggleTermSendVisualLines 200<CR><CR><CR>', default_ops)
|
||||||
|
keymap('n', '<Leader>x', ':ToggleTermSendCurrentLine 200<CR><CR>', default_ops)
|
||||||
|
|
||||||
|
-- [[ F3 - Run Pytest ]]
|
||||||
|
-- Pytest
|
||||||
|
local pytest = Terminal:new({
|
||||||
|
cmd = "python -m pytest",
|
||||||
|
direction = "float",
|
||||||
|
count = 300,
|
||||||
|
float_opts = { border = "curved" },
|
||||||
|
close_on_exit = false
|
||||||
|
})
|
||||||
|
function _pytest_toggle()
|
||||||
|
pytest:toggle()
|
||||||
|
end
|
||||||
|
|
||||||
|
keymap('n', '<F3>', ":lua _pytest_toggle()<CR>", default_ops)
|
||||||
|
|
|
@ -15,4 +15,4 @@ require("lazy").setup(
|
||||||
) -- loads each lua/plugin/*
|
) -- loads each lua/plugin/*
|
||||||
vim.cmd 'hi Normal guibg=NONE ctermbg=NONE'
|
vim.cmd 'hi Normal guibg=NONE ctermbg=NONE'
|
||||||
require("clint") -- loads lua/clint/init.lua
|
require("clint") -- loads lua/clint/init.lua
|
||||||
require('dap-python').setup('~/.virtualenvs/debugpy/bin/python')
|
-- require('dap-python').setup('~/.virtualenvs/debugpy/bin/python')
|
||||||
|
|
|
@ -1,34 +1,34 @@
|
||||||
local dap = require('dap')
|
-- local dap = require('dap')
|
||||||
dap.adapters.python = {
|
-- dap.adapters.python = {
|
||||||
type = 'executable';
|
-- type = 'executable';
|
||||||
command = '~/.virtualenvs/debugpy/bin/python';
|
-- command = '~/.virtualenvs/debugpy/bin/python';
|
||||||
args = { '-m', 'debugpy.adapter' };
|
-- args = { '-m', 'debugpy.adapter' };
|
||||||
}
|
-- }
|
||||||
|
--
|
||||||
|
--
|
||||||
local dap = require('dap')
|
-- local dap = require('dap')
|
||||||
dap.configurations.python = {
|
-- dap.configurations.python = {
|
||||||
{
|
-- {
|
||||||
-- The first three options are required by nvim-dap
|
-- -- The first three options are required by nvim-dap
|
||||||
type = 'python'; -- the type here established the link to the adapter definition: `dap.adapters.python`
|
-- type = 'python'; -- the type here established the link to the adapter definition: `dap.adapters.python`
|
||||||
request = 'launch';
|
-- request = 'launch';
|
||||||
name = "Launch file";
|
-- name = "Launch file";
|
||||||
|
--
|
||||||
-- Options below are for debugpy, see https://github.com/microsoft/debugpy/wiki/Debug-configuration-settings for supported options
|
-- -- Options below are for debugpy, see https://github.com/microsoft/debugpy/wiki/Debug-configuration-settings for supported options
|
||||||
|
--
|
||||||
program = "${file}"; -- This configuration will launch the current file if used.
|
-- program = "${file}"; -- This configuration will launch the current file if used.
|
||||||
pythonPath = function()
|
-- pythonPath = function()
|
||||||
-- debugpy supports launching an application with a different interpreter then the one used to launch debugpy itself.
|
-- -- debugpy supports launching an application with a different interpreter then the one used to launch debugpy itself.
|
||||||
-- The code below looks for a `venv` or `.venv` folder in the current directly and uses the python within.
|
-- -- The code below looks for a `venv` or `.venv` folder in the current directly and uses the python within.
|
||||||
-- You could adapt this - to for example use the `VIRTUAL_ENV` environment variable.
|
-- -- You could adapt this - to for example use the `VIRTUAL_ENV` environment variable.
|
||||||
local cwd = vim.fn.getcwd()
|
-- local cwd = vim.fn.getcwd()
|
||||||
if vim.fn.executable(cwd .. '/venv/bin/python') == 1 then
|
-- if vim.fn.executable(cwd .. '/venv/bin/python') == 1 then
|
||||||
return cwd .. '/venv/bin/python'
|
-- return cwd .. '/venv/bin/python'
|
||||||
elseif vim.fn.executable(cwd .. '/.venv/bin/python') == 1 then
|
-- elseif vim.fn.executable(cwd .. '/.venv/bin/python') == 1 then
|
||||||
return cwd .. '/.venv/bin/python'
|
-- return cwd .. '/.venv/bin/python'
|
||||||
else
|
-- else
|
||||||
return 'python3'
|
-- return 'python3'
|
||||||
end
|
-- end
|
||||||
end;
|
-- end;
|
||||||
},
|
-- },
|
||||||
}
|
-- }
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
--[[
|
--[[
|
||||||
-- Generic Keybindings for all files
|
-- Generic Keybindings for all file types
|
||||||
--]]
|
--]]
|
||||||
|
|
||||||
local keymap = vim.api.nvim_set_keymap
|
local keymap = vim.api.nvim_set_keymap
|
||||||
|
@ -88,11 +88,6 @@ keymap('n', '<Leader>o', ':SymbolsOutline<CR>', default_ops)
|
||||||
-- keymap('n', '<F7>', ":lua require'dap'.step_over()<CR>", default_ops)
|
-- keymap('n', '<F7>', ":lua require'dap'.step_over()<CR>", default_ops)
|
||||||
-- keymap('n', '<Leader>D', ":lua require'dapui'.toggle()<CR>", default_ops)
|
-- keymap('n', '<Leader>D', ":lua require'dapui'.toggle()<CR>", default_ops)
|
||||||
|
|
||||||
-- REPL
|
|
||||||
keymap('v', '<Leader>x', ':ToggleTermSendVisualLines 100<CR><CR><CR>', default_ops)
|
|
||||||
keymap('n', '<Leader>x', ':ToggleTermSendCurrentLine 100<CR><CR>', default_ops)
|
|
||||||
|
|
||||||
|
|
||||||
-- Helpful stuff for ToggleTerm, taken from their docs
|
-- Helpful stuff for ToggleTerm, taken from their docs
|
||||||
function _G.set_terminal_keymaps()
|
function _G.set_terminal_keymaps()
|
||||||
local opts = { buffer = 0 }
|
local opts = { buffer = 0 }
|
||||||
|
@ -108,31 +103,4 @@ end
|
||||||
-- if you only want these mappings for toggle term use term://*toggleterm#* instead
|
-- if you only want these mappings for toggle term use term://*toggleterm#* instead
|
||||||
vim.cmd('autocmd! TermOpen term://* lua set_terminal_keymaps()')
|
vim.cmd('autocmd! TermOpen term://* lua set_terminal_keymaps()')
|
||||||
|
|
||||||
-- Toggle a custom Terminal with ipython
|
|
||||||
local Terminal = require('toggleterm.terminal').Terminal
|
|
||||||
local ipython = Terminal:new({
|
|
||||||
cmd = "ipython",
|
|
||||||
direction = "horizontal",
|
|
||||||
count = 100 })
|
|
||||||
function _ipython_toggle()
|
|
||||||
ipython:toggle()
|
|
||||||
end
|
|
||||||
|
|
||||||
keymap('n', '<F1>', ":lua _ipython_toggle()<CR>", default_ops)
|
|
||||||
keymap('i', '<F1>', "<Esc>:lua _ipython_toggle()<CR><Cmd>wincmd k<CR>", default_ops)
|
|
||||||
keymap('t', '<F1>', "<Esc><Cmd>wincmd k<CR>:lua _ipython_toggle()<CR>", default_ops)
|
|
||||||
|
|
||||||
-- Pytest
|
|
||||||
local Terminal = require('toggleterm.terminal').Terminal
|
|
||||||
local pytest = Terminal:new({
|
|
||||||
cmd = "python -m pytest",
|
|
||||||
direction = "float",
|
|
||||||
count = 200,
|
|
||||||
float_opts = { border = "curved" },
|
|
||||||
close_on_exit = false
|
|
||||||
})
|
|
||||||
function _pytest_toggle()
|
|
||||||
pytest:toggle()
|
|
||||||
end
|
|
||||||
|
|
||||||
keymap('n', '<F12>', ":lua _pytest_toggle()<CR>", default_ops)
|
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
return {
|
return {}
|
||||||
{ 'mfussenegger/nvim-dap' },
|
-- return {
|
||||||
{ 'rcarriga/nvim-dap-ui', config = true },
|
-- { 'mfussenegger/nvim-dap' },
|
||||||
{ "mfussenegger/nvim-dap-python" },
|
-- { 'rcarriga/nvim-dap-ui', config = true },
|
||||||
{ "theHamsta/nvim-dap-virtual-text", config = true },
|
-- { "mfussenegger/nvim-dap-python" },
|
||||||
}
|
-- { "theHamsta/nvim-dap-virtual-text", config = true },
|
||||||
|
-- }
|
||||||
|
|
|
@ -28,26 +28,25 @@ return {
|
||||||
},
|
},
|
||||||
|
|
||||||
-- Debugging
|
-- Debugging
|
||||||
{ 'mfussenegger/nvim-dap' },
|
-- { 'mfussenegger/nvim-dap' },
|
||||||
{ 'rcarriga/nvim-dap-ui', config = true },
|
-- { 'rcarriga/nvim-dap-ui', config = true },
|
||||||
{ "mfussenegger/nvim-dap-python" },
|
-- { "mfussenegger/nvim-dap-python" },
|
||||||
{ "theHamsta/nvim-dap-virtual-text", config = true },
|
-- { "theHamsta/nvim-dap-virtual-text", config = true },
|
||||||
|
|
||||||
--------------------
|
--------------------
|
||||||
-- Color schemes
|
-- Color schemes
|
||||||
--------------------
|
--------------------
|
||||||
|
|
||||||
{ "glepnir/oceanic-material" },
|
-- { "glepnir/oceanic-material" },
|
||||||
{ "savq/melange-nvim" },
|
-- { "savq/melange-nvim" },
|
||||||
{ 'ayu-theme/ayu-vim' },
|
{ 'ayu-theme/ayu-vim' },
|
||||||
-- { 'morhetz/gruvbox' },
|
-- { 'ellisonleao/gruvbox.nvim' },
|
||||||
{ 'ellisonleao/gruvbox.nvim' },
|
-- { 'jacoborus/tender.vim' },
|
||||||
{ 'jacoborus/tender.vim' },
|
-- { 'jpo/vim-railscasts-theme' },
|
||||||
{ 'jpo/vim-railscasts-theme' },
|
-- { 'rainux/vim-desert-warm-256' },
|
||||||
{ 'rainux/vim-desert-warm-256' },
|
-- { 'ajmwagar/vim-deus' },
|
||||||
{ 'ajmwagar/vim-deus' },
|
-- { "rebelot/kanagawa.nvim" },
|
||||||
{ "rebelot/kanagawa.nvim" },
|
-- { "folke/tokyonight.nvim" },
|
||||||
{ "folke/tokyonight.nvim" },
|
|
||||||
|
|
||||||
--------------------
|
--------------------
|
||||||
-- Utility
|
-- Utility
|
||||||
|
@ -190,4 +189,14 @@ return {
|
||||||
|
|
||||||
-- Scroll bar
|
-- Scroll bar
|
||||||
-- { 'petertriho/nvim-scrollbar', config = true },
|
-- { 'petertriho/nvim-scrollbar', config = true },
|
||||||
|
|
||||||
|
-- Start up time
|
||||||
|
{
|
||||||
|
'dstein64/vim-startuptime',
|
||||||
|
},
|
||||||
|
|
||||||
|
-- maybe this helps startup
|
||||||
|
{
|
||||||
|
'nathom/filetype.nvim',
|
||||||
|
},
|
||||||
}
|
}
|
||||||
|
|
|
@ -100,13 +100,13 @@ return {
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
||||||
-- Object Explorer
|
-- -- Object Explorer
|
||||||
{
|
-- {
|
||||||
'simrat39/symbols-outline.nvim',
|
-- 'simrat39/symbols-outline.nvim',
|
||||||
config = {
|
-- config = {
|
||||||
auto_preview = true,
|
-- auto_preview = true,
|
||||||
}
|
-- }
|
||||||
},
|
-- },
|
||||||
|
|
||||||
-- Terminal
|
-- Terminal
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue