27 changed files with 265 additions and 74 deletions
@ -0,0 +1,45 @@
@@ -0,0 +1,45 @@
|
||||
;;; AllCubes --- An index to use import all the cubes at once -*- lexical-binding: t; -*- |
||||
;; |
||||
;; Copyright (c) 2010-2021 Sameer Rahmani & Contributors |
||||
;; |
||||
;; Author: Sameer Rahmani <lxsameer@gnu.org> |
||||
;; URL: https://gitlab.com/FG42/FG42 |
||||
;; Version: 3.0.0 |
||||
;; |
||||
;; This program is free software; you can redistribute it and/or modify |
||||
;; it under the terms of the GNU General Public License as published by |
||||
;; the Free Software Foundation, either version 3 of the License, or |
||||
;; (at your option) any later version. |
||||
;; |
||||
;; This program is distributed in the hope that it will be useful, |
||||
;; but WITHOUT ANY WARRANTY; without even the implied warranty of |
||||
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||||
;; GNU General Public License for more details. |
||||
;; |
||||
;; You should have received a copy of the GNU General Public License |
||||
;; along with this program. If not, see <http://www.gnu.org/licenses/>. |
||||
;; |
||||
;;; Commentary: |
||||
;;; Code: |
||||
|
||||
(require 'fg42/flags) |
||||
(require 'cubes/editor) |
||||
(require 'cubes/elisp) |
||||
(require 'cubes/region-expansion) |
||||
(require 'cubes/wm) |
||||
(require 'cubes/modeline) |
||||
(require 'cubes/autocompletion) |
||||
(require 'cubes/golang) |
||||
(require 'cubes/project) |
||||
(require 'cubes/irc) |
||||
(require 'cubes/terminal) |
||||
(require 'cubes/java) |
||||
(require 'cubes/python) |
||||
(require 'cubes/snippets) |
||||
(require 'cubes/org) |
||||
(require 'cubes/git) |
||||
(require 'cubes/bookmark) |
||||
(require 'cubes/terraform) |
||||
|
||||
(provide 'cubes/all) |
||||
;;; all.el ends here |
@ -0,0 +1,80 @@
@@ -0,0 +1,80 @@
|
||||
;;; PythonCubes --- The Python cubes for FG42 -*- lexical-binding: t; -*- |
||||
;; |
||||
;; Copyright (c) 2010-2021 Sameer Rahmani & Contributors |
||||
;; |
||||
;; Author: Sameer Rahmani <lxsameer@gnu.org> |
||||
;; URL: https://gitlab.com/FG42/FG42 |
||||
;; Version: 3.0.0 |
||||
;; |
||||
;; This program is free software; you can redistribute it and/or modify |
||||
;; it under the terms of the GNU General Public License as published by |
||||
;; the Free Software Foundation, either version 3 of the License, or |
||||
;; (at your option) any later version. |
||||
;; |
||||
;; This program is distributed in the hope that it will be useful, |
||||
;; but WITHOUT ANY WARRANTY; without even the implied warranty of |
||||
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||||
;; GNU General Public License for more details. |
||||
;; |
||||
;; You should have received a copy of the GNU General Public License |
||||
;; along with this program. If not, see <http://www.gnu.org/licenses/>. |
||||
;; |
||||
;;; Commentary: |
||||
;;; Code: |
||||
(require 'fpkg) |
||||
(require 'fg42/cube) |
||||
(require 'fg42/utils) |
||||
|
||||
|
||||
(defun fg42/py-workon-project-venv () |
||||
"Call pyenv-workon with the current projectile project name. |
||||
This will return the full path of the associated virtual |
||||
environment found in $WORKON_HOME, or nil if the environment does |
||||
not exist." |
||||
(require 'pyenv) |
||||
(let ((pname (projectile-project-name))) |
||||
(pyvenv-workon pname) |
||||
(if (file-directory-p pyvenv-virtual-env) |
||||
pyvenv-virtual-env |
||||
(pyvenv-deactivate)))) |
||||
|
||||
|
||||
(defun fg42/py-auto-lsp () |
||||
"Turn on lsp mode in a Python project with some automated logic. |
||||
Try to automatically determine which pyenv virtual environment to |
||||
activate based on the project name, using |
||||
`dd/py-workon-project-venv'. If successful, call `lsp'. If we |
||||
cannot determine the virtualenv automatically, first call the |
||||
interactive `pyvenv-workon' function before `lsp'" |
||||
(interactive) |
||||
(let ((pvenv (fg42/py-workon-project-venv))) |
||||
(if pvenv |
||||
(lsp) |
||||
(progn |
||||
(call-interactively #'pyvenv-workon) |
||||
(lsp))))) |
||||
|
||||
|
||||
(defcube fg42/python-cube |
||||
"Python support cube." |
||||
(:title "Python cube" |
||||
:flag python) |
||||
|
||||
(fpkg/use pyvenv |
||||
:defer t |
||||
:config |
||||
(setenv "WORKON_HOME" "~/.pyenv/versions")) |
||||
|
||||
(when-flag lsp |
||||
(with-eval-after-load "lsp" |
||||
(lsp-register-custom-settings |
||||
'(("pyls.plugins.pyls_mypy.enabled" t t) |
||||
("pyls.plugins.flake8.enabled" t t) |
||||
("pyls.plugins.pyls_mypy.live_mode" nil t) |
||||
("pyls.plugins.pyls_black.enabled" t t) |
||||
("pyls.plugins.pyls_isort.enabled" t t))) |
||||
(add-hook 'python-mode #'fg42/py-auto-lsp)))) |
||||
|
||||
|
||||
(provide 'cubes/python) |
||||
;;; python.el ends here |
@ -1,6 +0,0 @@
@@ -1,6 +0,0 @@
|
||||
#+TITLE: FG42, The ultimate editor for true believers |
||||
|
||||
- [[file:categories/nil.org][<<<title>>>]] |
||||
- [[file:tags/index.org][Tags]] |
||||
- [[file:categories/index.org][Categories]] |
||||
- [[file:index.org][The little nest of mine]] |
Loading…
Reference in new issue