dotfiles

config files for my linux setup
git clone git://edryd.org/dotfiles
Log | Files | Refs | README

commit c11d76d1bf2358ab08448d8b81d58961fd7097f8
parent 11f912d74bbdbd4e75ee19bdf3a162fabd0de5a6
Author: Ed van Bruggen <ed@edryd.org>
Date:   Sun, 16 Nov 2025 23:08:58 -0500

nvim: Add full config

Diffstat:
MMakefile | 2+-
Aconfig/nvim/colors/zim.vim | 112+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Aconfig/nvim/init.lua | 140+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Aconfig/nvim/lazy-lock.json | 33+++++++++++++++++++++++++++++++++
Aconfig/nvim/lua/config/lazy.lua | 26++++++++++++++++++++++++++
Aconfig/nvim/lua/plugins/plugins.lua | 269+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Aconfig/nvim/vimrc.vim | 180+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Dnvimrc | 122-------------------------------------------------------------------------------
8 files changed, 761 insertions(+), 123 deletions(-)

diff --git a/Makefile b/Makefile @@ -4,6 +4,7 @@ TARGETSL = ~/code/dl/sl symlinks = bash_profile \ bashrc \ + config/nvim \ config/clipit \ config/htop \ config/openbox \ @@ -16,7 +17,6 @@ symlinks = bash_profile \ gdbinit \ gitconfig \ gitignore \ - nvimrc \ pylintrc \ terminfo \ themes \ diff --git a/config/nvim/colors/zim.vim b/config/nvim/colors/zim.vim @@ -0,0 +1,112 @@ +hi clear + +if exists("syntax_on") + syntax reset +endif + +hi SpecialKey ctermfg=4 +hi TermCursor cterm=reverse +hi NonText ctermfg=7 +hi Directory ctermfg=4 +hi ErrorMsg ctermfg=1 ctermbg=0 +hi IncSearch cterm=reverse +hi MoreMsg ctermfg=2 +hi ModeMsg cterm=bold +hi Question ctermfg=2 +hi Title ctermfg=15 ctermbg=0 cterm=bold +hi WarningMsg ctermfg=1 +hi WildMenu ctermfg=0 ctermbg=11 +hi Conceal ctermfg=7 ctermbg=0 +" hi Conceal ctermfg=7 ctermbg=7 +hi SpellBad ctermfg=9 ctermbg=0 cterm=bold +hi SpellRare ctermbg=9 +hi SpellLocal cterm=bold +hi SpellCap cterm=underline ctermfg=15 ctermbg=0 +hi PmenuSbar ctermbg=8 +hi PmenuThumb ctermbg=0 +hi TabLine cterm=underline ctermfg=7 ctermbg=0 +hi TabLineSel cterm=reverse +hi TabLineFill cterm=bold +hi CursorColumn ctermbg=7 +hi CursorLine cterm=underline +hi MatchParen ctermbg=14 +hi Constant ctermfg=5 +hi Special ctermfg=1 +hi Identifier cterm=NONE ctermfg=6 +hi Statement ctermfg=2 +hi PreProc ctermfg=5 +hi Type ctermfg=3 +hi Todo ctermfg=7 ctermbg=0 cterm=bold +hi Underlined cterm=underline ctermfg=5 +hi Ignore ctermfg=15 +hi Error ctermfg=9 ctermbg=0 +hi Operator ctermfg=4 + +let colors_name = "zim" + +" In diffs, added lines are green, changed lines are yellow, deleted lines are +" red, and changed text (within a changed line) is bright yellow and bold. +hi DiffAdd ctermfg=2 ctermbg=0 +hi DiffChange ctermfg=3 ctermbg=0 +hi DiffDelete ctermfg=1 ctermbg=0 +hi DiffText ctermfg=8 ctermbg=0 cterm=bold + +" Invert selected lines in visual mode +hi Visual ctermfg=NONE ctermbg=NONE cterm=inverse + +" hi search matches in black, with a yellow background +hi Search ctermfg=0 ctermbg=11 + +" Dim line numbers, comments, color columns, the status line, splits and sign +" columns. +if &background == "light" + hi LineNr ctermfg=7 + hi CursorLineNr ctermfg=8 + hi Comment ctermfg=7 + hi ColorColumn ctermfg=8 ctermbg=7 + hi Folded ctermfg=8 ctermbg=7 + hi FoldColumn ctermfg=8 ctermbg=7 + hi Pmenu ctermfg=0 ctermbg=7 + hi PmenuSel ctermfg=7 ctermbg=0 + " hi SpellCap ctermfg=8 ctermbg=7 + hi StatusLine ctermfg=0 ctermbg=7 cterm=bold + hi StatusLineNC ctermfg=8 ctermbg=7 cterm=NONE + hi VertSplit ctermfg=8 ctermbg=7 cterm=NONE + hi SignColumn ctermbg=0 +else + hi LineNr ctermfg=8 + hi CursorLineNr ctermfg=7 + hi Comment ctermfg=8 + hi ColorColumn ctermfg=7 ctermbg=0 + hi Folded ctermfg=7 ctermbg=0 + hi FoldColumn ctermfg=7 ctermbg=0 + hi Pmenu ctermfg=15 ctermbg=8 + hi PmenuSel ctermfg=8 ctermbg=15 + " hi SpellCap ctermfg=7 ctermbg=8 + hi StatusLine ctermfg=15 ctermbg=8 cterm=bold + hi StatusLineNC ctermfg=7 ctermbg=8 cterm=NONE + hi VertSplit ctermfg=7 ctermbg=0 cterm=NONE + hi SignColumn ctermbg=0 +endif + +hi link DimFzfFg Normal +hi link DimFzfBg Normal +hi link DimFzfFgPlus PmenuSel +hi link DimFzfBgPlus PmenuSel +hi link DimFzfInfo Comment + +hi DimFzfHl ctermfg=2 +hi DimFzfPrompt ctermfg=12 +hi DimFzfPointer ctermfg=1 +hi DimFzfMarker ctermfg=9 + +let g:fzf_colors = { 'fg': ['fg', 'DimFzfFg'], + \ 'bg': ['bg', 'DimFzfBg'], + \ 'hl': ['fg', 'DimFzfHl'], + \ 'fg+': ['fg', 'DimFzfFgPlus'], + \ 'bg+': ['bg', 'DimFzfbgPlus'], + \ 'hl+': ['fg', 'DimFzfHl'], + \ 'info': ['fg', 'DimFzfInfo'], + \ 'prompt': ['fg', 'DimFzfPrompt'], + \ 'pointer': ['fg', 'DimFzfPointer'], + \ 'marker': ['fg', 'DimFzfMarker']} diff --git a/config/nvim/init.lua b/config/nvim/init.lua @@ -0,0 +1,140 @@ +require("config.lazy") +vim.cmd('source ~/.config/nvim/vimrc.vim') + +vim.g.mapleader = ' ' + +---- Mappings + +function _G.set_terminal_keymaps() + local opts = {buffer = 0} + vim.keymap.set('t', '<esc>', [[<C-\><C-n>]], opts) + vim.keymap.set('t', 'jj', [[<C-\><C-n>]], opts) + vim.keymap.set('t', '<A-h>', [[<Cmd>wincmd h<CR>]], opts) + vim.keymap.set('t', '<A-j>', [[<Cmd>wincmd j<CR>]], opts) + vim.keymap.set('t', '<A-k>', [[<Cmd>wincmd k<CR>]], opts) + vim.keymap.set('t', '<A-l>', [[<Cmd>wincmd l<CR>]], opts) + vim.keymap.set('t', '<C-w>', [[<C-\><C-n><C-w>]], opts) +end +vim.cmd('autocmd! TermOpen term://* lua set_terminal_keymaps()') + +vim.keymap.set('n', '<A-h>', [[<C-w>h]]) +vim.keymap.set('n', '<A-j>', [[<C-w>j]]) +vim.keymap.set('n', '<A-k>', [[<C-w>k]]) +vim.keymap.set('n', '<A-l>', [[<C-w>l]]) + +-- TODO nmap <C-w>> 5<C-w>> + +-- Switch between C source and header files +if vim.bo.filetype == 'c' then + vim.keymap.set('n', '<leader>a', 'edit %<.h') +elseif vim.bo.filetype == 'h' then + vim.keymap.set('n', '<leader>a', 'edit %<.c') +end + + +---- Plugins + +---- FZF +local fzf = require('fzf-lua') +vim.keymap.set('n', '<leader>f', fzf.files, {}) +vim.keymap.set('n', '<leader>g', fzf.live_grep, {}) +vim.keymap.set('n', '<leader>b', fzf.buffers, {}) +vim.keymap.set('n', '<leader>t', fzf.tags, {}) +-- vim.keymap.set('c', 'help', fzf.help_tags, {}) + +-- vim.keymap.set('n', '<leader>m', , {}) + +---- ToggleTerm +local set_opfunc = vim.fn[vim.api.nvim_exec( +[[ +func s:set_opfunc(val) +let &opfunc = a:val +endfunc +echon get(function('s:set_opfunc'), 'name') + ]], true +)] +-- Send motion to terminal +vim.keymap.set("n", [[<leader><c-_>]], function() + set_opfunc(function(motion_type) + require("toggleterm").send_lines_to_terminal(motion_type, false, { args = vim.v.count }) + end) + vim.api.nvim_feedkeys("g@", "n", false) +end) +-- TODO breaks send motion ↑ +-- Double the command to send line to terminal +-- vim.keymap.set("n", [[<leader><c-_><c-_>]], function() +-- set_opfunc(function(motion_type) +-- require("toggleterm").send_lines_to_terminal(motion_type, false, { args = vim.v.count }) +-- end) +-- vim.api.nvim_feedkeys("g@_", "n", false) +-- end) +-- Send whole file +vim.keymap.set("n", [[<leader><leader><c-_>]], function() + set_opfunc(function(motion_type) + require("toggleterm").send_lines_to_terminal(motion_type, false, { args = vim.v.count }) + end) + vim.api.nvim_feedkeys("ggg@G''", "n", false) +end) + +--- Treesitter +require'nvim-treesitter.configs'.setup { + -- A list of parser names, or "all" (the listed parsers MUST always be installed) + ensure_installed = { "c", "lua", "vim", "vimdoc", "query", "markdown", "markdown_inline" }, + + -- Install parsers synchronously (only applied to `ensure_installed`) + sync_install = false, + + -- Automatically install missing parsers when entering buffer + -- Recommendation: set to false if you don't have `tree-sitter` CLI installed locally + auto_install = true, + + -- List of parsers to ignore installing (or "all") + ignore_install = { "javascript" }, + + ---- If you need to change the installation directory of the parsers (see -> Advanced Setup) + -- parser_install_dir = "/some/path/to/store/parsers", -- Remember to run vim.opt.runtimepath:append("/some/path/to/store/parsers")! + + highlight = { + enable = true, + + -- list of language that will be disabled + disable = { "markdown" }, + + -- Setting this to true will run `:h syntax` and tree-sitter at the same time. + -- Set this to `true` if you depend on 'syntax' being enabled (like for indentation). + -- Using this option may slow down your editor, and you may see some duplicate highlights. + -- Instead of true it can also be a list of languages + additional_vim_regex_highlighting = false, + }, +} + +-- Orgmode +vim.api.nvim_set_hl(0, "@org.headline.level2.org", { link = "Title" }) +vim.api.nvim_set_hl(0, "@variable", { link = "Ignore" }) +vim.api.nvim_set_hl(0, "@variable.parameter", { link = "Ignore" }) +vim.wo.foldmethod = 'expr' +vim.wo.foldexpr = 'v:lua.vim.treesitter.foldexpr()' +vim.wo.foldlevel = 8 + +vim.opt.conceallevel = 2 +-- vim.opt.concealcursor = 'nc' + + +---- LSP +require'lspconfig'.pyright.setup{} +vim.api.nvim_create_autocmd('FileType', { + -- This handler will fire when the buffer's 'filetype' is "python" + pattern = 'racket', + callback = function(ev) + vim.lsp.start({ + name = 'racket', + cmd = {'racket', '-l', 'racket-langserver'}, + + -- Set the "root directory" to the parent directory of the file in the + -- current buffer (`ev.buf`) that contains either a "setup.py" or a + -- "pyproject.toml" file. Files that share a root directory will reuse + -- the connection to the same LSP server. + -- root_dir = vim.fs.root(ev.buf, {'setup.py', 'pyproject.toml'}), + }) + end, +}) diff --git a/config/nvim/lazy-lock.json b/config/nvim/lazy-lock.json @@ -0,0 +1,33 @@ +{ + "blink.cmp": { "branch": "main", "commit": "bae4bae0eedd1fa55f34b685862e94a222d5c6f8" }, + "eevo.vim": { "branch": "master", "commit": "417b8ac66c1ec8ac049166155fe932d7b6381474" }, + "fzf-lua": { "branch": "main", "commit": "091bcd0c925199b1371ea81ec79278611d299627" }, + "gitsigns.nvim": { "branch": "main", "commit": "6e3c66548035e50db7bd8e360a29aec6620c3641" }, + "lazy.nvim": { "branch": "main", "commit": "6c3bda4aca61a13a9c63f1c1d1b16b9d3be90d7a" }, + "markdown.nvim": { "branch": "master", "commit": "dfa0d2def6dbf77e9206b16dc90cad4dd23d55d2" }, + "marks.nvim": { "branch": "master", "commit": "f353e8c08c50f39e99a9ed474172df7eddd89b72" }, + "mini.nvim": { "branch": "main", "commit": "ddb70da6ec6aa896cfde87350d1e8dffb57ddef0" }, + "nvim-autopairs": { "branch": "master", "commit": "23320e75953ac82e559c610bec5a90d9c6dfa743" }, + "nvim-lspconfig": { "branch": "master", "commit": "5f550bbb4d58bb2bfbbed4633fc69c3f0eccaf3a" }, + "nvim-surround": { "branch": "main", "commit": "a868c256c861044beb9794b4dd126480dcdfbdad" }, + "nvim-treesitter": { "branch": "master", "commit": "42fc28ba918343ebfd5565147a42a26580579482" }, + "nvim-web-devicons": { "branch": "master", "commit": "f66cdfef5e84112045b9ebc3119fee9bddb3c687" }, + "org-bullets.nvim": { "branch": "main", "commit": "21437cfa99c70f2c18977bffd423f912a7b832ea" }, + "orgmode": { "branch": "master", "commit": "b924cbb7e9c5f2c34f84d92e49dc76e01f32cad9" }, + "persistence.nvim": { "branch": "main", "commit": "166a79a55bfa7a4db3e26fc031b4d92af71d0b51" }, + "plenary.nvim": { "branch": "master", "commit": "b9fd5226c2f76c951fc8ed5923d85e4de065e509" }, + "todo-comments.nvim": { "branch": "main", "commit": "304a8d204ee787d2544d8bc23cd38d2f929e7cc5" }, + "toggleterm.nvim": { "branch": "main", "commit": "50ea089fc548917cc3cc16b46a8211833b9e3c7c" }, + "treesitter-unit": { "branch": "main", "commit": "89968a1f8c72427691088e6d09d26a52c2ddc6f4" }, + "vim-commentary": { "branch": "master", "commit": "64a654ef4a20db1727938338310209b6a63f60c9" }, + "vim-dispatch": { "branch": "master", "commit": "a2ff28abdb2d89725192db5b8562977d392a4d3f" }, + "vim-endwise": { "branch": "master", "commit": "eab530110d7a0d985902a3964894816b50dbf31a" }, + "vim-eunuch": { "branch": "master", "commit": "e86bb794a1c10a2edac130feb0ea590a00d03f1e" }, + "vim-fugitive": { "branch": "master", "commit": "61b51c09b7c9ce04e821f6cf76ea4f6f903e3cf4" }, + "vim-gutentags": { "branch": "master", "commit": "aa47c5e29c37c52176c44e61c780032dfacef3dd" }, + "vim-repeat": { "branch": "master", "commit": "65846025c15494983dafe5e3b46c8f88ab2e9635" }, + "vim-rsi": { "branch": "master", "commit": "45540637ead22f011e8215f1c90142e49d946a54" }, + "vim-sleuth": { "branch": "master", "commit": "be69bff86754b1aa5adcbb527d7fcd1635a84080" }, + "vim-unimpaired": { "branch": "master", "commit": "db65482581a28e4ccf355be297f1864a4e66985c" }, + "vimtex": { "branch": "master", "commit": "dc90feacb86f7b85b0b791d8073eefc769a23725" } +} diff --git a/config/nvim/lua/config/lazy.lua b/config/nvim/lua/config/lazy.lua @@ -0,0 +1,26 @@ +-- Bootstrap lazy.nvim +local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim" +if not (vim.uv or vim.loop).fs_stat(lazypath) then + local lazyrepo = "https://github.com/folke/lazy.nvim.git" + vim.fn.system({ "git", "clone", "--filter=blob:none", "--branch=stable", lazyrepo, lazypath }) +end +vim.opt.rtp:prepend(lazypath) + +-- Make sure to setup `mapleader` and `maplocalleader` before +-- loading lazy.nvim so that mappings are correct. +-- This is also a good place to setup other settings (vim.opt) +vim.g.mapleader = " " +vim.g.maplocalleader = "\\" + +-- Setup lazy.nvim +require("lazy").setup({ + spec = { + -- import your plugins + { import = "plugins" }, + }, + -- Configure any other settings here. See the documentation for more details. + -- colorscheme that will be used when installing plugins. + install = { colorscheme = { "zim" } }, + -- automatically check for plugin updates + checker = { enabled = true, notify = false }, +}) diff --git a/config/nvim/lua/plugins/plugins.lua b/config/nvim/lua/plugins/plugins.lua @@ -0,0 +1,269 @@ +return { + -- General + { + 'echasnovski/mini.nvim', + config = function() + require("mini.align").setup() + require("mini.pairs").setup() + -- require("mini.ai").setup() + require("mini.cursorword").setup() + end + }, + { + "folke/persistence.nvim", + event = "BufReadPre", -- this will only start session saving when an actual file was opened + opts = { + need = 2, -- require 2 open file buffers before saving session + } + }, + { + 'saghen/blink.cmp', + -- optional: provides snippets for the snippet source + -- dependencies = 'rafamadriz/friendly-snippets', + + -- use a release tag to download pre-built binaries + version = '*', + -- AND/OR build from source, requires nightly: https://rust-lang.github.io/rustup/concepts/channels.html#working-with-nightly-rust + -- build = 'cargo build --release', + -- If you use nix, you can build from source using latest nightly rust with: + -- build = 'nix run .#build-plugin', + + ---@module 'blink.cmp' + ---@type blink.cmp.Config + opts = { + -- 'default' for mappings similar to built-in completion + -- 'super-tab' for mappings similar to vscode (tab to accept, arrow keys to navigate) + -- 'enter' for mappings similar to 'super-tab' but with 'enter' to accept + -- See the full "keymap" documentation for information on defining your own keymap. + keymap = { preset = 'super-tab' }, + + appearance = { + -- Sets the fallback highlight groups to nvim-cmp's highlight groups + -- Useful for when your theme doesn't support blink.cmp + -- Will be removed in a future release + use_nvim_cmp_as_default = true, + -- Set to 'mono' for 'Nerd Font Mono' or 'normal' for 'Nerd Font' + -- Adjusts spacing to ensure icons are aligned + nerd_font_variant = 'mono' + }, + + -- Default list of enabled providers defined so that you can extend it + -- elsewhere in your config, without redefining it, due to `opts_extend` + sources = { + default = { 'lsp', 'path', 'snippets', 'buffer' }, + }, + }, + opts_extend = { "sources.default" } + }, + { + "kylechui/nvim-surround", + version = "*", -- Use for stability; omit to use `main` branch for the latest features + event = "VeryLazy", + config = function() + require("nvim-surround").setup({ + -- Configuration here, or leave empty to use defaults + }) + end + }, + { + 'windwp/nvim-autopairs', + event = "InsertEnter", + config = true, + opts = { + enable_check_bracket_line = false + } + }, + { + "chentoast/marks.nvim", + event = "VeryLazy", + opts = {}, + }, + -- { + -- "chrisgrieser/nvim-spider", + -- keys = { + -- { "w", "<cmd>lua require('spider').motion('w')<CR>", mode = { "n", "o", "x" } }, + -- { "e", "<cmd>lua require('spider').motion('e')<CR>", mode = { "n", "o", "x" } }, + -- { "b", "<cmd>lua require('spider').motion('b')<CR>", mode = { "n", "o", "x" } }, + -- }, + -- }, + + -- tpope + { 'tpope/vim-commentary' }, -- toggle comments + { 'tpope/vim-fugitive' }, -- git plug-in + { 'tpope/vim-endwise' }, -- auto add endfunction/endif/etc + { 'tpope/vim-repeat' }, -- improves . command to repeat last command + { 'tpope/vim-sleuth' }, -- automatically changes indents to fit file type + { 'tpope/vim-unimpaired' }, -- change options with co or [o and ]o + { 'tpope/vim-rsi' }, -- readline in insert mode + { 'tpope/vim-eunuch' }, -- unix commands in vim + { 'tpope/vim-dispatch' }, -- asynchronous build + + -- Window + { + 'akinsho/toggleterm.nvim', version = "*", config = true, + opts = { + open_mapping = [[<c-_>]], + } + }, + -- { + -- 'nvim-telescope/telescope.nvim', tag = '0.1.8', + -- dependencies = { 'nvim-lua/plenary.nvim' } + -- }, + { + "ibhagwan/fzf-lua", + -- optional for icon support + dependencies = { "nvim-tree/nvim-web-devicons" }, + -- or if using mini.icons/mini.nvim + -- dependencies = { "echasnovski/mini.icons" }, + opts = {} + }, + -- { + -- "nvim-focus/focus.nvim", + -- version = false, + -- config = function() + -- require("focus").setup({ + -- excluded_buftypes = { "terminal" }, + -- }) + -- end, + -- }, + + -- Aesthetic + { 'nvim-tree/nvim-web-devicons' }, + { + 'lewis6991/gitsigns.nvim', + config = function() + require('gitsigns').setup{ + on_attach = function(bufnr) + local gitsigns = require('gitsigns') + local function map(mode, l, r, opts) + opts = opts or {} + opts.buffer = bufnr + vim.keymap.set(mode, l, r, opts) + end + -- Navigation + map('n', ']c', function() + if vim.wo.diff then + vim.cmd.normal({']c', bang = true}) + else + gitsigns.nav_hunk('next') + end + end) + map('n', '[c', function() + if vim.wo.diff then + vim.cmd.normal({'[c', bang = true}) + else + gitsigns.nav_hunk('prev') + end + end) + -- Actions + map('n', '<leader>hs', gitsigns.stage_hunk) + map('n', '<leader>hr', gitsigns.reset_hunk) + map('v', '<leader>hs', function() gitsigns.stage_hunk {vim.fn.line('.'), vim.fn.line('v')} end) + map('v', '<leader>hr', function() gitsigns.reset_hunk {vim.fn.line('.'), vim.fn.line('v')} end) + map('n', '<leader>hS', gitsigns.stage_buffer) + map('n', '<leader>hu', gitsigns.undo_stage_hunk) + -- map('n', '<leader>hR', gitsigns.reset_buffer) + map('n', '<leader>hp', gitsigns.preview_hunk) + map('n', '<leader>hb', function() gitsigns.blame_line{full=true} end) + -- map('n', '<leader>tb', gitsigns.toggle_current_line_blame) + map('n', '<leader>hd', gitsigns.diffthis) + map('n', '<leader>hD', function() gitsigns.diffthis('~') end) + -- map('n', '<leader>td', gitsigns.toggle_deleted) + -- Text object + map({'o', 'x'}, 'ih', ':<C-U>Gitsigns select_hunk<CR>') + end + } + end + }, + { + "folke/todo-comments.nvim", + dependencies = { "nvim-lua/plenary.nvim" }, + opts = { } + }, + + -- Language + { + "nvim-treesitter/nvim-treesitter", + build = function() + require("nvim-treesitter.install").update({ with_sync = true })() + end, + }, + { 'David-Kunz/treesitter-unit', + config = function() + vim.api.nvim_set_keymap('x', 'iu', ':lua require"treesitter-unit".select()<CR>', {noremap=true}) + vim.api.nvim_set_keymap('x', 'au', ':lua require"treesitter-unit".select(true)<CR>', {noremap=true}) + vim.api.nvim_set_keymap('o', 'iu', ':<c-u>lua require"treesitter-unit".select()<CR>', {noremap=true}) + vim.api.nvim_set_keymap('o', 'au', ':<c-u>lua require"treesitter-unit".select(true)<CR>', {noremap=true}) + end + }, + { + "tadmccorkle/markdown.nvim", + ft = "markdown", + opts = { + -- configuration here or empty for defaults + }, + }, + { 'eevolang/eevo.vim' }, + -- { "bullets-vim/bullets.vim" }, + -- { + -- "julienvincent/nvim-paredit", + -- config = function() + -- require("nvim-paredit").setup() + -- end + -- }, + { + 'nvim-orgmode/orgmode', + event = 'VeryLazy', + ft = { 'org' }, + config = function() + require('orgmode').setup({ + org_agenda_files = '~/stuff/notes/**/*', + org_default_notes_file = '~/stuff/notes/notes.org', + org_hide_emphasis_markers = true + }) + end + }, + { + 'akinsho/org-bullets.nvim', + config = function() + require("org-bullets").setup { + concealcursor = true, -- If false then when the cursor is on a line underlying characters are visible + symbols = { + list = "•", + headlines = { "◉", "○", "✸", "✿" }, + checkboxes = { + half = { "-", "@org.checkbox.halfchecked" }, + done = { "✓", "@org.keyword.done" }, + todo = { " ", "@org.keyword.todo" }, + }, + } + } + end + }, + -- { + -- "nvim-orgmode/telescope-orgmode.nvim", + -- event = "VeryLazy", + -- dependencies = { "nvim-orgmode/orgmode", "nvim-telescope/telescope.nvim", }, + -- config = function() + -- require("telescope").load_extension("orgmode") + -- vim.keymap.set("n", "<leader>r", require("telescope").extensions.orgmode.refile_heading) + -- vim.keymap.set("n", "<leader>h", require("telescope").extensions.orgmode.search_headings) + -- vim.keymap.set("n", "<leader>l", require("telescope").extensions.orgmode.insert_link) + -- end, + -- }, + -- { 'vim-scripts/a.vim'}, + { + "lervag/vimtex", + lazy = false, -- we don't want to lazy load VimTeX + init = function() + -- VimTeX configuration goes here, e.g. + vim.g.vimtex_view_method = "zathura" + end + }, + { + 'neovim/nvim-lspconfig' + }, + { + 'ludovicchabant/vim-gutentags', + }, +} diff --git a/config/nvim/vimrc.vim b/config/nvim/vimrc.vim @@ -0,0 +1,180 @@ +" basic{{{1 +syntax on +set autoindent " I hope you know what this does +set autowrite " automatically write before running commands that need it to be written +set nohlsearch " turn off highlighting of searches +set ignorecase " make search non case sensitive +set incsearch " show the search result before you finish typing +set noshowmode " turn off '--INSERT--' at bottom of screen +set nowrap " do not wrap text to newline when it gets to the end of the screen +set shiftround " make indents always be at a multiple of the tab width +set showcmd " show normal mode commands that you are typing +set nocursorline +set showmatch " when a bracket is inserted, briefly highlight the matching one. +set smartcase " allow you to search with more charters +set hidden " keep buffers loaded when not visible +set splitbelow " create new splits under current window +set splitright " create new vertical splits to the right +set timeout " set timeout for mappings +set notitle " stop Vim from setting the terminal's title +set ttyfast " makes Vim faster +set novisualbell " disable screen flashes for error +set backspace=2 " turn on backspace +set completeopt-=preview " disable pop-up when using Neocomplete +" set cryptmethod=blowfish " change the way Vim encrypts files to blowfish from zip +set formatoptions+=w " when text get over the number set by `set textwidth`, wrap it to next line +set foldmethod=marker " set the folding method to use three { to start and three } to end +set laststatus=2 " always turn on status line +set modelines=5 " number of lines down Vim checks for set commands +set mouse=a " turn on the mouse +set nrformats=octal,hex,alpha " allow you to ctrl-a/ctrl-x to increase/decrease letters and numbers +set scrolloff=7 " make Vim have 7 lines below cursor when moving down +set t_ut= " needed if using Vim inside of tmux +set textwidth=98 " wrap lines which exceed 100 charters long +set ttimeoutlen=50 " change wait time for `timeout` +set spell spelllang=en_us " set language for spell check to United States +set clipboard=unnamedplus " Vim yanks go to OS's clipboard as well + " remove 'plus' if not on Linux + +" set up menu stuff +set wildmenu +set wildmode=list,longest,full + +" make line numbers go 1,2,3,4... +set number +" make the line your cursor is on 0 +" set relativenumber + +" extra chars like the end of line one and when text raps to next line +set list +set listchars=tab:\|\ ,eol:¬,extends:❯,precedes:❮ + +" make Vim's clipboard the same as OS's clipboard +let g:clipbrdDefaultReg = '+' + +if has("autocmd") + " make Vim save every time it leaves insert mode + autocmd InsertLeave * if &mod && expand('%')!=''|write|endif + + " save line number line when reopening file + autocmd BufReadPost * if line("'\"") > 1 && line("'\"") <= line("$") | exe "normal! g'\"" | endif + " don't for git commit file + autocmd FileType gitcommit normal gg + + " remove trailing whitespace + autocmd BufWritePre * %s/\s\+$//e +endif + +" highlighting{{{1 +colorscheme zim + +" highlight the 100th column so you know when your line is to long +call matchadd('Error', '\%100v', 100) + +au BufRead,BufNewFile *.md set filetype=markdown +au BufRead,BufNewFile *bash_profile* set filetype=sh +au BufRead,BufNewFile *tmux.conf* set filetype=sh +au BufRead,BufNewFile *conkyrc* set filetype=sh +au BufRead,BufNewFile *gitconfig* set filetype=gitconfig +au BufRead,BufNewFile TODO set filetype=markdown + +" spell check +hi SpellBad ctermfg=red cterm=underline +if version >= 700 + set spl=en spell + set nospell +endif + +" fix highlighting of special symbols +function! C_Syntax() + syntax match _Operator "[-+&|<>=!\*~.,:%&^?]" + syntax match _Operator "/ \|/=" + syntax match _Semicolon "[;]" + hi link _Operator Operator + hi _Semicolon ctermfg=red + set sw=8 + set ts=8 + set noexpandtab +endfunction +autocmd! BufRead,BufNewFile,BufEnter *.{c,cpp,h,hpp,} call C_Syntax() + +" status line{{{1 +function! InsertStatuslineColor(mode) + if a:mode == 'i' + hi statusline ctermfg=4 ctermbg=15 + hi SLgreen ctermfg=0 ctermbg=4 + hi SLblue ctermfg=0 ctermbg=4 + hi SLcyan ctermfg=0 ctermbg=4 + elseif a:mode == 'r' + hi statusline ctermfg=9 ctermbg=15 + hi SLgreen ctermfg=0 ctermbg=9 + hi SLblue ctermfg=0 ctermbg=9 + hi SLcyan ctermfg=0 ctermbg=9 + else + hi statusline ctermfg=0 ctermbg=15 + endif +endfunction + +au InsertEnter * call InsertStatuslineColor(v:insertmode) +au InsertLeave * hi statusline ctermfg=0 ctermbg=15 +au InsertLeave * hi SLgreen ctermfg=2 ctermbg=0 +au InsertLeave * hi SLblue ctermfg=4 ctermbg=0 +au InsertLeave * hi SLcyan ctermfg=6 ctermbg=0 + +hi statusline ctermfg=0 ctermbg=15 +hi SLgreen ctermfg=2 ctermbg=0 +hi SLblue ctermfg=4 ctermbg=0 +hi SLcyan ctermfg=6 ctermbg=0 + +set statusline=%#SLblue#%f " file name +set statusline+=%#SLgreen#\ %Y " filetype +set statusline+=%#SLcyan#\ %M " modified flag +" set statusline+=\ %{g:Catium()} + +set statusline+=\ %= " move to right side + +set statusline+=%#SLcyan#%p%% " percent of file +set statusline+=%#SLgreen#\ %v " column +set statusline+=%#SLblue#\ %l/%L " current line/total lines +" set statusline+=%#ErrorMsg#%{SyntasticStatuslineFlag()} " Syntastic Error + +" mapping{{{1 +" make jj typed quickly while in insert mode switch to normal mode :D +inoremap jj <Esc> + +" make ctrl+c completely like ESC +inoremap <C-c> <Esc><Esc> + +" extend ESC to also clear search highlight +nnoremap <silent> <ESC> :noh<CR> +nnoremap <ESC>[ <ESC>[ + +" ZZ is save and quit and ZQ is just quit, so... +" make ZS to save without closing +nnoremap ZS :w<CR> +" make ZA save and quit all windows +nnoremap ZA :wqall<CR> + +" C changes until end of line and D deletes until end of line, so why not Y? +noremap Y y$ + +" repeat colon commands +nnoremap Q :<Up><CR> + +" keep selected area when indenting +vnoremap > >gv +vnoremap < <gv + +" easily change buffers +nnoremap <C-H> :bprev<CR> +nnoremap <C-L> :bnext<CR> + +" improve up and down shortcuts +nnoremap <C-J> <C-D> +nnoremap <C-K> <C-U> + +nnoremap <silent> <leader>m :silent! make<CR> +nnoremap <silent> <leader>c :!ctags -R .<CR> + +" auto complete C comments +inoremap /* /* */<Left><Left><Left> diff --git a/nvimrc b/nvimrc @@ -1,122 +0,0 @@ -" basic{{{1 -syntax on -set autoindent " I hope you know what this does -set autowrite " automatically write before running commands that need it to be written -set hlsearch " turn on highlighting of searches -set ignorecase " make search non case sensitive -set incsearch " show the search result before you finish typing -set noshowmode " turn off "--INSERT--" at bottom of screen -set nowrap " change what happens when you get to edge of screen. -set shiftround " make indents always be at a multiple of the tab width -set showcmd " show commands that you are typing -set showmatch " when a bracket is inserted, briefly jump to the matching one. -set smartcase " allow you to search with more charters -set timeout " set timeout for mappings -set notitle " turn off the Vim title at the top of the window -set ttyfast " makes Vim faster -set visualbell " use visual bell instead of beeping -set backspace=2 " turn on backspace -set completeopt-=preview " disable pop-up when using Neocomplete -set formatoptions+=w " when text get over the number set by `set textwidth`, wrap it to next line -set foldmethod=marker " set the folding method to use three { to start and three } to end -set laststatus=2 " always turn on status line -set modelines=5 " number of lines down Vim checks for set commands -set mouse=a " turn on the mouse -set nrformats=octal,hex,alpha " allow you to ctrl-a/ctrl-x to increase/decrease letters and numbers -set scrolloff=7 " make Vim have 7 lines below cursor when moving down -set t_ut= " needed if using Vim inside of tmux -set textwidth=79 " set what line to wrap charters at. -set ttimeoutlen=50 " change wait time for `timeout` -set clipboard=unnamedplus " Vim yanks go to OS's clipboard as well -" remove "plus" if not on Linux - -" set up menu stuff -set wildmenu -set wildmode=list,longest,full - -" make line numbers go 1,2,3,4... -set number -" make the line your cursor is on 0 -" set relativenumber - -" extra chars like the end of line one and when text raps to next line -set list -set listchars=tab:\|\ ,eol:¬,extends:❯,precedes:❮ - -" make Vim's clipboard the same as OS's clipboard -let g:clipbrdDefaultReg = '+' - -" make Vim save every time it leaves insert mode -au InsertLeave * if &mod && expand('%')!=''|write|endif - -" save line number line when reopening file -if has("autocmd") - au BufReadPost * if line("'\"") > 1 && line("'\"") <= line("$") | exe "normal! g'\"" | endif -endif - -" highlighting{{{1 -" highlight the 81st column so you know when your line is to long -call matchadd('Error', '\%81v', 100) - -au BufRead,BufNewFile *.md set filetype=markdown -au BufRead,BufNewFile *bash_profile* set filetype=sh -au BufRead,BufNewFile *tmux.conf* set filetype=sh -au BufRead,BufNewFile *conkyrc* set filetype=sh -au BufRead,BufNewFile *gitconfig* set filetype=gitconfig - -" spell check -hi SpellBad ctermfg=red cterm=underline -if version >= 700 - set spl=en spell - set nospell -endif - -" mapping{{{1 -" make jj typed quickly while in insert mode switch to normal mode :D -inoremap jj <Esc> - -" ZZ is save and quit and ZQ is just quit, so... -" make ZS to save without closing -nnoremap ZS :w<CR> -" make ZA save and quit all windows -nnoremap ZA :wqall<CR> - -" C changes until end of line and D deletes until end of line, so why not Y? -noremap Y y$ - -" better indenting for visual mode -vnoremap > >gv -vnoremap < <gv - -" easily change buffers -nnoremap <C-H> :bprev<CR> -nnoremap <C-L> :bnext<CR> - -" improve up and down shortcuts -nnoremap <C-J> <C-D> -nnoremap <C-K> <C-U> - -" pair completion -inoremap { {}<Left> -inoremap {<CR> {<CR>}<Esc>O -inoremap {<Space> {<Space><Space>}<Left><Left> -inoremap {{ { -inoremap {} {} - -inoremap ( ()<Left> -inoremap (<CR> (<CR>)<Esc>O -inoremap (<Space> (<Space><Space>)<Left><Left> -inoremap (( ( -inoremap () () - -inoremap [ []<Left> -inoremap [<CR> [<CR>]<Esc>O -inoremap [<Space> [<Space><Space>]<Left><Left> -inoremap [[ [ -inoremap [] [] - -inoremap <> <><Left> -inoremap "" ""<Left> -inoremap '' ''<Left> -inoremap `` ``<Left> -