python-setup-nodeb
This commit is contained in:
parent
3338d39206
commit
7918a04c2f
|
@ -0,0 +1,23 @@
|
|||
import http.client
|
||||
import json
|
||||
|
||||
|
||||
def x(y):
|
||||
z = y + 1
|
||||
return z
|
||||
|
||||
|
||||
def fetch(s):
|
||||
pass
|
||||
|
||||
|
||||
# gd go to definition not working
|
||||
def fetch_weather_data(latitude, longitude):
|
||||
conn = http.client.HTTPSConnection("api.open-meteo.com")
|
||||
endpoint = (
|
||||
f"/v1/forecast?latitude={latitude}&longitude={longitude}¤t_weather=true"
|
||||
)
|
||||
conn.request("GET", endpoint)
|
||||
response = conn.getresponse()
|
||||
data = response.read().decode("utf-8")
|
||||
return json.loads(data)
|
71
init.lua
71
init.lua
|
@ -298,7 +298,7 @@ require('lazy').setup({
|
|||
-- Then, because we use the `opts` key (recommended), the configuration runs
|
||||
-- after the plugin has been loaded as `require(MODULE).setup(opts)`.
|
||||
|
||||
{ -- Useful plugin to show you pending keybinds.
|
||||
{ -- Useful plugin to show you pending keybinds.
|
||||
'folke/which-key.nvim',
|
||||
event = 'VimEnter', -- Sets the loading event to 'VimEnter'
|
||||
opts = {
|
||||
|
@ -379,7 +379,7 @@ require('lazy').setup({
|
|||
{ 'nvim-telescope/telescope-ui-select.nvim' },
|
||||
|
||||
-- Useful for getting pretty icons, but requires a Nerd Font.
|
||||
{ 'nvim-tree/nvim-web-devicons', enabled = vim.g.have_nerd_font },
|
||||
{ 'nvim-tree/nvim-web-devicons', enabled = vim.g.have_nerd_font },
|
||||
},
|
||||
config = function()
|
||||
-- Telescope is a fuzzy finder that comes with a lot of different things that
|
||||
|
@ -487,7 +487,7 @@ require('lazy').setup({
|
|||
'WhoIsSethDaniel/mason-tool-installer.nvim',
|
||||
|
||||
-- Useful status updates for LSP.
|
||||
{ 'j-hui/fidget.nvim', opts = {} },
|
||||
{ 'j-hui/fidget.nvim', opts = {} },
|
||||
|
||||
-- Allows extra capabilities provided by blink.cmp
|
||||
'saghen/blink.cmp',
|
||||
|
@ -683,6 +683,22 @@ require('lazy').setup({
|
|||
-- But for many setups, the LSP (`ts_ls`) will work just fine
|
||||
-- ts_ls = {},
|
||||
--
|
||||
pylsp = {
|
||||
settings = {
|
||||
pylsp = {
|
||||
plugins = {
|
||||
pyflakes = { enabled = false },
|
||||
pycodestyle = { enabled = false },
|
||||
autopep8 = { enabled = false },
|
||||
yapf = { enabled = false },
|
||||
mccabe = { enabled = false },
|
||||
pylsp_mypy = { enabled = false },
|
||||
pylsp_black = { enabled = false },
|
||||
pylsp_isort = { enabled = false },
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
|
||||
lua_ls = {
|
||||
-- cmd = { ... },
|
||||
|
@ -736,47 +752,6 @@ require('lazy').setup({
|
|||
end,
|
||||
},
|
||||
|
||||
{ -- Autoformat
|
||||
'stevearc/conform.nvim',
|
||||
event = { 'BufWritePre' },
|
||||
cmd = { 'ConformInfo' },
|
||||
keys = {
|
||||
{
|
||||
'<leader>f',
|
||||
function()
|
||||
require('conform').format { async = true, lsp_format = 'fallback' }
|
||||
end,
|
||||
mode = '',
|
||||
desc = '[F]ormat buffer',
|
||||
},
|
||||
},
|
||||
opts = {
|
||||
notify_on_error = false,
|
||||
format_on_save = function(bufnr)
|
||||
-- Disable "format_on_save lsp_fallback" for languages that don't
|
||||
-- have a well standardized coding style. You can add additional
|
||||
-- languages here or re-enable it for the disabled ones.
|
||||
local disable_filetypes = { c = true, cpp = true }
|
||||
if disable_filetypes[vim.bo[bufnr].filetype] then
|
||||
return nil
|
||||
else
|
||||
return {
|
||||
timeout_ms = 500,
|
||||
lsp_format = 'fallback',
|
||||
}
|
||||
end
|
||||
end,
|
||||
formatters_by_ft = {
|
||||
lua = { 'stylua' },
|
||||
-- Conform can also run multiple formatters sequentially
|
||||
-- python = { "isort", "black" },
|
||||
--
|
||||
-- You can use 'stop_after_first' to run the first available formatter from the list
|
||||
-- javascript = { "prettierd", "prettier", stop_after_first = true },
|
||||
},
|
||||
},
|
||||
},
|
||||
|
||||
{ -- Autocompletion
|
||||
'saghen/blink.cmp',
|
||||
event = 'VimEnter',
|
||||
|
@ -944,7 +919,7 @@ require('lazy').setup({
|
|||
main = 'nvim-treesitter.configs', -- Sets main module to use for opts
|
||||
-- [[ Configure Treesitter ]] See `:help nvim-treesitter`
|
||||
opts = {
|
||||
ensure_installed = { 'bash', 'c', 'diff', 'html', 'lua', 'luadoc', 'markdown', 'markdown_inline', 'query', 'vim', 'vimdoc' },
|
||||
ensure_installed = { 'python', 'bash', 'c', 'diff', 'html', 'lua', 'luadoc', 'markdown', 'markdown_inline', 'query', 'vim', 'vimdoc' },
|
||||
-- Autoinstall languages that are not installed
|
||||
auto_install = true,
|
||||
highlight = {
|
||||
|
@ -973,18 +948,18 @@ require('lazy').setup({
|
|||
-- Here are some example plugins that I've included in the Kickstart repository.
|
||||
-- Uncomment any of the lines below to enable them (you will need to restart nvim).
|
||||
--
|
||||
-- require 'kickstart.plugins.debug',
|
||||
require 'kickstart.plugins.debug',
|
||||
-- require 'kickstart.plugins.indent_line',
|
||||
-- require 'kickstart.plugins.lint',
|
||||
-- require 'kickstart.plugins.autopairs',
|
||||
-- require 'kickstart.plugins.neo-tree',
|
||||
require 'kickstart.plugins.neo-tree',
|
||||
-- require 'kickstart.plugins.gitsigns', -- adds gitsigns recommend keymaps
|
||||
|
||||
-- NOTE: The import below can automatically add your own plugins, configuration, etc from `lua/custom/plugins/*.lua`
|
||||
-- This is the easiest way to modularize your config.
|
||||
--
|
||||
-- Uncomment the following line and add your plugins to `lua/custom/plugins/*.lua` to get going.
|
||||
-- { import = 'custom.plugins' },
|
||||
{ import = 'custom.plugins' },
|
||||
--
|
||||
-- For additional information with loading, sourcing and examples see `:help lazy.nvim-🔌-plugin-spec`
|
||||
-- Or use telescope!
|
||||
|
|
|
@ -2,4 +2,61 @@
|
|||
-- I promise not to create any merge conflicts in this directory :)
|
||||
--
|
||||
-- See the kickstart.nvim README for more information
|
||||
return {}
|
||||
---- Format on save and linters
|
||||
return {
|
||||
{
|
||||
'nvimtools/none-ls.nvim',
|
||||
dependencies = {
|
||||
'nvimtools/none-ls-extras.nvim',
|
||||
'jayp0521/mason-null-ls.nvim', -- ensure dependencies are installed
|
||||
},
|
||||
config = function()
|
||||
local null_ls = require 'null-ls'
|
||||
local formatting = null_ls.builtins.formatting -- to setup formatters
|
||||
local diagnostics = null_ls.builtins.diagnostics -- to setup linters
|
||||
|
||||
-- list of formatters & linters for mason to install
|
||||
require('mason-null-ls').setup {
|
||||
ensure_installed = {
|
||||
'checkmake',
|
||||
'prettier', -- ts/js formatter
|
||||
'eslint_d', -- ts/js linter
|
||||
'shfmt',
|
||||
-- 'stylua', -- lua formatter; Already installed via Mason
|
||||
'ruff', -- Python linter and formatter; Already installed via Mason
|
||||
},
|
||||
-- auto-install configured formatters & linters (with null-ls)
|
||||
automatic_installation = true,
|
||||
}
|
||||
|
||||
local sources = {
|
||||
diagnostics.checkmake,
|
||||
formatting.prettier.with { filetypes = { 'html', 'json', 'yaml', 'markdown' } },
|
||||
formatting.stylua,
|
||||
formatting.shfmt.with { args = { '-i', '4' } },
|
||||
formatting.terraform_fmt,
|
||||
require('none-ls.formatting.ruff').with { extra_args = { '--extend-select', 'I' } },
|
||||
require 'none-ls.formatting.ruff_format',
|
||||
}
|
||||
|
||||
local augroup = vim.api.nvim_create_augroup('LspFormatting', {})
|
||||
null_ls.setup {
|
||||
-- debug = true, -- Enable debug mode. Inspect logs with :NullLsLog.
|
||||
sources = sources,
|
||||
-- you can reuse a shared lspconfig on_attach callback here
|
||||
on_attach = function(client, bufnr)
|
||||
if client.supports_method 'textDocument/formatting' then
|
||||
vim.api.nvim_clear_autocmds { group = augroup, buffer = bufnr }
|
||||
vim.api.nvim_create_autocmd('BufWritePre', {
|
||||
group = augroup,
|
||||
buffer = bufnr,
|
||||
callback = function()
|
||||
vim.lsp.buf.format { async = false }
|
||||
end,
|
||||
})
|
||||
end
|
||||
end,
|
||||
}
|
||||
end,
|
||||
},
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue