Compare commits

..

2 commits

Author SHA1 Message Date
30ca8a5ed9
Minor updates 2023-09-04 03:42:08 -04:00
99e6c22573
Experimenting with LSP 2023-09-04 03:41:39 -04:00
2 changed files with 183 additions and 78 deletions

View file

@ -39,7 +39,6 @@
(float-time
(time-subtract (current-time) before-init-time)))
gcs-done)))
;;; Initialize elpaca
(defvar elpaca-installer-version 0.5)
(defvar elpaca-directory (expand-file-name "elpaca/" user-emacs-directory))
@ -88,6 +87,25 @@
;;; Built-in features
(use-package emacs
:elpaca nil
:init
;;; Vertico
;; Add prompt to `completing-read-multiple'
(defun crm-indicator (args)
(cons (format "[CRM%s] %s"
(replace-regexp-in-string
"\\`\\[.*?]\\*\\|\\[.*?]\\*\\'" ""
crm-separator)
(car args))
(cdr args)))
(advice-add #'completing-read-multiple :filter-args #'crm-indicator)
;; Recursive minibuffers
(setq enable-recursive-minibuffers t)
;; Disable prompt in minibuffer
(setq minibuffer-prompt-properties
'(read-only t cursor-intangible t face minibuffer-prompt))
(add-hook 'minibuffer-setup-hook #'cursor-intangible-mode)
:bind
(:map global-map
;; Disable suspend-frame shortcut
@ -99,7 +117,7 @@
("S-C-<right>" . enlarge-window-horizontally)
("S-C-<down>" . shrink-window)
("S-C-<up>" . enlarge-window))
:init
:config
;;; General Options
;; Better scrolling
(setq scroll-step 1
@ -120,26 +138,7 @@
(prefer-coding-system 'utf-8)
(set-default-coding-systems 'utf-8)
(set-terminal-coding-system 'utf-8)
(set-keyboard-coding-system 'utf-8)
;;; Vertico
;; Add prompt to `completing-read-multiple'
(defun crm-indicator (args)
(cons (format "[CRM%s] %s"
(replace-regexp-in-string
"\\`\\[.*?]\\*\\|\\[.*?]\\*\\'" ""
crm-separator)
(car args))
(cdr args)))
(advice-add #'completing-read-multiple :filter-args #'crm-indicator)
;; Recursive minibuffers
(setq enable-recursive-minibuffers t)
;; Disable prompt in minibuffer
(setq minibuffer-prompt-properties
'(read-only t cursor-intangible t face minibuffer-prompt))
(add-hook 'minibuffer-setup-hook #'cursor-intangible-mode))
(set-keyboard-coding-system 'utf-8))
(use-package compile
:elpaca nil
@ -154,8 +153,8 @@
:elpaca nil
:hook ((conf-mode
markdown-mode
lsp-mode) . display-fill-column-indicator-mode)
:config (setq-default fill-column 80))
prog-mode) . display-fill-column-indicator-mode)
:config (setq-default fill-column 100))
(use-package display-line-numbers
:elpaca nil
@ -169,16 +168,16 @@
(use-package files
:elpaca nil
:config
(let ((auto_save_directory (concat xdg_cache_home "auto-save-list/")))
(setq backup-directory-alist `((".*" . ,auto_save_directory))
auto-save-file-name-transforms `((".*" ,auto_save_directory t))))
(setq backup-by-copying t
confirm-kill-processes nil
delete-old-versions t
kept-new-versions 5
kept-old-versions 3
require-final-newline t
version-control t)
(let ((auto_save_directory (concat xdg_cache_home "auto-save-list/")))
(setq backup-directory-alist `((".*" . ,auto_save_directory))
auto-save-file-name-transforms `((".*" ,auto_save_directory t)))))
version-control t))
(use-package flyspell
:elpaca nil
@ -227,8 +226,8 @@
(use-package simple
:elpaca nil
:config
(setq-default indent-tabs-mode nil
column-number-mode t))
(setq-default indent-tabs-mode nil)
(column-number-mode))
(use-package whitespace
:elpaca nil
@ -238,11 +237,12 @@
text-mode) . whitespace-mode)
:config
(add-hook 'before-save-hook #'whitespace-cleanup)
(setq whitespace-line-column 100
whitespace-style '(big-indent
face
lines-tail
(setq whitespace-line-column nil
whitespace-style '(face
lines-char
missing-newline-at-eof
space-after-tab
space-before-tab
tabs
trailing)))
@ -254,21 +254,31 @@
;; Theme
(use-package everforest
:elpaca (everforest
:host sourcehut
:repo "theorytoe/everforest-theme")
:elpaca (everforest :host sourcehut :repo "theorytoe/everforest-theme")
:config
(setq custom-safe-themes t)
(load-theme 'everforest-hard-dark t)
(set-face-attribute 'cursor nil :background "#7fbbb3")
(let ((line (face-attribute 'mode-line :foreground))
(inactive (face-attribute 'mode-line-inactive :background)))
(set-face-attribute 'mode-line nil :overline line)
(set-face-attribute 'mode-line-inactive nil :overline line)
(set-face-attribute 'mode-line-inactive nil :underline line)
(let ((moody_line (face-attribute 'mode-line :foreground))
(moody_inactive (face-attribute 'mode-line-inactive :background)))
(set-face-attribute 'mode-line nil :overline moody_line)
(set-face-attribute 'mode-line-inactive nil :overline moody_line)
(set-face-attribute 'mode-line-inactive nil :underline moody_line)
(set-face-attribute 'mode-line nil :box nil)
(set-face-attribute 'mode-line-inactive nil :box nil)
(set-face-attribute 'mode-line-inactive nil :background inactive)))
(set-face-attribute 'mode-line-inactive nil :background moody_inactive))
:custom-face
(cursor ((t (:background "#7fbbb3"))))
(whitespace-big-indent ((t (:background "#9da9a0"))))
(whitespace-empty ((t (:background "#9da9a0"))))
(whitespace-hspace ((t (:background "#9da9a0"))))
(whitespace-indentation ((t (:background "#9da9a0"))))
(whitespace-line ((t (:background "#e67e80"))))
(whitespace-newline ((t (:background "#e67e80"))))
(whitespace-space ((t (:background "#9da9a0"))))
(whitespace-space-after-tab ((t (:background "#9da9a0"))))
(whitespace-space-before-tab ((t (:background "#9da9a0"))))
(whitespace-tab ((t (:background "#9da9a0"))))
(whitespace-trailing ((t (:background "#e67e80")))))
(elpaca-wait)
@ -450,8 +460,7 @@
:config (push #'kind-icon-margin-formatter corfu-margin-formatters)
:custom
(kind-icon-default-face 'corfu-default)
(kind-icon-blend-background nil)
(svg-lib-icons-dir (concat xdg_cache_home "svg-lib/")))
(kind-icon-blend-background nil))
;; Git
(use-package magit
@ -554,7 +563,7 @@
;; Syntax checking
(use-package flycheck
:hook (lsp-mode . flycheck-mode)
:custom (flycheck-python-flake8-executable 'flake8))
:custom (flycheck-python-flake8-executable "flake8"))
(use-package consult-flycheck
:after (consult flycheck))
@ -577,13 +586,13 @@
:hook (lsp-mode . lsp-ui-mode)
:custom
(lsp-ui-doc-position 'bottom-and-right)
(lsp-ui-flycheck-enable t)
(lsp-ui-flycheck-list-position 'right)
(lsp-ui-peek-enable t)
(lsp-ui-sideline-delay 0.6)
(lsp-ui-sideline-show-code-actions t)
(lsp-ui-sideline-show-hover t)
(lsp-ui-sideline-update-mode 'line)
(lsp-ui-flycheck-enable t)
(lsp-ui-flycheck-list-position 'right)
(lsp-ui-peek-enable t))
(lsp-ui-sideline-update-mode 'line))
(use-package consult-lsp
:after (consult lsp-mode)
@ -608,14 +617,14 @@
:config
(eval-when-compile
(require 'cl-lib))
(require 'dap-python)
(require 'dap-lldb)
(require 'dap-gdb-lldb)
(require 'dap-lldb)
(require 'dap-python)
:custom
(dap-breakpoints-file (concat xdg_cache_home "dap-breakpoints"))
(dap-utils-extension-path (concat user-emacs-directory "dap-extensions/"))
(dap-auto-configure-features '(sessions locals tooltip))
(dap-breakpoints-file (concat xdg_cache_home "dap-breakpoints"))
(dap-lldb-debug-program 'lldb-vscode)
(dap-utils-extension-path (concat user-emacs-directory "dap-extensions/"))
(dap-python-debugger 'debugpy)
;; Templates
(dap-register-debug-template
@ -648,6 +657,7 @@
(use-package lsp-pyright
:after (python)
:hook (python-ts-mode . (lambda ()
(setq-local fill-column 80)
(require 'lsp-pyright)
(lsp)))) ; or `lsp-deferred'
@ -672,23 +682,22 @@
;; Web templates
(use-package web-mode
:custom
(web-mode-attribute-indent-offset 2)
(web-mode-code-indent-offset 2)
(web-mode-enable-front-matter-block t)
(web-mode-markup-indent-offset 2)
(web-mode-attribute-indent-offset 2)
:mode
((("\\.astro\\'" "\\.html?\\'") . web-mode)))
;; Zig
(use-package zig-mode
:hook
(zig-mode . (lambda ()
(setq-local fill-column 100)
(setq-local tab-width 4))))
:commands (zig-mode)
:config (setq-local fill-column 100))
;;; File format/markup support
(use-package markdown-mode
:commands (markdown-mode))
:commands (markdown-mode)
:config (setq-local fill-column 120))
(use-package yaml-pro
:hook (yaml-ts-mode . yaml-pro-ts-mode))

View file

@ -1,25 +1,11 @@
return {
{
"folke/which-key.nvim",
config = true,
},
{
"windwp/nvim-autopairs",
config = true,
lazy = true,
event = { "BufReadPost", "BufNewFile" }
},
{
"nvim-treesitter/nvim-treesitter",
lazy = true,
build = ":TSUpdate",
event = { "BufReadPost", "BufNewFile" },
},
-- statusline
{
"nvim-lualine/lualine.nvim",
config = true,
dependencies = { 'nvim-tree/nvim-web-devicons' }
dependencies = { "nvim-tree/nvim-web-devicons" }
},
-- Theme
{
"neanias/everforest-nvim",
version = false,
@ -33,5 +19,115 @@ return {
})
end,
},
-- Which-key keybind hints
{
"folke/which-key.nvim",
config = true,
},
-- Auto-pair brackets, parenthesis, etm.
{
"windwp/nvim-autopairs",
config = true,
lazy = true,
event = { "BufReadPost", "BufNewFile" }
},
-- Tree-sitter
{
"nvim-treesitter/nvim-treesitter",
lazy = true,
build = ":TSUpdate",
event = { "BufReadPost", "BufNewFile" },
opts = {
indent = { enable = true },
highlight = { enable = true },
auto_install = { enable = true },
ensure_installed = {
"bash",
"c",
"cpp",
"lua",
"luadoc",
"markdown",
"python",
"vim",
"vimdoc",
"yaml",
"zig",
},
},
},
-- Auto-completion
{
"hrsh7th/nvim-cmp",
event = "InsertEnter",
dependencies = {
{"L3MON4D3/LuaSnip"},
},
config = function()
-- Here is where you configure the autocompletion settings.
-- The arguments for .extend() have the same shape as `manage_nvim_cmp`:
-- https://github.com/VonHeikemen/lsp-zero.nvim/blob/v2.x/doc/md/api-reference.md#manage_nvim_cmp
require("lsp-zero.cmp").extend()
-- And you can configure cmp even more, if you want to.
local cmp = require("cmp")
local cmp_action = require("lsp-zero.cmp").action()
cmp.setup({
mapping = {
["<C-Space>"] = cmp.mapping.complete(),
["<C-f>"] = cmp_action.luasnip_jump_forward(),
["<C-b>"] = cmp_action.luasnip_jump_backward(),
}
})
end
},
-- LSP
{
"VonHeikemen/lsp-zero.nvim",
branch = "v2.x",
lazy = true,
config = function()
-- This is where you modify the settings for lsp-zero
-- Note: autocompletion settings will not take effect
require("lsp-zero.settings").preset({})
end
},
{
"neovim/nvim-lspconfig",
cmd = "LspInfo",
event = {"BufReadPre", "BufNewFile"},
dependencies = {
{"hrsh7th/cmp-nvim-lsp"},
{"williamboman/mason-lspconfig.nvim"},
{
"williamboman/mason.nvim",
lazy = true,
build = function()
pcall(vim.api.nvim_command, "MasonUpdate")
end,
},
},
config = function()
-- This is where all the LSP shenanigans will live
local lsp = require("lsp-zero")
lsp.on_attach(function(client, bufnr)
-- see :help lsp-zero-keybindings
-- to learn the available actions
lsp.default_keymaps({buffer = bufnr})
end)
lsp.setup_servers({'pyright', 'zls'})
-- (Optional) Configure lua language server for neovim
-- require("lspconfig").lua_ls.setup(lsp.nvim_lua_ls())
lsp.setup()
end
}
}