aboutsummaryrefslogtreecommitdiff
path: root/config/nvim
diff options
context:
space:
mode:
authorJacob Janzen <jjanzenn@proton.me>2024-08-07 22:34:10 -0500
committerJacob Janzen <jjanzenn@proton.me>2024-08-07 22:34:10 -0500
commit3832e2c085e5137f78cdf5f0c1e9cf273ffbc338 (patch)
treea2bd6bd1119aacbaa23ede55ad3ff1c46a76ea57 /config/nvim
parent05a87bb0eb20345694a09c9e5e5930028c0c0339 (diff)
complete my configuration migration
Diffstat (limited to 'config/nvim')
-rw-r--r--config/nvim/index.org9
-rw-r--r--config/nvim/init.org33
-rw-r--r--config/nvim/lua/appearance.org6
-rw-r--r--config/nvim/lua/autocomplete.org57
-rw-r--r--config/nvim/lua/behaviour.org6
-rw-r--r--config/nvim/lua/format.org25
-rw-r--r--config/nvim/lua/index.org11
-rw-r--r--config/nvim/lua/languageServers.org92
-rw-r--r--config/nvim/lua/plugins.org43
9 files changed, 46 insertions, 236 deletions
diff --git a/config/nvim/index.org b/config/nvim/index.org
new file mode 100644
index 0000000..38d0daa
--- /dev/null
+++ b/config/nvim/index.org
@@ -0,0 +1,9 @@
+#+title: Dotfiles =/.config/nvim=
+This is my Neovim configuration. The entry point for the program is [[./init.org][init.lua]].
+
+* Directories
+- [[../index.org][../]]
+- [[./lua/index.org][lua/]]
+
+* Files
+- [[./init.org][init.lua]]
diff --git a/config/nvim/init.org b/config/nvim/init.org
index 703e8e2..9c15739 100644
--- a/config/nvim/init.org
+++ b/config/nvim/init.org
@@ -1,37 +1,22 @@
#+title: Neovim Settings
-This is the entry point for my Neovim configuration.
+This is the entry point for my Neovim configuration. I don't use Neovim much these days, so it is very stripped back from what it once was. Emacs is much comfier for most uses, so Neovim is mostly relegated to editing system configuration files.
Disable timeout to speed things up.
-#+begin_src lua :tangle yes
-vim.cmd([[set notimeout]])
+#+begin_src lua :tangle ~/.config/nvim/init.lua :mkdirp yes
+ vim.cmd([[set notimeout]])
#+end_src
Install plugins in the [[./lua/plugins.org][plugins.lua]] file.
-#+begin_src lua :tangle yes
-require('plugins')
+#+begin_src lua :tangle ~/.config/nvim/init.lua :mkdirp yes
+ require('plugins')
#+end_src
Set up behaviour in the [[./lua/behaviour.org][behaviour.lua]] file.
-#+begin_src lua :tangle yes
-require('behaviour')
+#+begin_src lua :tangle ~/.config/nvim/init.lua :mkdirp yes
+ require('behaviour')
#+end_src
Set up appearance in the [[./lua/appearance.org][appearance.lua]] file.
-#+begin_src lua :tangle yes
-require('appearance')
-#+end_src
-
-Set up formatting options in the [[./lua/format.org][format.lua]] file.
-#+begin_src lua :tangle yes
-require('format')
-#+end_src
-
-Set up language servers in the [[./lua/languageServers.org][languageServers.lua]] file.
-#+begin_src lua :tangle yes
-require('languageServers')
-#+end_src
-
-Set up auto-complete in the [[./lua/autocomplete.org][autocomplete.lua]] file.
-#+begin_src lua :tangle yes
-require('autocomplete')
+#+begin_src lua :tangle ~/.config/nvim/init.lua :mkdirp yes
+ require('appearance')
#+end_src
diff --git a/config/nvim/lua/appearance.org b/config/nvim/lua/appearance.org
index 6cbf4ba..946d420 100644
--- a/config/nvim/lua/appearance.org
+++ b/config/nvim/lua/appearance.org
@@ -1,11 +1,11 @@
#+title: Neovim Appearance Settings
Use line numbers.
-#+begin_src lua :tangle yes
+#+begin_src lua :tangle ~/.config/nvim/lua/appearance.lua :mkdirp yes
vim.opt.number = true
#+end_src
-Set colour scheme.
-#+begin_src lua :tangle yes
+Set colour scheme to the Ayu light theme.
+#+begin_src lua :tangle ~/.config/nvim/lua/appearance.lua :mkdirp yes
vim.cmd([[
set termguicolors
let ayucolor="light"
diff --git a/config/nvim/lua/autocomplete.org b/config/nvim/lua/autocomplete.org
deleted file mode 100644
index 505e93c..0000000
--- a/config/nvim/lua/autocomplete.org
+++ /dev/null
@@ -1,57 +0,0 @@
-#+title: Neovim Auto-complete Settings
-Set up auto-completion with LSP.
-#+begin_src lua :tangle yes
- local capabilities = require("cmp_nvim_lsp").default_capabilities()
-
- local lspconfig = require('lspconfig')
-
- local servers = { 'clangd', 'rust_analyzer', 'pyright', 'tsserver' }
- for _, lsp in ipairs(servers) do
- lspconfig[lsp].setup {
- -- on_attach = my_custom_on_attach,
- capabilities = capabilities,
- }
- end
-
- local luasnip = require 'luasnip'
-
- local cmp = require 'cmp'
- cmp.setup {
- snippet = {
- expand = function(args)
- luasnip.lsp_expand(args.body)
- end,
- },
- mapping = cmp.mapping.preset.insert({
- ['<C-d>'] = cmp.mapping.scroll_docs(-4),
- ['<C-f>'] = cmp.mapping.scroll_docs(4),
- ['<C-Space>'] = cmp.mapping.complete(),
- ['<CR>'] = cmp.mapping.confirm {
- behavior = cmp.ConfirmBehavior.Replace,
- select = true,
- },
- ['<Tab>'] = cmp.mapping(function(fallback)
- if cmp.visible() then
- cmp.select_next_item()
- elseif luasnip.expand_or_jumpable() then
- luasnip.expand_or_jump()
- else
- fallback()
- end
- end, { 'i', 's' }),
- ['<S-Tab>'] = cmp.mapping(function(fallback)
- if cmp.visible() then
- cmp.select_prev_item()
- elseif luasnip.jumpable(-1) then
- luasnip.jump(-1)
- else
- fallback()
- end
- end, { 'i', 's' }),
- }),
- sources = {
- { name = 'nvim_lsp' },
- { name = 'luasnip' },
- },
- }
-#+end_src
diff --git a/config/nvim/lua/behaviour.org b/config/nvim/lua/behaviour.org
index d843d7b..871b65e 100644
--- a/config/nvim/lua/behaviour.org
+++ b/config/nvim/lua/behaviour.org
@@ -1,7 +1,7 @@
#+title: Neovim Behaviour Settings
Use tabs with width 4.
-#+begin_src lua :tangle yes
+#+begin_src lua :tangle ~/.config/nvim/lua/behaviour.lua :mkdirp yes
vim.opt.tabstop = 4
vim.opt.expandtab = true
vim.opt.shiftwidth = 4
@@ -9,11 +9,11 @@ Use tabs with width 4.
#+end_src
Better command line completion.
-#+begin_src lua :tangle yes
+#+begin_src lua :tangle ~/.config/nvim/lua/behaviour.lua :mkdirp yes
vim.opt.wildmode = 'longest,list'
#+end_src
Better management of file types.
-#+begin_src lua :tangle yes
+#+begin_src lua :tangle ~/.config/nvim/lua/behaviour.lua :mkdirp yes
vim.cmd('filetype plugin indent on')
#+end_src
diff --git a/config/nvim/lua/format.org b/config/nvim/lua/format.org
deleted file mode 100644
index 5b362d0..0000000
--- a/config/nvim/lua/format.org
+++ /dev/null
@@ -1,25 +0,0 @@
-#+title: Neovim Formatting Settings
-Turn on =clang-format= in C, CUDA, C++, C#, Java, JavaScript, and JSON.
-#+begin_src lua :tangle yes
- vim.cmd([[
- let g:clang_format#code_style = 'file'
- autocmd FileType c ClangFormatAutoEnable
- autocmd FileType cuda ClangFormatAutoEnable
- autocmd FileType cpp ClangFormatAutoEnable
- autocmd FileType cs ClangFormatAutoEnable
- autocmd FileType java ClangFormatAutoEnable
- autocmd FileType javascript ClangFormatAutoEnable
- autocmd FileType json ClangFormatAutoEnable
- let g:vimtex_view_method = 'skim'
- ]])
-#+end_src
-
-Auto-format Rust on save.
-#+begin_src lua :tangle yes
- vim.g.rustfmt_autosave = 1
-#+end_src
-
-Start making a table by placing a =|=.
-#+begin_src lua :tangle yes
- vim.g.table_mode_corner = '|'
-#+end_src
diff --git a/config/nvim/lua/index.org b/config/nvim/lua/index.org
new file mode 100644
index 0000000..4af8e20
--- /dev/null
+++ b/config/nvim/lua/index.org
@@ -0,0 +1,11 @@
+#+title: Dotfiles =/.config/nvim/lua=
+
+This is where the modular components of my Neovim configuration are stored.
+
+* Directories
+- [[../index.org][../]]
+
+* Files
+- [[./appearance.org][appearance.lua]]
+- [[./behaviour.org][behaviour.lua]]
+- [[./plugins.org][plugins.lua]]
diff --git a/config/nvim/lua/languageServers.org b/config/nvim/lua/languageServers.org
deleted file mode 100644
index 8861ace..0000000
--- a/config/nvim/lua/languageServers.org
+++ /dev/null
@@ -1,92 +0,0 @@
-#+title: Neovim Language Server Configuration
-* Keybindings
-Set keys for LSP auto-completion.
-#+begin_src lua :tangle yes
- vim.keymap.set('n', '<space>e', vim.diagnostic.open_float, opts)
- vim.keymap.set('n', '[d', vim.diagnostic.goto_prev, opts)
- vim.keymap.set('n', ']d', vim.diagnostic.goto_next, opts)
- vim.keymap.set('n', '<space>q', vim.diagnostic.setloclist, opts)
-
- -- Use an on_attach function to only map the following keys
- -- after the language server attaches to the current buffer
- local on_attach = function(client, bufnr)
- -- Enable completion triggered by <c-x><c-o>
- vim.api.nvim_buf_set_option(bufnr, 'omnifunc', 'v:lua.vim.lsp.omnifunc')
-
- local bufopts = { noremap=true, silent=true, buffer=bufnr }
- vim.keymap.set('n', 'gD', vim.lsp.buf.declaration, bufopts)
- vim.keymap.set('n', 'gd', vim.lsp.buf.definition, bufopts)
- vim.keymap.set('n', 'K', vim.lsp.buf.hover, bufopts)
- vim.keymap.set('n', 'gi', vim.lsp.buf.implementation, bufopts)
- vim.keymap.set('n', '<C-k>', vim.lsp.buf.signature_help, bufopts)
- vim.keymap.set('n', '<space>wa', vim.lsp.buf.add_workspace_folder, bufopts)
- vim.keymap.set('n', '<space>wr', vim.lsp.buf.remove_workspace_folder, bufopts)
- vim.keymap.set('n', '<space>wl', function()
- print(vim.inspect(vim.lsp.buf.list_workspace_folders()))
- end, bufopts)
- vim.keymap.set('n', '<space>D', vim.lsp.buf.type_definition, bufopts)
- vim.keymap.set('n', '<space>rn', vim.lsp.buf.rename, bufopts)
- vim.keymap.set('n', '<space>ca', vim.lsp.buf.code_action, bufopts)
- vim.keymap.set('n', 'gr', vim.lsp.buf.references, bufopts)
- vim.keymap.set('n', '<space>f', function() vim.lsp.buf.format { async = true } end, bufopts)
- end
-#+end_src
-
-* Languages
-Turn on LSP for various languages.
-#+begin_src lua :tangle yes
- require('lspconfig')['awk_ls'].setup{
- on_attach = on_attach,
- flags = lsp_flags,
- }
-
- require('lspconfig')['bashls'].setup{
- on_attach = on_attach,
- flags = lsp_flags,
- }
-
- require('lspconfig')['fortls'].setup{
- on_attach = on_attach,
- flags = lsp_flags,
- }
-
- require('lspconfig')['hls'].setup{
- on_attach = on_attach,
- flags = lsp_flags
- }
-
- require('lspconfig')['pyright'].setup{
- on_attach = on_attach,
- flags = lsp_flags,
- }
-
- require('lspconfig')['tsserver'].setup{
- on_attach = on_attach,
- flags = lsp_flags,
- }
-
- require('lspconfig')['rust_analyzer'].setup{
- on_attach = on_attach,
- flags = lsp_flags,
- settings = {
- ["rust-analyzer"] = {}
- }
- }
-
- require('lspconfig')['gopls'].setup{
- on_attach = on_attach,
- flags = lsp_flags
- }
-
- require('lspconfig')['clangd'].setup{
- on_attach = on_attach,
- flags = lsp_flags
- }
-
- require('lspconfig')['texlab'].setup{
- on_attach = on_attach,
- flags = lsp_flags
- }
-
- require('lspconfig')['perlpls'].setup{}
-#+end_src
diff --git a/config/nvim/lua/plugins.org b/config/nvim/lua/plugins.org
index 0dab41b..2093a53 100644
--- a/config/nvim/lua/plugins.org
+++ b/config/nvim/lua/plugins.org
@@ -1,7 +1,7 @@
#+title: Neovim Plugins
* Setup
-Use =lazy= to manage plugins.
-#+begin_src lua :tangle yes
+Use =lazy= to manage plugins. This block activates =lazy=.
+#+begin_src lua :tangle ~/.config/nvim/lua/plugins.lua :mkdirp yes
local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim"
if not vim.loop.fs_stat(lazypath) then
vim.fn.system({
@@ -9,7 +9,7 @@ Use =lazy= to manage plugins.
"clone",
"--filter=blob:none",
"https://github.com/folke/lazy.nvim.git",
- "--branch=stable", -- latest stable release
+ "--branch=stable",
lazypath,
})
end
@@ -17,33 +17,12 @@ Use =lazy= to manage plugins.
#+end_src
* Plugins
-Install plugins here.
-#+begin_src lua :tangle yes
-require('lazy').setup({
- 'itchyny/lightline.vim',
- 'ayu-theme/ayu-vim',
- 'Raimondi/delimitMate',
- 'bronson/vim-trailing-whitespace',
- 'dhruvasagar/vim-table-mode',
- 'rhysd/vim-clang-format',
- 'chrisbra/csv.vim',
- 'neovim/nvim-lspconfig',
- {
- 'nvim-treesitter/nvim-treesitter',
- cmd = 'TSUpdate'
- },
- 'junegunn/fzf',
- 'junegunn/fzf.vim',
- 'hrsh7th/nvim-cmp',
- 'hrsh7th/cmp-nvim-lsp',
- 'saadparwaiz1/cmp_luasnip',
- 'L3MON4D3/LuaSnip',
- {
- 'fatih/vim-go',
- cmd = 'GoUpdateBinaries',
- },
- 'rust-lang/rust.vim',
- 'neovimhaskell/haskell-vim',
- 'lervag/vimtex',
-})
+I use =lightline= for a nice status bar. The Ayu theme matches my overall colour scheme. =delimitmate= provides better delimiter handling. Trailing whitespace is highlighted with =vim-trailing-whitespace=.
+#+begin_src lua :tangle ~/.config/nvim/lua/plugins.lua :mkdirp yes
+ require('lazy').setup({
+ 'itchyny/lightline.vim',
+ 'ayu-theme/ayu-vim',
+ 'Raimondi/delimitMate',
+ 'bronson/vim-trailing-whitespace',
+ })
#+end_src