Compare commits

...

14 Commits

Author SHA1 Message Date
hedy 1711317eea
nvim: AND YET there's still even more undocumented updates 2023-10-28 16:00:44 +08:00
hedy 34188c825a
nvim: Fix typo 2023-10-28 15:56:30 +08:00
hedy 9229e2e3c0
nvim: EVEN MORE undocumented updates 2023-10-28 15:55:28 +08:00
hedy d045c3f9a2
kitty: Don't show tab index 2023-10-28 15:54:49 +08:00
hedy d008dccede
kitty: Set key binds 2023-10-28 11:40:09 +08:00
hedy 23f71b0544
nvim: More undocumented updates 2023-10-28 09:24:51 +08:00
hedy cc178b7ac9
nvim: Add nvim-lua-gf plugin 2023-10-26 22:19:01 +08:00
hedy ed0689eee2
Emacs: Committing somewhat older changes 2023-10-26 22:13:55 +08:00
hedy 7a6ad04f90
fish(alias cat): Don't use bat in place of cat 2023-10-26 22:13:12 +08:00
hedy ea99a75351
nvim: Major update
A bunch of them...

That I don't have time to list in detail right now.
2023-10-26 21:53:36 +08:00
hedy 3a39a8f2b6
nvim, aerc: Update templates and use threading respectively 2023-10-26 21:52:40 +08:00
hedy cf1ee79575
nvim: Add comment about setting leader to space
Was already setting leader to space in nvim due to muscle memory from
doom emacs months ago, but I kept the `maplocalleader` setting. When I
found out about t/T/f/F/; commands I decided to drop them entirely and
leave a note, as with adjusting it in vim.
2023-10-10 19:15:19 +08:00
hedy e8e7a1d1b3
vim: Switch theme and use space as leader
So... yeah, the semicolon, whilst being easily reachable, is used in vim
to repeat last f/F/t/T move.
2023-10-10 19:13:57 +08:00
hedy c3afdf8e20
nvim: Add new-file templates
Added new $VIMHOME env var for the autocmd cmd.
2023-10-10 19:12:21 +08:00
20 changed files with 1462 additions and 258 deletions

View File

@ -260,7 +260,7 @@ styleset-name=dracula
# (IMAP server or notmuch), threads will be built by the client.
#
# Default: false
#threading-enabled=false
threading-enabled=false
# Force client-side thread building
#

View File

@ -18,6 +18,9 @@ Helper variables adopted from Doom Emacs I'm not sure if I'll ever use.
#+END_SRC
* Theme
:PROPERTIES:
:ID: theme-test
:END:
I sometimes switch between these (sub-headings). To switch, set =:tangle yes/no=.
@ -385,6 +388,7 @@ This solution for binding leader prefixes is found on evil-guide: https://github
(define-key ./leader-map "q" #'evil-quit)
(define-key ./leader-map "w" #'save-buffer)
(define-key ./leader-map "x" #'evil-save-modified-and-close)
(define-key ./leader-map "1" #'delete-other-windows)
(defvar ./leader-buffer-map (make-sparse-keymap)
"Keymap for leader shortcuts for buffers")
@ -417,8 +421,13 @@ Other plugins (or apps) with not that much configuration.
#+BEGIN_SRC elisp
(use-package elpher)
;; Seems to be having problems with eww for elpaca
;; eww is part of emacs now?!!
;;(use-package eww)
(use-package visual-fill-column
:init
(setq-default visual-fill-column-center-text t))
(use-package imenu-list
:config
(setq imenu-list-auto-resize t)
@ -871,6 +880,7 @@ If corfu-candidate-overlay's overlay is active, calls
`corfu-candidate-overlay--get-overlay-property', otherwise
`evil-toggle-fold'. See my packages.org for this section for why I
didn't use `org-cycle' here."
(interactive)
(if (overlayp corfu-candidate-overlay--overlay)
(progn
;; This check is taken exactly from the implementation of
@ -880,9 +890,23 @@ didn't use `org-cycle' here."
(if (and (overlayp corfu-candidate-overlay--overlay)
(not (string= (corfu-candidate-overlay--get-overlay-property 'after-string) "")))
(corfu-candidate-overlay-complete-at-point)
(evil-toggle-fold)))
(evil-toggle-fold) ;; This shows a helpful message too, if cannot fold at point!
))
(if (string-match-p
"^\*+ "
(buffer-substring-no-properties
(line-beginning-position)
(line-end-position)))
(evil-toggle-fold)
(indent)
)
))
(if (string-match-p
"^\*+ "
(buffer-substring-no-properties
(line-beginning-position)
(line-end-position)))
(evil-toggle-fold)
(indent-for-tab-command)
)))
#+END_SRC
@ -911,6 +935,33 @@ didn't use `org-cycle' here."
'user
<<org-font-attributes>>
)
(org-babel-do-load-languages
'org-babel-load-languages
'((emacs-lisp . t)
(python . t)
(lua . t)
(js . t)))
(defun org-babel-execute:nim (body params)
"Execute a block of Nim code with org-babel."
(let ((in-file (org-babel-temp-file "n" ".nim"))
(verbosity (or (cdr (assq :verbosity params)) 0)))
(with-temp-file in-file
(insert body))
(org-babel-eval
(format "nim compile --verbosity=%d --run %s" verbosity
(org-babel-process-file-name in-file))
"")))
(defun org-babel-execute:moonscript (body params)
"Execute a block of MoonScript code with org-babel."
(let ((in-file (org-babel-temp-file "m" ".moon")))
(with-temp-file in-file
(insert body))
(org-babel-eval
(format "moon %s" (org-babel-process-file-name in-file)) "")))
:hook
(org-mode . (lambda () (visual-line-mode 1)
(variable-pitch-mode)
@ -990,6 +1041,17 @@ Org superstar is like org-bullets but with additional customizations as well as
* Eglot & tree sitter
** Some languages
#+BEGIN_SRC elisp
(use-package lua-mode)
(use-package moonscript)
(use-package nim-mode)
#+END_SRC
** Eglot
Eglot is now included in Emacs from version 29.
#+BEGIN_SRC elisp
@ -997,7 +1059,7 @@ Eglot is now included in Emacs from version 29.
:elpaca nil
:defer t
:hook
((python-ts-mode go-ts-mode) . eglot-ensure)
((python-ts-mode go-ts-mode lua-mode) . eglot-ensure)
)
#+END_SRC

View File

@ -1,7 +1,9 @@
function cat --description 'alias cat to bat, ccat, or cat'
if command -sq bat
bat --theme Dracula $argv;
else if command -sq ccat
function cat --description 'alias cat to ccat'
# if command -sq bat
# bat --theme Dracula $argv;
# else if command -sq ccat
# ccat $argv;
if command -sq ccat
ccat $argv;
else
set catpath (which cat)

View File

@ -17,12 +17,16 @@ tab_bar_margin_width 0.0
# Feels as if the tag bar is floating in the *air of squishy satisfying terminal backdrops*
tab_bar_margin_height 10.0 10.0
# fg is a lighter adjustment of dracula "comment" color - more readable
tab_title_template "{fmt.fg._9cb6d9}{fmt.bg.default}{bell_symbol}{activity_symbol} {index}:{f'{title[:9]}…{title[-6:]}' if title.rindex(title[-1]) + 1 > 25 else title} "
tab_title_template "{fmt.fg._9cb6d9}{fmt.bg.default}{bell_symbol}{activity_symbol} {f'{title[:9]}…{title[-6:]}' if title.rindex(title[-1]) + 1 > 25 else title} "
# fg is dracula white color
active_tab_title_template "{fmt.fg._f8f8f2}{fmt.bg.default}{bell_symbol}{activity_symbol} {index}:{f'{title[:9]}…{title[-6:]}' if title.rindex(title[-1]) + 1 > 25 else title} "
active_tab_title_template "{fmt.fg._f8f8f2}{fmt.bg.default}{bell_symbol}{activity_symbol} {f'{title[:9]}…{title[-6:]}' if title.rindex(title[-1]) + 1 > 25 else title} "
active_tab_font_style bold
inactive_tab_font_style normal
# I rarely need this to navigate tabs from within kitty so I'd rather
# make use of these mappings in the specific TUIs instead.
map ctrl+tab no_op
map ctrl+shift+tab no_op
# Source this last so it can override any settings above
include local.conf

View File

@ -1,7 +1,10 @@
vim.g.mapleader = [[ ]]
vim.g.maplocalleader = [[;]]
-- The cool thing about ';' is that it is at the same
-- position as ':', the char used for commands.
-- vim.g.maplocalleader = [[;]]
-- See my vim config comment on me being stupid enough to not
-- have known f, t, F, T and ';' 😔
-- Set envvar VIMHOME to, eg, ~/.config/nvim (has no trailing slash)
vim.env.VIMHOME = vim.fn.expand('<sfile>:p:h')
require('loadlazy')

View File

@ -0,0 +1,18 @@
local au = function(...) vim.api.nvim_create_autocmd(...) end
-- Return to last edit position when opening files
au("BufReadPost", {
pattern = "*",
command = [[if line("'\"") > 1 && line("'\"") <= line("$") | exe "normal! g'\"" | endif]]
})
-- File templates
-- VIMHOME is set in init.lua.
au("BufNewFile", {
pattern = "*.*",
command = "silent! execute '0r '.$VIMHOME.'/templates/skeleton.'.expand(\"<afile>:e\")"
})
au("BufEnter", {
pattern = "*",
command = "set cursorline! | set cursorline!"
})

View File

@ -1,9 +1,22 @@
local o = vim.opt
-- can be toggled with <leader>rn (see mappings.lua).
-- showing '0' in current row in vim is the most useless thing ever in all
-- software known to humanity.
o.number = true
o.relativenumber = true
o.mouse = "a"
o.cursorline = true -- highlight current cursor line (this is SO GOOD)
-- o.cursorline = true
-- Cursor line is rather distracting when trying to focus on the code.
-- Especially so when typing in comments -- the background of the cursor line
-- behind the already low-constrast comment fg color makes it hard to read (and
-- write with)
--
-- If I'm working on something with long lines and I need a visual indicator of
-- alignment I can do visual line then <Esc> to "blink" the cursor line, or
-- enable this locally.
o.showcmd = true -- show incomplete commands
o.hlsearch = true -- highlight search
o.wildmenu = true -- command line's tab complete in a menu
@ -11,10 +24,10 @@ o.errorbells = false-- no beeps please
o.visualbell = true -- flash screen instead
o.title = true -- set window title to file name
o.incsearch = true -- incrementally find next match while typing search
o.scrolloff = 6 -- screen lines to keep above and below cursor
o.sidescrolloff = 8 -- screen columns to keep on left and right of cursor
o.confirm = true
o.showmatch = true
o.scrolloff = 6 -- screen lines to keep above and below cursor
o.sidescrolloff = 8 -- screen columns to keep on left and right of cursor
o.confirm = true
o.showmatch = true
o.encoding = "utf-8"
o.mat = 2
@ -22,30 +35,35 @@ o.inccommand = "nosplit" -- neovim only
o.autoindent = true
o.fileformat = "unix"
o.expandtab = true-- AIUI, tab -> spaces
o.softtabstop = 4 -- indent by 2 spaces with tab
o.tabstop = 4 -- show existing tabs with 4 spaces width
o.shiftwidth=4 -- Put or remove 4 spaces with using < and >
o.smarttab = true -- Delete spaces at tabstop width
o.copyindent = true -- Copy indentation from previous line
o.hidden = true -- Let's you switch to another file while current is unsaved.
o.cmdheight = 2
o.splitbelow = true
-- o.exrc = true -- Could be potentially dangerous
vim.o.autochdir = true
o.expandtab = true -- AIUI, tab -> spaces
o.softtabstop = 4 -- indent by 4 spaces with tab
o.tabstop = 4 -- show existing tabs with 4 spaces width
o.shiftwidth = 4 -- Put or remove 4 spaces with using < and >
o.smarttab = true -- Delete spaces at tabstop width
o.copyindent = true -- Copy indentation from previous line
o.hidden = true -- Allows switching to another file while current is unsaved.
o.cmdheight = 1
-- Show LSP W/E hints on another column next to the line numbers
o.signcolumn = "yes" -- Set to "number" will merge the LSP W/E hints with the number col
-- Bunch of shit really, spent *hours* trying to get tmux + nvim true colors to work
-- Dracula theme without termguicolors looks like poo; see my vimrc.
o.termguicolors = true
o.whichwrap:append '<,>,h,l'
-- fold settings
o.foldenable = true
o.foldlevelstart = 10
o.foldnestmax = 10
o.foldmethod = "manual"
o.foldcolumn = "2"
-- o.foldcolumn = "2"
o.foldmethod = "expr"
o.foldexpr = "nvim_treesitter#foldexpr()"
-- Set the swp, backup and undo settings
o.swapfile = false
o.backup = false
o.undodir = vim.fn.expand("~") .. "/.local/share/nvim/undodir/"
@ -54,9 +72,6 @@ o.undofile = true
-- Ignore compiled files
o.wildignore = { "*.o", "*~", "*.pyc", "*/.git/*", "*/.hg/*", "*/.svn/*", "*/.DS_Store" }
-- Return to last edit position when opening files
vim.api.nvim_create_autocmd("BufReadPost", {
pattern = "*", command = [[if line("'\"") > 1 && line("'\"") <= line("$") | exe "normal! g'\"" | endif]]
})
vim.cmd [[ match ErrorMsg '\s\+$' ]]
-- Not too noisy visually, but visible enough as a reminder.
-- Underlines trailing spaces.
vim.cmd [[ match Underlined '\s\+$' ]]

View File

@ -15,8 +15,42 @@ vim.cmd [[
filetype indent on
]]
require('lazy').setup('plugin_spec', {
require("lazy").setup("plugin_spec", {
install = {
colorscheme = { "dracula" },
colorscheme = { "tundra" },
},
change_detection = {
-- I still have to quit and reopen nvim after a new plugin install anyway,
-- so this feature is useless and annoying.
enabled = false,
notify = false,
},
ui = {
-- a number <1 is a percentage., >1 is a fixed size
size = { width = 1, height = 1 },
icons = {
cmd = "",
config = "",
event = "",
ft = "",
init = "",
import = "",
keys = "",
lazy = "󰒲 ",
loaded = "",
not_loaded = "",
plugin = "",
runtime = "",
require = "󰢱 ",
source = "",
start = "",
task = "",
list = {
"",
"",
"",
"",
},
},
},
})

View File

@ -1,26 +1,30 @@
-- Note that plugins config may set more mappings.
local silent = { silent = true }
local function d(s) return { desc = s } end
local function map(...) vim.keymap.set(...) end
-- ==============-=
-- Leader mappings
-- ===============
map("n", "<Leader>rn", '<cmd>set relativenumber!<cr>')
-- Open all folds in current buffer (Reduce)
map("n", "<Leader>z", "zR")
local function au(...) vim.api.nvim_create_autocmd(...) end
local function mapbuf(a, b, c) vim.api.nvim_buf_set_keymap(0, a, b, c, { noremap=true }) end
---------------------
-- Leader mappings --
---------------------
map("n", "<Leader>rn", "<cmd>set relativenumber!<cr>", d "toggle rel num")
map("n", "<Leader>z", "zR", d "zA (toggle all folds)")
-- The 3 mappings that I use most often out of all vim mappings :D
map("n", "<Leader>w", "<cmd>w<CR>")
map("n", "<Leader>x", "<cmd>xa<CR>")
map("n", "<Leader>q", "<cmd>qa<CR>")
-- Clear search
map("n", "<Leader>nh", "<cmd>noh<CR>")
-- Paste (rarely used because I commonly work in ssh'ed environments)
map("n", "<Leader>pa", "+p")
-- Show what registers contain
map("n", "<Leader>rg", "<cmd>registers<CR>")
map("n", "<Leader>w", "<cmd>w<CR>", d "write")
map("n", "<Leader>x", "<cmd>xa<CR>", d "x all")
map("n", "<Leader>q", "<cmd>qa<CR>", d "quit all")
map("n", "<Leader>nh", "<cmd>noh<CR>", d ":noh")
map("n", "<Leader>p", "\"+p", d "System clipboard paste")
-- XXX: Decide whether to deprecate this in favor of :Telescope registers
map("n", "<Leader>rg", "<cmd>registers<CR>", d "Show registers, also <leader>fR")
map("n", "<leader>u", "gul")
map("n", "<leader>U", "gUl")
-- =============================
-- Normal and Universal Mappings
-- =============================
-----------------------------------
-- Normal and Universal Mappings --
-----------------------------------
-- Close a buffer, useful when doing PlugInstall and then closing that
-- Or is it close a window? frame? DAMN all this emacs terminology got me so
-- confused
@ -28,20 +32,21 @@ map("n", "Q", "<cmd>q<CR>")
-- NOTE: These mappings Just Work in wsl so no need the extra binding like
-- in vimrc, this is why you use neovim instead of vim ;)
map("", "<M-j>", "<cmd>m+1<CR>==")
map("", "<M-k>", "<cmd>m-2<CR>==")
map("", "<M-J>", "<cmd>t.<CR>==")
map("", "<M-K>", "<cmd>t.-1<CR>==")
map("n", "<M-j>", "<cmd>m+1<CR>==", d "Move line down")
map("n", "<M-k>", "<cmd>m-2<CR>==", d "Move line up")
map("n", "<M-J>", "<cmd>t.<CR>==", d "Copy line down")
map("n", "<M-K>", "<cmd>t.-1<CR>==", d "Copy line up")
-- ===============
-- VIsual mappings
-- ===============
---------------------
-- Visual mappings --
---------------------
-- dot command in visual mode
map("v", ".", "<cmd>normal.<CR>")
-- Move visual selection
map("v", "J", "<cmd>m '>+1<CR>gv=gv")
map("v", "K", "<cmd>m '<-2<CR>gv=gv")
-- FIXME: Not working!
map("v", "J", "<cmd>m+1<CR>gv=gv")
map("v", "K", "<cmd>m-2<CR>gv=gv")
-- Visual mode pressing * or # searches for the current selection
map("v", "*", "<cmd><C-u>call VisualSelection('', '')<CR>/<C-R>=@/<CR><CR>", silent)
@ -52,67 +57,70 @@ map("v", "#", "<cmd><C-u>call VisualSelection('', '')<CR>?<C-R>=@/<CR><CR>", sil
map("v", "<", "<gv")
map("v", ">", ">gv")
-- Yet another "modern" IDE-like behavior
map("v", "<BS>", "x")
-- ==========================
-- Window/Buffer/Tab mappings
-- ==========================
--------------------------------
-- Window/Buffer/Tab mappings --
--------------------------------
-- Better way to move between windows
map("", "<C-j>", "<C-W>j")
map("", "<C-k>", "<C-W>k")
map("", "<C-h>", "<C-W>h")
map("", "<C-l>", "<C-W>l")
map("", "<C-j>", "<C-W>j", d "bottom window")
map("", "<C-k>", "<C-W>k", d "top window")
map("", "<C-h>", "<C-W>h", d "right window")
map("", "<C-l>", "<C-W>l", d "left window")
-- Managing buffers
-- map("n", "<leader>bd", "<cmd>bd<cr>") -- I now use moll/vim-bbye, see plugin_spec.lua
map("n", "<leader>bn", "<cmd>bnext<cr>")
map("n", "<leader>bp", "<cmd>bprev<cr>")
map("n", "<leader>bn", "<cmd>bnext<cr>", d "bnext")
map("n", "<leader>bp", "<cmd>bprev<cr>", d "bprev")
-- Useful mappings for managing tabs
-- Tab create
map("n", "<leader>tc", "<cmd>tabnew<cr>")
map("n", "<leader>to", "<cmd>tabonly<cr>")
map("n", "<leader>tc", "<cmd>tabnew<cr>", d "tabnew")
map("n", "<leader>to", "<cmd>tabonly<cr>", d "tabonly")
-- Tab delete
map("n", "<leader>td", "<cmd>tabclose<cr>")
map("n", "<leader>td", "<cmd>tabclose<cr>", d "tabclose")
-- I rarely have >3 tabs, let alone organize their placements <cmd>D but it's here
-- because why not
map("n", "<leader>tm", "<cmd>tabmove<cr>")
map("n", "<leader>tm", "<cmd>tabmove<cr>", d "tabmove")
-- Switching tabs
map("n", "<leader>tn", "<cmd>tabnext<cr>")
map("n", "<leader>tp", "<cmd>tabprev<cr>")
map("n", "<leader>tn", "<cmd>tabnext<cr>", d "tabnext")
map("n", "<leader>tp", "<cmd>tabprev<cr>", d "tabprev")
if vim.fn.has("macunix") == 1 then
-- WTF?? (I checked using C-v in insert mode)
-- TODO: Fix in tmux
map("", "<C-@>", "<cmd>split term://fish<cr>i")
map("", "<C-@>", "<cmd>split term://fish<cr><cmd>resize -7<cr>i")
else
map("", "<C-`>", "<cmd>split term://fish<cr>i")
map("", "<C-`>", "<cmd>split term://fish<cr><cmd>resize -7<cr>i",
d "Open terminal below" )
end
map("n", "<leader>t", "<cmd>echom 'Deprecated. Please use C-` instead'<cr>")
map("t", "<Esc>", "<C-\\><C-n>")
map("t", "<Esc>", "<C-\\><C-n>", d "Esc in terminal mode")
-- SHUSH
map("n", "<Leader>lsh", "<cmd>LspStop")
map("n", "<Leader>lst", "<cmd>LspStart")
--------------------------------------
-- Insert/Command Editting Mappings --
--------------------------------------
-- Emacs FTW :)
map({"i", "c"}, "<A-bs>", "<C-w>")
map({"i", "c"}, "<A-h>", "<C-w>")
map({"i", "c"}, "<C-b>", "<left>")
map({"i", "c"}, "<C-f>", "<right>")
map({"i", "c"}, "<A-b>", "<S-left>")
map({"i", "c"}, "<A-f>", "<S-right>")
map("i", "<C-a>", "<C-o>0")
-- map("i", "<C-e>", "<C-o>$")
map("c", "<C-a>", "<C-b>") -- SMH
-- Command mode already supports <C-e>
map("i", "<M-Tab>", "<C-x><C-o>")
vim.api.nvim_create_autocmd("BufReadPost", {
pattern = "*",
callback = function()
vim.b.lsp_lines_enabled = false
end
--------------------------------
-- Filetype specific mappings --
--------------------------------
au("FileType", {
pattern = {"help"},
callback = function () mapbuf("n", "q", "<cmd>q<cr>") end
})
map("n", "<Leader>lx", function()
require("lsp_lines").toggle()
-- Disable virtual_text since it's redundant due to lsp_lines.
if vim.b.lsp_lines_enabled then
-- IT was enabled, now it's disabled.
vim.diagnostic.config({ virtual_text = true })
vim.b.lsp_lines_enabled = false
else
vim.diagnostic.config({ virtual_text = false })
vim.b.lsp_lines_enabled = true
end
end
)

View File

@ -1,74 +1,286 @@
-- Used by Lazy.nvim in loadlazy.lua
--
-- Note on styling:
-- { "plugin src", <-- ugly, but useful
-- option = value,
-- option = value,
-- }
-- The "plugin src" is joined on the same line as opening brace so
-- treesitter-context can show the plugin name. Useful since some of the plugin
-- specs could be long.
return {
{
"dracula/vim", name = "dracula", lazy = false, priority = 10000,
config = function()
-- THE most important nvim configuration
vim.cmd("colorscheme dracula")
end,
{ "dracula/vim",
name = "dracula", lazy = false, priority = 10000,
config = function() vim.cmd("colorscheme dracula") end,
enabled = false, -- LOL I've switched to tundra semi-temporarily
},
{
"nvim-tree/nvim-tree.lua",
opts = {
view = { width = 20, },
-- renderer = { group_empty = true, },
-- filters = { dotfiles = true, },
},
-- The thing about using dracula theme in nvim here is the annoyance of
-- having to use lua APIs to interact with something that was designed for
-- vimscript. With "modern" nvim plugins where the themes are written in 100%
-- lua, configuring everything else (such as statusline colors) reusing
-- values defined in these themes provide a much smoother, cleaner
-- configuration.
--
-- This is by no means a /political/ (ahem) statement suggesting my
-- abandoning of the holy dracula theme. I just, well, decided to try
-- something new since I sort of realized there is no "perfect" or "best"
-- theme.
--
-- After hours of blood, pain, and tears of trying to tweak dracula colors to
-- be easier on the eyes and have greater contrast, I took one look at the
-- carousel of themes from NvChad and fell in love with tundra...
{ "sam4llis/nvim-tundra",
config = function () require("plugins/tundra") end,
},
"tpope/vim-fugitive",
"jreybert/vimagit", -- emacs' magit ✨
"tpope/vim-surround", -- quoting and parenthesizing manipulation
"tpope/vim-commentary", -- I'd rather not clog <Leader> mappings with nerd commentor
"airblade/vim-gitgutter", -- Show git diff overview stuff in the left column
{ -- Quickly jump to a symbol in buffer (one of my most used). Requires exuberant ctags
"majutsushi/tagbar",
config = function()
vim.keymap.set("n", "<leader>tt", "<cmd>TagbarToggle<CR>")
vim.g.tagbar_width = 20
-- Use 'gf' with dot.separated.modules in lua.
-- Put the cursor at the argument in "require" and press "gf" to see the effect.
"sam4llis/nvim-lua-gf",
{ "nvim-tree/nvim-tree.lua",
cmd = {"NvimTreeOpen", "NvimTreeToggle", "NvimTreeFindFile", "NvimTreeFocus", "NvimTreeFindFileToggle"},
keys = { "<leader>e" },
config = function ()
vim.keymap.set("n", "<leader>e", "<cmd>NvimTreeToggle<cr>",
{ desc = "NvimTreeToggle" })
require("nvim-tree").setup {
view = { width = 20, },
-- renderer = { group_empty = true, },
-- filters = { dotfiles = true, },
}
end,
},
"bling/vim-bufferline", -- I prefer this over taking over the tabline space thanks
-- "jreybert/vimagit", -- emacs' magit ✨
-- So anyways apparently almost every plugin that was popular in vim had to
-- be rewritten in lua.
{ "NeogitOrg/neogit",
cmd = "Neogit",
dependencies = {
"nvim-lua/plenary.nvim",
"nvim-telescope/telescope.nvim",
"sindrets/diffview.nvim", -- optional
-- "ibhagwan/fzf-lua", -- optional
},
opts = {
integrations = {
-- Use telescope for menu selection rather than vim.ui.select.
-- Allows multi-select and some things that vim.ui.select doesn't.
telescope = true,
-- The diffview integration enables the diff popup.
diffview = true,
},
}
},
-- "tpope/vim-surround", -- quoting and parenthesizing manipulation
-- "tpope/vim-commentary", -- I'd rather not clog <Leader> mappings with nerd commentor
-- Sorry tpope! It's more convenient to configure in lua than in vim...
-- * nvim-comment is lighter but doesn't, AFAIK, support block comments.
-- * mini.surround let's you add quotes easily (defined above)
{ "numToStr/Comment.nvim", opts = {} },
{ "lewis6991/gitsigns.nvim",
-- "Be the diff you wish see in the gutter" -- Doom Emacs
-- Also see comparison with vim-gitgutter:
-- https://github.com/lewis6991/gitsigns.nvim?tab=readme-ov-file#comparison-with-vim-gitgutter
enabled = vim.fn.has("nvim-0.8") == 1,
opts = {
-- NO WAY! ❤️
yadm = { enable = true },
},
},
{ "folke/trouble.nvim",
enabled = vim.fn.has("nvim-0.7.2") == 1,
cmd = "Trouble",
dependencies = { "nvim-tree/nvim-web-devicons" },
opts = {
signs = {
-- icons / text used for a diagnostic
error = "E:",
warning = "W:",
hint = "H:",
information = "I:",
other = "X:",
},
fold_open = "", -- icon used for open folds
fold_closed = "", -- icon used for closed folds
},
},
{ "simrat39/symbols-outline.nvim",
-- Switched to this from tagbar because it does not require exctags, and it
-- lists the items in order as defined in source code.
enabled = vim.fn.has("nvim-0.7") == 1,
cmd = "SymbolsOutline",
keys = { "<leader>tt" },
config = function()
vim.keymap.set("n", "<leader>tt", "<cmd>SymbolsOutline<CR>",
{ desc = "SymbolsOutline" })
require("symbols-outline").setup {
symbols = {
File = { icon = "", hl = "@text.uri" },
Module = { icon = "M", hl = "@namespace" },
Namespace = { icon = "N", hl = "@namespace" },
Package = { icon = "", hl = "@namespace" },
Class = { icon = "c", hl = "@type" },
Method = { icon = "m", hl = "@method" },
Property = { icon = "", hl = "@method" },
Field = { icon = "F", hl = "@field" },
Constructor = { icon = "", hl = "@constructor" },
Enum = { icon = "", hl = "@type" },
Interface = { icon = "I", hl = "@type" },
Function = { icon = "", hl = "@function" },
Variable = { icon = "α", hl = "@constant" },
Constant = { icon = "", hl = "@constant" },
String = { icon = "\"", hl = "@string" },
Number = { icon = "#", hl = "@number" },
Boolean = { icon = "", hl = "@boolean" },
Array = { icon = "A", hl = "@constant" },
Object = { icon = "⦿", hl = "@type" },
Key = { icon = "🔐", hl = "@type" },
Null = { icon = "NULL", hl = "@type" },
EnumMember = { icon = "", hl = "@field" },
Struct = { icon = "𝓢", hl = "@type" },
Event = { icon = "", hl = "@type" },
Operator = { icon = "+", hl = "@operator" },
TypeParameter = { icon = "𝙏", hl = "@parameter" },
Component = { icon = "C", hl = "@function" },
Fragment = { icon = "g", hl = "@constant" },
},
}
end,
},
-- "bling/vim-bufferline", -- I prefer this over taking over the tabline space thanks
-- Fair well vim-bufferline! You have served my vim and nvim experience well.
-- I've since decided to set cmdheight to 1 and put the buffers in my status
-- bar :')
-- See plugins/statusline.lua.
-- TODO: Check if this is still needed
"tpope/vim-endwise", -- Add those 'endif'/'fi'/'done'
{ "moll/vim-bbye", -- smart buffer closer
config = function()
vim.keymap.set("n", "<Leader>bd", "<cmd>Bdelete<cr>")
vim.keymap.set("n", "<Leader>bx", "<cmd>Bwipeout<cr>") -- like bd but removes from jumplist
end
config = function()
local function d(s) return { desc = s } end
local function map(...) vim.keymap.set(...) end
map("n", "<Leader>bd", "<cmd>Bdelete<cr>", d"Bdelete")
map("n", "<Leader>bx", "<cmd>Bwipeout<cr>", d"like bd but removes from jumplist")
end
},
{
"nvim-tree/nvim-web-devicons", lazy = true,
{ "nvim-tree/nvim-web-devicons", lazy = true,
enabled = vim.fn.has("nvim-0.7") == 1,
config = function() require('plugins/icons') end,
pin = true,
commit = 'cde67b5d5427daeecfd7c77cf02ded23a26980bb',
},
{ -- STATUS LINE
-- TODO: Switch to heir for more customizability
"nvim-lualine/lualine.nvim",
dependencies = { 'nvim-tree/nvim-web-devicons', opt = true },
config = function() require('plugins/statusline') end,
dependencies = { "nvim-tree/nvim-web-devicons" },
config = function() require("plugins/statusline") end,
},
{ -- Neat popout window to browse dirs and manipulate within the editor!
"echasnovski/mini.files",
{ "tiagovla/scope.nvim",
-- Tab-local buffer list.
-- Similar to beframe (by prot) from emacs!
config = true
},
{ 'nvim-telescope/telescope.nvim', tag = '0.1.4',
dependencies = { 'nvim-lua/plenary.nvim' },
enabled = vim.fn.has("nvim-0.9") == 1,
config = function() require('plugins/telescope') end,
},
{ "folke/todo-comments.nvim",
dependencies = { "nvim-lua/plenary.nvim" },
opts = {
highlight = {
multiline = false,
-- The 3 lines below tunes down the coloring of the highlights.
-- The color schemes and treesitter of nowdays are already way too
-- vibrant for my liking, and for someone who litters todo/fixme way
-- too much everywhere, adding *wide* *bg* highlighting to them is just
-- WAY TOO MUCH EYE CANDY AAAA
before = "",
keyword = "fg", -- "fg", "bg", "wide", "wide_bg", "wide_fg" or empty.
after = "", -- "fg" or "bg" or empty
pattern = [[.*<(KEYWORDS)\s*]], -- (vim regex)
comments_only = true, -- uses treesitter to match keywords in comments only
max_line_len = 200,
exclude = {}, -- filetypes
},
}
},
{ "echasnovski/mini.files",
-- Neat popout window to browse dirs and manipulate within the editor!
cmd = "MiniFiles",
dependencies = { "nvim-tree/nvim-web-devicons" },
config = function()
require('mini.files').setup()
vim.api.nvim_create_user_command('MiniFiles', function()
MiniFiles.open()
end, {desc = "Calls lua MiniFiles.open()" })
end, { desc = "Calls lua MiniFiles.open()" })
end,
},
{
"lukas-reineke/indent-blankline.nvim",
{ "echasnovski/mini.surround", version = '*',
opts = {
-- These require treesitter
-- show_current_context = true,
-- show_current_context_start = true,
-- Duration (in ms) of highlight when calling `MiniSurround.highlight()`
highlight_duration = 500,
-- Module mappings. Use `''` (empty string) to disable one.
mappings = {
add = 'sa', -- Add surrounding in Normal and Visual modes
delete = 'ds', -- Delete surrounding -- Using "ds" for muscle memory compat
find = 'sf', -- Find surrounding (to the right)
find_left = 'sF', -- Find surrounding (to the left)
highlight = 'sh', -- Highlight surrounding
replace = 'cs', -- Replace surrounding -- muscle memory compat
update_n_lines = 'sn', -- Update `n_lines`
suffix_last = 'l', -- Suffix to search with "prev" method
suffix_next = 'n', -- Suffix to search with "next" method
},
-- Number of lines within which surrounding is searched
n_lines = 20,
-- Whether to respect selection type:
-- - Place surroundings on separate lines in linewise mode.
-- - Place surroundings on each line in blockwise mode.
respect_selection_type = false,
-- How to search for surrounding (first inside current line, then inside
-- neighborhood). One of 'cover', 'cover_or_next', 'cover_or_prev',
-- 'cover_or_nearest', 'next', 'prev', 'nearest'. For more details,
-- see `:h MiniSurround.config`.
search_method = 'cover',
-- Whether to disable showing non-error feedback
silent = false,
},
},
{ "lukas-reineke/indent-blankline.nvim",
-- https://github.com/lukas-reineke/indent-blankline.nvim/wiki/Migrate-to-version-3
-- Not documented but it appears new version requires nvim nightly.
-- Upgraded to nvim 0.9.4 and the new version worked with showing context
-- without needing treesitter! 🎉
main = vim.fn.has("nvim-0.9") == 1 and "ibl",
-- Use the 2 lines below if the nvim version is not supported
version = vim.fn.has("nvim-0.9") == 0 and "2.20.8",
pin = vim.fn.has("nvim-0.9") == 0,
opts = {
exclude = {
filetypes = {
"help",
"NvimTree",
"Trouble",
"trouble",
"lazy",
"mason",
"notify",
"toggleterm",
"lazyterm",
},
},
},
},
{ "RRethy/vim-illuminate",
config = function ()
require("illuminate").configure{}
vim.cmd([[hi def IlluminatedWordText guibg=Gray]])
end,
enabled = false, -- Somehow wasn't working for me
},
--- File type, syntax, language helper plugins ---
{
url = "https://git.sr.ht/~torresjrjr/gemini.vim",
ft = "gemini",
},
{ url = "https://git.sr.ht/~torresjrjr/gemini.vim", ft = "gemini" },
{ "cespare/vim-toml", ft = "toml" },
{ "blankname/vim-fish", ft = "fish",
config = function ()
@ -79,9 +291,9 @@ return {
vim.opt_local.tabstop = 4
end,
},
{
url = "https://git.rawtext.club/slope-lang/slope-vim-syntax",
{ url = "https://git.rawtext.club/slope-lang/slope-vim-syntax",
ft = "slope",
enabled = false;
},
{ "mzlogin/vim-markdown-toc", ft = "markdown",
config = function ()
@ -107,46 +319,257 @@ return {
-- windwp/nvim-autopairs - extremely customizable, written in lua -
-- integrates wth hrsh7th/nvim-cmp
-- For nvim < 0.5, use: townk/vim-autoclose
"nvim-lua/plenary.nvim", -- Helper lua functions many plugins depend on
{
"mfussenegger/nvim-lint", enabled = vim.fn.has("nvim-0.6") == 1,
{ "mfussenegger/nvim-lint",
enabled = vim.fn.has("nvim-0.6") == 1,
config = function() require("plugins/linting") end,
},
{ "windwp/nvim-autopairs", commit = vim.fn.has("nvim-0.7") == 1 and "b7672cd",
{ "windwp/nvim-autopairs",
commit = vim.fn.has("nvim-0.7") == 1 and "b7672cd",
config = function() require("plugins/autopair") end,
},
-- Best IDE autocomplete setup ever
-- Please see ./lua/complete.lua
{ "neovim/nvim-lspconfig", config = function() require('plugins/lsp') end },
{ "hrsh7th/cmp-nvim-lsp", dependencies = "neovim/nvim-lspconfig" },
-- Completions of words in current buffer
{ "hrsh7th/cmp-buffer", dependencies = "hrsh7th/nvim-cmp" },
-- File paths
{ "hrsh7th/cmp-path", dependencies = "hrsh7th/nvim-cmp" },
-- Fire your way through the neovim cmd line
{ "hrsh7th/cmp-cmdline", dependencies = "hrsh7th/nvim-cmp" },
{ "hrsh7th/cmp-calc", dependencies = "hrsh7th/nvim-cmp" },
-- 😏 :smirk:
{ "hrsh7th/cmp-emoji", dependencies = "hrsh7th/nvim-cmp" },
{ "mtoohey31/cmp-fish", dependencies = "hrsh7th/nvim-cmp", ft="fish" },
{ "petertriho/cmp-git", dependencies = "hrsh7th/nvim-cmp" },
-- τ long live \tau
{ "kdheepak/cmp-latex-symbols", dependencies = "hrsh7th/nvim-cmp" },
{ "dcampos/nvim-snippy", enabled = vim.fn.has("nvim-0.7") == 1 },
{ "dcampos/cmp-snippy",
enabled = vim.fn.has("nvim-0.7") == 1,
dependencies = {"hrsh7th/nvim-cmp", "dcampos/nvim-snippy"},
-- INSANE level of customizability within an environment as confortable as
-- lua and with stability as solid as an obsidian.
{ "neovim/nvim-lspconfig",
config = function()
require('plugins/lsp')
end
},
{ "hrsh7th/nvim-cmp", config = function() require('plugins/complete') end },
"onsails/lspkind.nvim", -- Symbols in the completion
{
"https://git.sr.ht/~whynothugo/lsp_lines.nvim",
{ "ray-x/lsp_signature.nvim",
event = "VeryLazy",
config = function(_, opts) require'lsp_signature'.setup(opts) end,
opts = {
doc_lines = 10,
-- set to 0 if you DO NOT want any API comments be shown
-- This setting only take effect in insert mode, it does not affect signature help in normal
-- mode, 10 by default
max_height = 12,
max_width = 80,
noice = false,
wrap = true,
floating_window = false,
floating_window_above_cur_line = true,
floating_window_off_x = 1,
floating_window_off_y = 0, -- -2 move window up 2 lines; 2 move down 2 lines
-- can be either number or function, see examples
close_timeout = 4000,
fix_pos = false, -- don't auto-close the floating window all parameters finished
hint_enable = true, -- virtual hint
hint_prefix = ": ",
hint_scheme = "String",
hint_inline = function() return vim.fn.has('nvim-0.10') == 1 end,
hi_parameter = "LspSignatureActiveParameter",
handler_opts = { border = "rounded" },
always_trigger = false,
auto_close_after = nil,
extra_trigger_chars = {","},
zindex = 200,
padding = '',
transparency = nil, -- 1~100
timer_interval = 200, -- lower to reduce latency
toggle_key = '<M-s>', -- toggle floating window key (must set below to true)
toggle_key_flip_floatwin_setting = true,
select_signature_key = '<M-n>', -- next signature for (eg) overloads
},
},
-- Treesitter!
{ "nvim-treesitter/nvim-treesitter", build = ":TSUpdate",
version = false,
event = "VeryLazy",
cmd = { "TSUpdateSync", "TSUpdate", "TSInstall", "Inspect", "InspectTree" },
config = function() require("plugins/treesitter") end,
},
{ "nvim-treesitter/nvim-treesitter-context",
dependencies = "nvim-treesitter/nvim-treesitter",
after = "nvim-treesitter",
},
{ "nvim-treesitter/nvim-treesitter-textobjects",
dependencies = "nvim-treesitter/nvim-treesitter",
after = "nvim-treesitter",
},
{ "windwp/nvim-ts-autotag",
-- Automatically add closing tags for HTML and JSX
ft = { "html", "tsx", "jsx" },
opts = {},
},
-- End of treesitter
-- Begin completion framework
-- Please see ./lua/plugins/complete.lua
{ "hrsh7th/nvim-cmp",
event = { "InsertEnter", "CmdlineEnter" },
config = function() require('plugins/complete') end,
dependencies = {
"hrsh7th/cmp-nvim-lsp",
"hrsh7th/cmp-path", -- File paths
"hrsh7th/cmp-cmdline", -- Fire your way through the neovim cmd line
"hrsh7th/cmp-calc", -- Somehwat useful.. But emacs M-x calc FTW!
"hrsh7th/cmp-emoji", -- 😏 :smirk:
"mtoohey31/cmp-fish",
"petertriho/cmp-git",
"kdheepak/cmp-latex-symbols", -- τ long live \tau
-- "dcampos/nvim-snippy", -- Adding it here does not apply opts
"dcampos/cmp-snippy",
},
},
{ "dcampos/nvim-snippy",
opts = {
-- mappings to navigate expansion fields are merged in plugins/complete.lua
mappings = {
is = {},
nx = {
['<leader>sx'] = 'cut_text',
},
},
}
},
{ "onsails/lspkind.nvim",
},
{ "https://git.sr.ht/~whynothugo/lsp_lines.nvim",
config = function()
require("lsp_lines").setup()
vim.diagnostic.config({ virtual_lines = false })
vim.api.nvim_create_autocmd("BufReadPost", {
pattern = "*",
callback = function()
vim.b.lsp_lines_enabled = false
end
})
vim.keymap.set("n", "<Leader>ll", function()
require("lsp_lines").toggle()
-- Disable virtual_text since it's redundant due to lsp_lines.
if vim.b.lsp_lines_enabled then
-- IT was enabled, now it's disabled.
vim.diagnostic.config({ virtual_text = true })
vim.b.lsp_lines_enabled = false
else
vim.diagnostic.config({ virtual_text = false })
vim.b.lsp_lines_enabled = true
end
end , {desc = "Toggle Lsp Lines"})
end,
},
{ "xeluxee/competitest.nvim",
dependencies = "MunifTanjim/nui.nvim",
config = function() require("plugins/competitest") end,
},
{ "nvim-neorg/neorg",
-- Org... and better? I sure hope so!
cmd = "Neorg",
ft = "norg",
build = ":Neorg sync-parsers",
dependencies = { "nvim-lua/plenary.nvim", "nvim-treesitter/nvim-treesitter" },
config = function()
require("neorg").setup {
load = {
["core.defaults"] = {}, -- Loads default behaviour
["core.concealer"] = {}, -- Adds pretty icons to your documents
["core.dirman"] = { -- Manages Neorg workspaces
config = {
workspaces = { neorg = "~/neorg" },
default_workspace = "neorg"
},
},
},
}
end,
},
{ "folke/which-key.nvim",
-- The most mind blowing steal from ever
event = "VeryLazy",
enabled = false,
init = function()
vim.o.timeout = true
vim.o.timeoutlen = 600
end,
opts = {
plugins = {
marks = true, -- shows a list of your marks on ' and `
registers = false, -- Slightly annoying
-- Although it reminds me of my calculator giving me a similar preview
-- of stored variables upon the "recall" key haha
spelling = {
enabled = true, -- enabling this will show WhichKey when pressing z= to select spelling suggestions
suggestions = 20, -- how many suggestions should be shown in the list?
},
presets = {
operators = true, -- adds help for operators like d, y, ...
motions = true, -- adds help for motions
text_objects = true, -- help for text objects triggered after entering an operator
windows = true, -- default bindings on <c-w>
nav = true, -- misc bindings to work with windows
z = true, -- bindings for folds, spelling and others prefixed with z
g = true, -- bindings for prefixed with g
},
},
-- add operators that will trigger motion and text object completion
-- to enable all native operators, set the preset / operators plugin above
operators = { gc = "Comments" },
key_labels = {
-- ["<space>"] = "SPC",
-- ["<cr>"] = "RET",
-- ["<tab>"] = "TAB",
},
motions = { count = true, },
icons = {
breadcrumb = "»", -- symbol used in the command line area that shows your active key combo
separator = "=", -- symbol used between a key and it's label
group = "+", -- symbol prepended to a group
},
popup_mappings = {
scroll_down = "<c-d>", -- binding to scroll down inside the popup
scroll_up = "<c-u>", -- binding to scroll up inside the popup
},
window = {
border = "shadow", -- none, single, double, shadow
position = "bottom", -- bottom, top
margin = { 0, 0, 0, 0 }, -- extra window margin [top, right, bottom, left]. When between 0 and 1, will be treated as a percentage of the screen size.
padding = { 0, 1, 0, 1 }, -- extra window padding [top, right, bottom, left]
winblend = 0, -- value between 0-100 0 for fully opaque and 100 for fully transparent
zindex = 1000, -- positive value to position WhichKey above other floating windows.
},
layout = {
height = { min = 4, max = 20 }, -- min and max height of the columns
width = { min = 20, max = 50 }, -- min and max width of the columns
spacing = 2, -- spacing between columns
align = "left", -- align columns left, center or right
},
ignore_missing = false, -- enable this to hide mappings for which you didn't specify a label
-- hide mapping boilerplate
hidden = { "<silent>", "<cmd>", "<Cmd>", "<CR>", "^:", "^ ", "^call ", "^lua " },
show_help = true, -- show a help message in the command line for using WhichKey
show_keys = true, -- show the currently pressed key and its label as a message in the command line
triggers = "auto", -- automatically setup triggers
-- triggers = {"<leader>"} -- or specifiy a list manually
-- list of triggers, where WhichKey should not wait for timeoutlen and show immediately
triggers_nowait = {
-- marks
"`",
"'",
"g`",
"g'",
-- registers
-- '"',
-- "<c-r>",
-- spelling
"z=",
},
triggers_blacklist = {
-- list of mode / prefixes that should never be hooked by WhichKey
-- this is mostly relevant for keymaps that start with a native binding
i = { "j", "k" },
v = { "j", "k" },
},
-- disable the WhichKey popup for certain buf types and file types.
-- Disabled by default for Telescope
disable = {
buftypes = {},
filetypes = {},
},
}
},
"folke/neodev.nvim",
}

View File

@ -0,0 +1,209 @@
vim.api.nvim_create_autocmd(
{ "FileType" },
{ pattern = "CompetiTest",
command = "setl signcolumn=no" }
)
function CPConfig()
-- Allows opening of terminal in directory of current file (to avoid
-- submitting code to the wrong problem!)
-- This has since been moved to global config
-- vim.o.autochdir = true
-- <C-R> prefix is also used by fugitive...
local function d(s) return { desc = s } end
local function map(...) vim.keymap.set(...) end
map('c', "<C-R><C-R>", "CompetiTest run<cr>", d"CompetiTest run")
map('c', "<C-R>c", "CompetiTest receive contest<cr>", d"CompetiTest receive contest")
end
vim.api.nvim_create_autocmd(
{ "BufRead" },
{ pattern = "*/projects/cp/*",
callback = CPConfig }
)
local function get_pieces(task)
local judge, contest, problem, problem_char, div, round
round = "" div = "" problem = "" problem_char = ""
local hyphen = string.find(task.group, " - ", 1, true)
if not hyphen then
judge = task.group
contest = "contest"
else
judge = string.sub(task.group, 1, hyphen - 1)
if judge == "Codeforces" then
judge = "cf"
else
judge = judge:lower()
end
-- Educational Codeforces Round 000 Div. 3
contest = string.sub(task.group, hyphen + 3)
div = contest:match("Div. (%d+)") -- 3
round = contest:match("Round (%d+)") -- 000
local edu = contest:match("Educational")
if edu ~= nil then
round = "edu"..round -- edu000
end
div = "div"..div -- div3
end
problem = task.name -- A. Name of Task
problem_char = problem:match(".") -- A
-- A_name-of-task
problem = problem_char .. "_" .. problem:match(" (.+)$"):gsub("%s", "-"):lower()
return {
round = round, -- 000
div = div, -- div3
problem = problem,
problem_char = problem_char,
judge = judge,
}
end
require('competitest').setup {
local_config_file_name = ".competitest.lua",
floating_border = "rounded",
floating_border_highlight = "FloatBorder",
picker_ui = {
width = 0.2,
height = 0.3,
mappings = {
focus_next = { "j", "<down>", "<Tab>" },
focus_prev = { "k", "<up>", "<S-Tab>" },
close = { "<esc>", "<C-c>", "q", "Q" },
submit = { "<cr>" },
},
},
editor_ui = {
popup_width = 0.4,
popup_height = 0.6,
show_nu = true,
show_rnu = false,
normal_mode_mappings = {
switch_window = { "<C-h>", "<C-l>", "<C-i>" },
save_and_close = "<C-s>",
cancel = { "q", "Q" },
},
insert_mode_mappings = {
switch_window = { "<C-h>", "<C-l>", "<C-i>" },
save_and_close = "<C-s>",
cancel = "<C-q>",
},
},
runner_ui = {
interface = "split",
selector_show_nu = false,
selector_show_rnu = false,
show_nu = false,
show_rnu = false,
mappings = {
run_again = "R",
run_all_again = "<C-r>",
kill = "K",
kill_all = "<C-k>",
view_input = { "i", "I" },
view_output = { "a", "A" },
view_stdout = { "o", "O" },
view_stderr = { "e", "E" },
toggle_diff = { "d", "D" },
close = { "q", "Q" },
},
viewer = {
width = 0.5,
height = 0.5,
show_nu = true,
show_rnu = false,
close_mappings = { "q", "Q" },
},
},
popup_ui = {
total_width = 0.8,
total_height = 0.8,
layout = {
{ 4, "tc" },
{ 5, { { 1, "so" }, { 1, "si" } } },
{ 5, { { 1, "eo" }, { 1, "se" } } },
},
},
split_ui = {
position = "right",
relative_to_editor = true,
total_width = 0.3,
vertical_layout = {
{ 1, "tc" },
{ 1, { { 1, "so" }, { 1, "eo" } } },
{ 1, { { 1, "si" }, { 1, "se" } } },
},
total_height = 0.4,
horizontal_layout = {
{ 2, "tc" },
{ 3, { { 1, "so" }, { 1, "si" } } },
{ 3, { { 1, "eo" }, { 1, "se" } } },
},
},
save_current_file = true,
save_all_files = false,
compile_directory = ".",
compile_command = {
c = { exec = "gcc", args = { "-Wall", "$(FNAME)", "-o", "$(FNOEXT).out" } },
cpp = { exec = "g++", args = { "-Wall", "$(FNAME)", "-o", "$(FNOEXT).out" } },
rust = { exec = "rustc", args = { "$(FNAME)" } },
java = { exec = "javac", args = { "$(FNAME)" } },
},
running_directory = ".",
run_command = {
c = { exec = "./$(FNOEXT).out" },
cpp = { exec = "./$(FNOEXT).out" },
rust = { exec = "./$(FNOEXT)" },
python = { exec = "python", args = { "$(FNAME)" } },
java = { exec = "java", args = { "$(FNOEXT)" } },
},
multiple_testing = -1,
maximum_time = 5000,
output_compare_method = "squish",
view_output_diff = false,
testcases_directory = ".",
testcases_use_single_file = false,
testcases_auto_detect_storage = true,
testcases_single_file_format = "$(FNOEXT)_testcases.txt",
testcases_input_file_format = "input$(TCNUM).txt",
testcases_output_file_format = "output$(TCNUM).txt",
companion_port = 27121,
receive_print_message = true,
template_file = "~/projects/cp/t.cpp",
evaluate_template_modifiers = true,
-- Group = "Codeforces - Educational Codeforces Round 156 (Rated for Div. 2)"
-- Judge = "Codeforces"
-- Contest = after '-'
-- JAVA_TASK_CLASS = class friendly problem name
date_format = "%Y-%m-%d %H:%M",
received_files_extension = "cpp",
-- ~/projects/cp/contest/div0/[edu]000/A_problem-name/a.cpp
received_problems_path = function(task, fext)
local info = get_pieces(task)
return vim.loop.os_homedir()..string.format("/projects/cp/%s/%s/%s/%s/%s.%s",
info.judge, info.div, info.round, info.problem, info.problem_char:lower(), fext)
end,
received_problems_prompt_path = true,
-- ~/projects/cp/contest/div0/[edu]000/
received_contests_directory = function (task, fext)
local info = get_pieces(task)
return vim.loop.os_homedir()..string.format("/projects/cp/%s/%s/%s/",
info.judge, info.div, info.round)
end,
-- A_problem-name/a.cpp
received_contests_problems_path = function (task, fext)
local info = get_pieces(task)
return string.format("%s/%s.%s",
info.problem, info.problem_char:lower(), fext)
end,
received_contests_prompt_directory = true,
received_contests_prompt_extension = true,
open_received_problems = true,
open_received_contests = true,
replace_received_testcases = false,
}

View File

@ -1,53 +1,119 @@
-- https://github.com/hrsh7th/nvim-cmp
local has_words_before = function()
unpack = unpack or table.unpack
local line, col = unpack(vim.api.nvim_win_get_cursor(0))
return col ~= 0 and vim.api.nvim_buf_get_lines(0, line - 1, line, true)[1]:sub(col, col):match("%s") == nil
end
local snippy = require("snippy")
local cmp = require'cmp'
cmp.setup({
completion = {
autocomplete = false, -- trigger with <C-space> or <TAB>
},
snippet = {
expand = function(args)
require('snippy').expand_snippet(args.body)
end,
},
view = {
entries = {
name = "custom",
},
},
window = {
completion = {
border = "shadow",
-- winhighlight = "Normal:CmpNormal",
border = "rounded",
winhighlight = 'Normal:Pmenu,FloatBorder:FloatBorder,CursorLine:PmenuSel,Search:None',
},
documentation = {
border = "shadow",
-- winhighlight = "Normal:CmpDocNormal",
}
border = "rounded",
winhighlight = 'Normal:Pmenu,FloatBorder:FloatBorder,CursorLine:PmenuSel,Search:None',
},
},
formatting = {
fields = { 'kind', 'abbr', 'menu' },
format = function(entry, vim_item)
if vim.tbl_contains({ 'path' }, entry.source.name) then
local icon, hl_group = require('nvim-web-devicons').get_icon(entry:get_completion_item().label)
if icon then
vim_item.kind = icon
vim_item.kind = icon..' '
vim_item.kind_hl_group = hl_group
return vim_item
end
end
return require('lspkind').cmp_format({ with_text = false })(entry, vim_item)
vim_item = require('lspkind').cmp_format({
with_text = false,
mode = 'symbol',
maxwidth = 40,
ellipsis_char = "",
})(entry, vim_item)
vim_item.kind = vim_item.kind..' '
return vim_item
end
},
mapping = cmp.mapping.preset.insert({
['<C-u>'] = cmp.mapping.scroll_docs(-4),
['<C-d>'] = cmp.mapping.scroll_docs(4),
['<C-Space>'] = cmp.mapping.complete(),
['<C-e>'] = cmp.mapping.abort(),
['<Tab>'] = cmp.mapping(function(fallback)
if cmp.visible() then
-- Complete immediately if there's only one candidate remaining
if #cmp.get_entries() == 1 then
cmp.confirm({ select = true })
else
cmp.select_next_item()
end
elseif snippy.can_expand_or_advance() then
snippy.expand_or_advance()
elseif has_words_before() then
cmp.complete()
-- Complete immediately if there's only one candidate
if #cmp.get_entries() == 1 then
cmp.confirm({ select = true })
end
else
fallback()
end
end, { "i", "s" }),
['<S-Tab>'] = cmp.mapping(function(fallback)
if cmp.visible() then
cmp.select_prev_item()
elseif snippy.can_jump(-1) then
snippy.previous()
else
fallback()
end
end, { "i", "s" }),
['<C-g>'] = cmp.mapping.abort(),
-- Accept currently selected item. Set `select` to `false` to only
-- confirm explicitly selected items.
['<CR>'] = cmp.mapping.confirm({ select = true }),
['<CR>'] = cmp.mapping({
i = function(fallback)
if cmp.visible() and cmp.get_active_entry() then
cmp.confirm({ behavior = cmp.ConfirmBehavior.Replace, select = false })
else
fallback()
end
end,
s = cmp.mapping.confirm({ select = true }),
-- Super useful for path completion in the command line!
-- :e ~/partial_path<Tab><CR>
-- Typing the above would confirm the selected entry and continue to
-- complete entries from ~/partial_path/*
c = cmp.mapping.confirm({ behavior = cmp.ConfirmBehavior.Replace, select = true }),
}),
}),
sources = cmp.config.sources({
{ name = 'nvim_lsp' },
{ name = 'snippy' },
}, {
-- { name = 'buffer' },
{ name = 'calc' },
{ name = 'emoji' },
{ name = "latex_symbols" },
{ name = 'path' },
-- { name = 'calc' },
}),
})
@ -56,7 +122,9 @@ cmp.setup.filetype('gitcommit', {
sources = cmp.config.sources({
{ name = 'cmp_git' },
}, {
{ name = 'buffer' },
{ name = 'emoji' },
{ name = "latex_symbols" },
-- { name = 'buffer' },
{ name = 'path' },
})
})
@ -77,14 +145,33 @@ cmp.setup.filetype('fish', {
cmp.setup.cmdline({ '/', '?' }, {
mapping = cmp.mapping.preset.cmdline(),
sources = {
{ name = 'buffer' }
-- { name = 'buffer' }
}
})
-- Use cmdline & path source for ':' (if you enabled `native_menu`, this won't
-- work anymore).
-- if you enabled `native_menu` this won't work anymore
cmp.setup.cmdline(':', {
mapping = cmp.mapping.preset.cmdline(),
mapping = cmp.mapping.preset.cmdline({
['<Tab>'] = {
c = function(_)
if cmp.visible() then
-- Complete immediately if there's only one candidate remaining.
-- Avoids an extra <CR> confirm trigger
if #cmp.get_entries() == 1 then
cmp.confirm({ select = true })
else
cmp.select_next_item()
end
else
cmp.complete()
-- Complete immediately if there's only one candidate
if #cmp.get_entries() == 1 then
cmp.confirm({ select = true })
end
end
end,
}
}),
sources = cmp.config.sources({
{ name = 'path' }
}, {
@ -101,4 +188,9 @@ cmp.event:on(
-- Set the completion item color of unmatched portion to white
-- Somehow it is set to black by default ever since I switched my config to lua.
vim.api.nvim_set_hl(0, "CmpItemAbbr", { fg=vim.g['dracula#palette.fg'] })
-- I don't need this anymore when using tundra (theme)
-- vim.api.nvim_set_hl(0, "CmpItemAbbr", { fg=vim.g['dracula#palette.fg'] })
function _G.CmpDisable()
cmp.setup.buffer { enabled = false }
end

View File

@ -6,7 +6,7 @@ lint.linters_by_ft = {
mail = {'proselint'},
template = {'proselint'},
c = {'cpplint'},
cpp = {'cpplint'},
-- cpp = {'cpplint'},
}
vim.api.nvim_create_autocmd("BufWritePost", { pattern = "*", callback = function() lint.try_lint() end })

View File

@ -1,3 +1,7 @@
-- IMPORTANT: make sure to setup neodev BEFORE lspconfig
require("neodev").setup({
setup_jsonls = false,
})
local lspconfig = require('lspconfig')
-- from https://github.com/neovim/nvim-lspconfig/wiki/User-contributed-tips#peek-definition
@ -38,15 +42,9 @@ local on_attach = function(client, bufnr)
buf_set_keymap('n', '<F2>', '<cmd>lua vim.lsp.buf.rename()<CR>', opts)
buf_set_keymap('n', '<localleader>ca', '<cmd>lua vim.lsp.buf.code_action()<CR>', opts)
buf_set_keymap('n', 'gr', '<cmd>lua vim.lsp.buf.references()<CR>', opts)
if vim.fn.has('nvim-0.6') == 1 then
buf_set_keymap('n', '<localleader>e', '<cmd>lua vim.diagnostic.show_line_diagnostics()<CR>', opts)
buf_set_keymap('n', '[d', '<cmd>lua vim.diagnostic.goto_prev()<CR>', opts)
buf_set_keymap('n', ']d', '<cmd>lua vim.diagnostic.goto_next()<CR>', opts)
else
buf_set_keymap('n', '<localleader>e', '<cmd>lua vim.lsp.diagnostic.show_line_diagnostics()<CR>', opts)
buf_set_keymap('n', '[d', '<cmd>lua vim.lsp.diagnostic.goto_prev()<CR>', opts)
buf_set_keymap('n', ']d', '<cmd>lua vim.lsp.diagnostic.goto_next()<CR>', opts)
end
buf_set_keymap('n', '<localleader>e', '<cmd>lua vim.diagnostic.show_line_diagnostics()<CR>', opts)
buf_set_keymap('n', '[d', '<cmd>lua vim.diagnostic.goto_prev()<CR>', opts)
buf_set_keymap('n', ']d', '<cmd>lua vim.diagnostic.goto_next()<CR>', opts)
buf_set_keymap("n", "g@", "<cmd>lua vim.lsp.buf.format{async=true}<CR>", opts)
--buf_set_keymap('n', '<localleader>q', '<cmd>lua vim.lsp.diagnostic.set_loclist()<CR>', opts)
end
@ -59,7 +57,7 @@ local servers = {
"bashls", -- sudo npm i -g bash-language-server
"vimls", -- sudo npm i -g vim-language-server
"marksman", -- https://github.com/artempyanykh/marksman/releases
"ccls", -- https://github.com/MaskRay/ccls/wiki
-- "ccls", -- https://github.com/MaskRay/ccls/wiki
}
for _, lsp in pairs(servers) do
lspconfig[lsp].setup {
@ -110,25 +108,31 @@ lspconfig.gopls.setup{
},
init_options = {
usePlaceholders = true,
-- hoverKind = "SynopsisDocumentation",
}
}
-- https://github.com/neovim/nvim-lspconfig/blob/master/doc/server_configurations.md#lua_ls
lspconfig.lua_ls.setup {
settings = {
Lua = {
-- Tell the language server which version of Lua you're using (most likely LuaJIT in the case of Neovim)
runtime = { version = 'LuaJIT' },
-- Get the language server to recognize the `vim` global
diagnostics = {
globals = {'vim'},
},
-- Make the server aware of Neovim runtime files
workspace = {
library = vim.api.nvim_get_runtime_file("", true),
checkThirdParty = false,
},
-- Do not send telemetry data containing a randomized but unique identifier
telemetry = { enable = false },
},
},
on_attach = on_attach,
capabilities = capabilities,
settings = {
Lua = {
-- Tell the language server which version of Lua you're using (most likely LuaJIT in the case of Neovim)
runtime = { version = 'LuaJIT' },
-- Get the language server to recognize the `vim` global
diagnostics = {
globals = {'vim'},
},
-- Make the server aware of Neovim runtime files
workspace = {
library = vim.api.nvim_get_runtime_file("", true),
checkThirdParty = false,
},
-- Do not send telemetry data containing a randomized but unique identifier
telemetry = { enable = false },
completion = {
callSnippets = "Replace"
},
},
},
}

View File

@ -1,4 +1,6 @@
--- Helpers for status line components ---
local function lineinfo()
-- return "   "
local total = tostring(vim.fn.line('$'))
-- Left pad the current line count to max width of this value, to avoid jittering
return string.format("%"..total:len().."d", vim.fn.line('.'))..'/'..total
@ -9,17 +11,59 @@ local diagnostics_config = {
symbols = {error = 'E:', warn = 'W:', info = 'I:', hint = 'H:'},
}
local competitest_line = {
filetypes = {'CompetiTest'},
inactive_sections = {
lualine_c = { function()
return vim.b.competitest_title or 'CompetiTest'
end },
},
}
--- Theme ---
-- https://github.com/sam4llis/nvim-tundra/blob/main/lua/lualine/themes/tundra.lua
local cp = require('nvim-tundra.palette.arctic')
local tundra_lualine = {
normal = {
a = { fg = cp.gray._300, bg = cp.gray._700, gui = 'bold' },
b = { fg = cp.gray._300, bg = cp.gray._800, gui = 'bold' },
c = { fg = cp.gray._300, bg = cp.gray._800 },
},
insert = {
a = { fg = cp.sand._500, bg = cp.gray._700, gui = 'bold' },
b = { fg = cp.gray._700, bg = cp.gray._700, gui = 'bold' },
c = { fg = cp.gray._300, bg = cp.gray._800 },
},
visual = {
a = { fg = cp.gray._300, bg = cp.green._900, gui = 'bold' },
b = { fg = cp.green._900, bg = cp.transparent, gui = 'bold' },
},
replace = {
a = { fg = cp.gray._300, bg = cp.red._800, gui = 'bold' },
b = { fg = cp.red._800, bg = cp.transparent, gui = 'bold' },
},
command = {
a = { fg = cp.indigo._500, bg = cp.gray._600, gui = 'bold' },
b = { fg = cp.gray._600, bg = cp.transparent, gui = 'bold' },
},
}
require('lualine').setup {
options = {
icons_enabled = true,
theme = 'auto',
component_separators = { left = '/', right = '/'},
-- theme = 'auto',
theme = tundra_lualine,
component_separators = { left = '', right = ''},
section_separators = { left = '', right = ''},
disabled_filetypes = {
statusline = {},
winbar = {},
},
ignore_focus = {},
ignore_focus = {'CompetiTest'},
always_divide_middle = true,
globalstatus = false,
refresh = {
@ -31,44 +75,77 @@ require('lualine').setup {
sections = {
lualine_a = {{ 'mode', fmt = function(str)
if str == "NORMAL" then
return "NORM"
return "./"
elseif str == "INSERT" then
return "INS"
return "i "
elseif str == "COMMAND" then
return "CMD"
return ":>"
elseif str == "VISUAL" then
return "VIS"
elseif str == "REPLACE" then
return "REP"
elseif str == "VISUAL BLOCK" then
return "VBL"
return "v "
elseif str == "V-BLOCK" then
return "^v"
elseif str == "V-LINE" then
return "VL"
elseif str == "TERMINAL" then
return "TERM"
return ":D"
elseif str == "REPLACE" then
return "R "
elseif str == "SUBSTITUTE" then
return "SUB"
return "S?"
end
return str
end }},
lualine_b = {'branch', 'diff'},
lualine_c = {'filename'},
lualine_x = {'encoding', { 'fileformat',
lualine_b = {},
lualine_c = {
{ 'buffers',
mode = 4,
hide_filename_extension = true,
buffers_color = {
-- Same values as the general color option can be used here.
active = 'lualine_z_active',
inactive = 'lualine_c',
},
symbols = {
modified = '+', -- Text to show when the buffer is modified
alternate_file = '', -- Text to show to identify the alternate file
directory = '', -- Text to show when the buffer is a directory
},
}
},
lualine_x = {'diff', 'encoding', { 'fileformat',
icons_enabled = true,
symbols = { unix = 'LF', dos = 'CRLF', mac = 'CR', },
-- symbols = { unix = 'LF', dos = 'CRLF', mac = 'CR', },
}, 'filetype'},
lualine_y = {diagnostics_config},
lualine_z = {lineinfo},
},
inactive_sections = {
lualine_a = {},
lualine_b = {'brach', 'diff'},
lualine_b = {'branch', 'diff'},
lualine_c = {'filename'},
lualine_x = {diagnostics_config},
lualine_x = { diagnostics_config },
lualine_y = {'searchcount'},
lualine_z = {lineinfo},
},
tabline = {},
winbar = {},
tabline = {
-- lualine_a = {},
-- lualine_b = {},
-- lualine_c = {breadcrumb},
-- lualine_x = {},
-- lualine_y = {},
-- lualine_z = {{
-- 'tabs',
-- mode = 2,
-- show_modified_status = false,
-- tabs_color = {
-- active = "lualine_a_active",
-- inactive = "lualine_a_inactive",
-- }
-- }},
},
winbar = {
},
inactive_winbar = {},
extensions = {'nvim-tree'},
extensions = {'nvim-tree', competitest_line, 'symbols-outline'},
}

View File

@ -0,0 +1,37 @@
local function d(s) return { desc = s } end
local function map(...) vim.keymap.set(...) end
map("n", "<leader>ff", "<cmd>Telescope find_files<cr>", d"Telescope find_files")
map("n", "<leader>fr", "<cmd>Telescope oldfiles<cr>", d"Telescope oldfiles")
map("n", "<leader>fg", "<cmd>Telescope live_grep<cr>", d"Telescope live_grep")
map("n", "<leader>fb", "<cmd>Telescope buffers<cr>", d"Telescope buffers")
map("n", "<leader>fh", "<cmd>Telescope help_tags<cr>", d"Telescope help_tags")
map("n", "<leader>fR", "<cmd>Telescope registers<cr>", d"Telescope registers (also see <leader>rg)")
require('telescope').setup({
defaults = {
layout_config = {
-- vertical = { width = 0.3 },
horizontal = { width = 0.5 },
},
preview = {
filesize_limit = 0.1, -- MB
},
},
pickers = {
find_files = {
theme = "dropdown",
},
mappings = {
n = {
["<C-d>"] = function(prompt_bufnr)
local selection = require("telescope.actions.state").get_selected_entry()
local dir = vim.fn.fnamemodify(selection.path, ":p:h")
require("telescope.actions").close(prompt_bufnr)
-- Depending on what you want put `cd`, `lcd`, `tcd`
vim.cmd(string.format("silent lcd %s", dir))
end
}
}
},
})

View File

@ -0,0 +1,89 @@
local configs = require("nvim-treesitter.configs")
configs.setup({
ensure_installed = {
"cpp", "lua", "vim", "vimdoc", "html", "go", "bash", "regex", "markdown", "markdown_inline", "query", "toml", "vimdoc", "python", "diff",
},
sync_install = false,
highlight = { enable = true },
indent = { enable = true },
-- Textobjects, see below as well
textobjects = {
select = {
enable = true,
-- Automatically jump forward to textobj, similar to targets.vim
lookahead = true,
keymaps = {
-- You can use the capture groups defined in textobjects.scm
["af"] = { query = "@function.outer", desc = "Around function" },
["if"] = { query = "@function.inner", desc = "Inside function" },
["ac"] = { query = "@class.outer", desc = "Around class" },
["ic"] = { query = "@class.inner", desc = "Inside class" },
-- You can also use captures from other query groups like `locals.scm`
["as"] = { query = "@scope", query_group = "locals", desc = "Select language scope" },
},
include_surrounding_whitespace = false,
},
move = {
enable = true,
set_jumps = true,
goto_next = {
["]p"] = "@parameter.outer",
},
goto_previous = {
["[p"] = "@parameter.outer",
},
}
},
})
-- TS context
require("treesitter-context").setup {
enable = true, -- Enable this plugin (Can be enabled/disabled later via commands)
max_lines = 0, -- How many lines the window should span. Values <= 0 mean no limit.
min_window_height = 0, -- Minimum editor window height to enable context. Values <= 0 mean no limit.
line_numbers = true,
multiline_threshold = 20, -- Maximum number of lines to show for a single context
trim_scope = 'outer', -- Which context lines to discard if `max_lines` is exceeded. Choices: 'inner', 'outer'
mode = 'topline', -- Line used to calculate context. Choices: 'cursor', 'topline'
-- Separator between context and content. Should be a single character string, like '-'.
-- When separator is set, the context will only show up when there are at least 2 lines above cursorline.
separator = nil,
zindex = 20, -- The Z-index of the context window
on_attach = nil, -- (fun(buf: integer): boolean) return false to disable attaching
}
--- TS textobjects ---
vim.keymap.set("n", "].", function()
local t = require("nvim-treesitter.ts_utils")
local node = t.get_node_at_cursor()
if node ~= nil then
t.goto_node(t.get_next_node(node, true, true), false, true)
end
end,
{ desc = "Go to next sibling node" }
)
vim.keymap.set("n", "[.", function()
local t = require("nvim-treesitter.ts_utils")
local node = t.get_node_at_cursor()
if node ~= nil then
t.goto_node(t.get_previous_node(node, true, true), false, true)
end
end,
{ desc = "Go to previous sibling node" }
)
-- Textobject setup{} opts were set at the top along with treesitter.
-- Allow repeat keys
local ts_repeat_move = require "nvim-treesitter.textobjects.repeatable_move"
-- ensure ; goes forward and , goes backward regardless of the last direction
vim.keymap.set({ "n", "x", "o" }, ";", ts_repeat_move.repeat_last_move_next)
vim.keymap.set({ "n", "x", "o" }, ",", ts_repeat_move.repeat_last_move_previous)
-- vim way: ; goes to the direction you were moving.
-- vim.keymap.set({ "n", "x", "o" }, ";", ts_repeat_move.repeat_last_move)
-- vim.keymap.set({ "n", "x", "o" }, ",", ts_repeat_move.repeat_last_move_opposite)
-- Optionally, make builtin f, F, t, T also repeatable with ; and ,
vim.keymap.set({ "n", "x", "o" }, "f", ts_repeat_move.builtin_f)
vim.keymap.set({ "n", "x", "o" }, "F", ts_repeat_move.builtin_F)
vim.keymap.set({ "n", "x", "o" }, "t", ts_repeat_move.builtin_t)
vim.keymap.set({ "n", "x", "o" }, "T", ts_repeat_move.builtin_T)

View File

@ -0,0 +1,69 @@
local s = require('nvim-tundra.stylesheet.arctic')
-- See also: statusline.lua for statusline colors (which I also use tundra's
-- stylesheet)
-- bg.cursorline is used elsewhere, rather than digging into all the places
-- that they are used and make it lighter (increase contrast) I'd change change
-- the field here, and optionally set the actual Cursorline highlight group
-- back if needed.
s.bg.cursorline = s.cp.gray._700
require("nvim-tundra").setup {
transparent_background = false,
dim_inactive_windows = { enabled = true, color = nil, },
sidebars = { enabled = true, color = nil, },
editor = { search = {}, substitute = {}, },
syntax = {
booleans = { bold = true, italic = true },
comments = { bold = false, italic = false },
conditionals = {},
constants = { bold = true },
fields = {},
functions = {},
keywords = {},
loops = {},
numbers = { bold = true },
operators = { bold = true },
punctuation = {},
strings = {},
types = { italic = true },
},
diagnostics = { errors = {}, warnings = {}, information = {}, hints = {}, },
plugins = {
lsp = true,
semantic_tokens = true,
treesitter = true,
telescope = true,
nvimtree = true,
cmp = true,
context = true,
dbui = true,
gitsigns = true,
neogit = true,
textfsm = true,
},
overwrite = {
colors = {},
highlights = {
TreesitterContext = { bg = s.cp.gray._700 },
-- FIXME: Line number hl doesn't work
TreesitterContextLineNumber = { fg = s.cp.gray._500, bg = s.cp.gray._700 },
Folded = {
fg = s.cp.gray._400,
bg = s.cp.gray._700
},
IblIndent = { fg = s.cp.gray._800 },
IblScope = { fg = s.cp.gray._800 },
Comment = { fg = s.cp.gray._400 }, -- Add more contrast
-- Inspired by Modus-Vivendi (emacs).
-- Shows the matched pair more visibly
MatchParen = { bg = s.cp.gray._500 },
-- Fix completion menu border color
FloatBorder = { fg = s.cp.gray._500 },
},
},
}
vim.o.background = "dark"
vim.cmd("colorscheme tundra")

View File

@ -0,0 +1,5 @@
#!/usr/bin/env bash
set -e
progname=$(basename "$0")

67
.vimrc
View File

@ -39,18 +39,69 @@ if has('termguicolors')
let &t_8b = "\<Esc>[48;2;%lu;%lu;%lum"
colorscheme dracula
else
colorscheme darkblue " Looks like dracula but BLUEEEE
colorscheme lunaperche
" Other good ones:
" - darkblue - Looks like dracula but BLUEEEE
" - desert - reminds me of zenburn
" - elflord - like modus operandi in emacs! - but not as appealing
" - habamax - looks like monokai... - mild contrast everywhere
" - lunaperche - good contrast for comments - like modus operandi! but
" less purples
" - quiet - light
" - shine - light (best light theme?)
" - slate - blue - low contrast for comments
" TODO: Use a non-dracula theme but ensure correct background for each
" theme is set correctly just like dracula, so terminal bg is not used
" when the text does not fit on entire width of terminal.
" FIXME: My attempt to replicate dracula's selection but keep fg
" highlights feature...
" TODO: Ensure search highlights are non-obstrusive like in emacs for all
" themes.
let g:dracula#palette = {}
let g:dracula#palette.selection = ['#44475A', 239]
let s:none = ['NONE', 'NONE']
let s:selection = g:dracula#palette.selection
function! s:h(scope, fg, ...) " bg, attr_list, special
let l:fg = copy(a:fg)
let l:bg = get(a:, 1, ['NONE', 'NONE'])
let l:attr_list = filter(get(a:, 2, ['NONE']), 'type(v:val) == 1')
let l:attrs = len(l:attr_list) > 0 ? join(l:attr_list, ',') : 'NONE'
let l:special = get(a:, 3, ['NONE', 'NONE'])
if l:special[0] !=# 'NONE' && l:fg[0] ==# 'NONE' && !g:dracula_full_special_attrs_support
let l:fg[0] = l:special[0]
let l:fg[1] = l:special[1]
endif
let l:hl_string = [
\ 'highlight', a:scope,
\ 'guifg=' . l:fg[0], 'ctermfg=' . l:fg[1],
\ 'guibg=' . l:bg[0], 'ctermbg=' . l:bg[1],
\ 'gui=' . l:attrs, 'cterm=' . l:attrs,
\ 'guisp=' . l:special[0],
\]
execute join(l:hl_string, ' ')
endfunction
call s:h('DraculaSelection', s:none, s:selection)
hi! link PmenuSel DraculaSelection
hi! link PmenuThumb DraculaSelection
hi! link Visual DraculaSelection
endif
let mapleader=";" " setting leader key to ';'
set number
" space is used in my neovim and emacs
" and I just learnt after using emacs evil mode that `;` existed, so I
" can't set it to that either...
" ALSO this is insane but I had no idea before learning `;` that f and t
" existed 🤦
" So I gave up exercising muscle memory for different leaders across neovim,
" vim, emacs evil mode...
let mapleader=" "
set relativenumber
syntax on
set mouse=a " allow mouse for all
set undofile " save undo to a file
set hlsearch " highlight search
set showcmd " show incomplete commands
set wildmenu " command line's tab complete in a menu
set cursorline " highlight cursor line
" set cursorline " highlight cursor line
set noerrorbells " no beeps
set visualbell " flash screen instead
set title " set window title to file name
@ -61,7 +112,7 @@ set shiftwidth=4
set wrap " dont wrap
set incsearch " find next match while typing search
set linebreak " wrap lines at convenient points
set scrolloff=6 " screen lines to keep above and below cursor
" set scrolloff=6 " screen lines to keep above and below cursor
set sidescrolloff=8 " screen columns to keep on left and right of cursor
set confirm " display confirmation when closing unsaved file
set encoding=utf-8 " set encoding with Unicode
@ -102,7 +153,8 @@ endif
au BufReadPost * if line("'\"") > 1 && line("'\"") <= line("$") | exe "normal! g'\"" | endif
" highlight extra whitespace
match ErrorMsg '\s\+$'
" Was using ErrorMsg, was scary.
match Underlined '\s\+$'
"""""""""""
" Mappings
@ -139,7 +191,8 @@ nnoremap <Leader>rg :registers<CR>
" other mappings
" dot command in visual mode
vnoremap . :normal.<CR>
nnoremap Q :q<CR>
" Lets try Ex Mode!
" nnoremap Q :q<CR>
" move visual selection
vnoremap J :m '>+1<CR>gv=gv
vnoremap K :m '<-2<CR>gv=gv