Giter Club home page Giter Club logo

nvim-kickstart-python's Introduction

nvim-kickstart-python

A launch point for your nvim config for python.

Similar to kickstart.nvim, but specifically for python.

Motivation

While there are quite a few great nvim distros and nvim starter configs out there, one thing I somewhat missed was a base config for specific languages. I recently started to learn python and was missing a minimal example what the state-of-the-art nvim setup specifically for python is.

After figuring most of it out, I decided to publish this config for others to use. It is intended as a launch point for python devs switching to nvim, or as a reference for nvim users who want to start doing python development.

Philosophy & Features

  • This is not a nvim-distro, this is a minimal nvim config specifically for python. It's intended as a starting point for creating your own config.
  • Requirement: nvim v0.9.
  • ~20 plugins, ~400 lines, everything in one single init.lua.
  • Includes detailed comments explaining what the config does.
  • The config can be fully bootstrapped: all plugins and tools are automatically installed on startup.
  • Uses the current state-of-the-art of the nvim plugin ecosystem.
  • Includes some common tooling for python development:
    • LSP (Completion, Typing): pyright
    • Linting (Diagnostics): ruff
    • Formatting: black & isort
    • Debugger: debugpy
    • Embedded REPL: ipython (if not installed, falls back to python3)
  • In addition, this config includes editing utilities specifically for python, like for example docstrings creation, selecting virtual environments, or auto-converting f-strings.

Recommendation

Go though the kickstart-python.lua, it is commented in detail.

You can copypaste the config into you current init.lua to use it as a starting point for your regular config, or you can copypaste parts of it into your existing config.

Download

Download the kickstart-python.lua file and run neovim with it:

# download the config
curl --remote-name "https://raw.githubusercontent.com/chrisgrieser/nvim-kickstart-python/main/kickstart-python.lua"

# start neovim with the config, opening a file `foobar.py`
# (any existing config you are using remains untouched)
nvim -u kickstart-python.lua foobar.py

The config automatically installs all the plugins and tooling needed.

Syntax Highlighting

Is provided by the nvim-treesitter plugin and/or the semshi plugin. The later requires pynvim (python3 -m pip install pynvim) to be installed.

Both provide better highlighting, treesitter is considered the more "modern" approach. Treesitter covers some cases semshi does not and vice versa. Have a look at the comparison to decide for yourself which one to use. (You can use both, of course.)

Additional plugins of interest

These plugins are not included in the config, but they are worth mentioning, as some people might be interested in them:

Recommended Citation

You can cite this software project as:

Grieser, C. (2023). nvim-kickstart-python [Computer software]. 
https://github.com/chrisgrieser/nvim-kickstart-python

For other citation styles, use the following metadata:

Credits

Thanks
kickstart.nvim as an example how to do this.

About Me
In my day job, I am a sociologist studying the social mechanisms underlying the digital economy. For my PhD project, I investigate the governance of the app economy and how software ecosystems manage the tension between innovation and compatibility. If you are interested in this subject, feel free to get in touch.

Blog
I also occasionally blog about vim: Nano Tips for Vim

Profiles

Buy Me a Coffee at ko-fi.com

nvim-kickstart-python's People

Contributors

chrisgrieser avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

Forkers

yosefyehoshua

nvim-kickstart-python's Issues

nvim-dap-ui config, missing function wrapper around call to `require("dapui").close()`

Hey,

[I am coming from your reddit post] I was browsing through the code, and I spotted something fishy. I am not 100% sure, but I think there might be a problem with the nvim-dap-ui config. Specifically the part when you setup the event handlers:

config = function()
			local listener = require("dap").listeners
			listener.after.event_initialized["dapui_config"] = function() require("dapui").open() end
			listener.before.event_terminated["dapui_config"] = require("dapui").close()
			listener.before.event_exited["dapui_config"] = require("dapui").close()
		end,

for event_terminated and event_exited, you call the close() function directly (so at config-time, not when the event is actually fired). I think what you want is:

listener.before.event_terminated["dapui_config"] = function() require("dapui").close() end
listener.before.event_exited["dapui_config"] = function() require("dapui").close() end

Anyway, I thought I'd mention it ;-)

Use keymap.set over cmd.inoreabbrev

'ia' as the mode is an insert mode abbreviation, since a while ago - not sure when exactly:
vim.keymap.set('ia', '--', '#', { buffer = true })

Or if you want to have fun,

vim.iter {
  true = 'True',
  false = 'False',
  ['--'] = '#',
  null = 'None',
  none = 'None',
  nil = 'None',
}:each(function(lhs, rhs)
  vim.keymap.set('ia', lhs, rhs, { buffer = true })
end)

Or

local iabbrev = function(lhs, rhs)
  vim.keymap.set('ia', lhs, rhs, { buffer = true })
end
iabbrev('true', 'True')
iabbrev('false', 'False')
iabbrev('--', '#')
iabbrev('null', 'None')
iabbrev('none', 'None')
iabbrev('nil', 'None')

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.