Massive rewrite and modularization of the existing neovim config to
break it up into multiple files and to use a maintained package manager (lazy.nvim)
This commit is contained in:
parent
3f281df6df
commit
487f874984
562
init.lua
562
init.lua
@ -42,559 +42,9 @@
|
||||
--
|
||||
-- Created: 7/2/2012
|
||||
|
||||
-- Custom Functions
|
||||
-- 'softrequire' provides a wrapper around the builtin require. If the require has failed in a `local mod = softrequire('m') call, a quick check of
|
||||
-- 'if mod then' can wrap code dependent upon the require, and fails gracefully
|
||||
local function softrequire(m)
|
||||
local ok, err = pcall(require, m)
|
||||
if not ok then return nil, err end
|
||||
return err
|
||||
end
|
||||
|
||||
local function execute(type)
|
||||
local command_table = {
|
||||
run = {
|
||||
java = "java %",
|
||||
python = "python %",
|
||||
rust = "cargo run",
|
||||
},
|
||||
test = {
|
||||
python = "python test",
|
||||
rust = "cargo test",
|
||||
},
|
||||
benchmark = {
|
||||
rust = "cargo bench",
|
||||
},
|
||||
}
|
||||
vim.api.nvim_command('write')
|
||||
local command = command_table[type][vim.bo.filetype]
|
||||
|
||||
if command ~= nil then
|
||||
vim.cmd('FloatermNew --autoclose=0 ' .. command)
|
||||
end
|
||||
end
|
||||
|
||||
-- Force install Packer if it is not found locally
|
||||
local packer_need_bootstrap = false
|
||||
local install_path = vim.fn.stdpath('data') .. '/site/pack/packer/start/packer.nvim'
|
||||
if vim.fn.empty(vim.fn.glob(install_path)) > 0 then
|
||||
vim.fn.system({ 'git', 'clone', '--depth', '1', 'https://github.com/wbthomason/packer.nvim', install_path })
|
||||
vim.cmd [[packadd packer.nvim]]
|
||||
packer_need_bootstrap = true
|
||||
end
|
||||
|
||||
-- Manage plugins
|
||||
require('packer').startup(function(use)
|
||||
use 'wbthomason/packer.nvim' -- Packer self management
|
||||
|
||||
-- Completion, linting, search
|
||||
use 'neovim/nvim-lspconfig' -- Adds native support for language servers and autocompletion
|
||||
|
||||
use {
|
||||
'williamboman/mason.nvim', -- Installer for LSPs, DAP, linters, etc
|
||||
run = ':MasonUpdate',
|
||||
}
|
||||
use 'williamboman/mason-lspconfig.nvim' -- Bridges the gap between lspconfig and mason
|
||||
|
||||
use {
|
||||
'nvim-telescope/telescope.nvim', -- Popup, quick search plugin for looking up files, files content, loading a filebrowser, etc
|
||||
requires = {
|
||||
{ 'nvim-lua/plenary.nvim' }
|
||||
}
|
||||
}
|
||||
|
||||
use {
|
||||
'nvim-treesitter/nvim-treesitter', -- Support for syntax highlighting (and other bits)
|
||||
run = ':TSUpdate'
|
||||
}
|
||||
|
||||
use 'tpope/vim-surround' -- Change surrounding characters '{},[],quotes,etc'
|
||||
use 'numToStr/Comment.nvim' -- Fancy commenting plugin
|
||||
|
||||
-- Completion support
|
||||
use 'hrsh7th/cmp-nvim-lsp' -- Completion source for nvim-cmp: LSPs
|
||||
use 'hrsh7th/cmp-buffer' -- Completion source for nvim-cmp: buffer
|
||||
use 'hrsh7th/cmp-path' -- Completion source for nvim-cmp: path
|
||||
use 'hrsh7th/cmp-cmdline' -- Completion source for nvim-cmp: vim's cmdline
|
||||
use 'hrsh7th/nvim-cmp' -- Completion engine for neovim
|
||||
|
||||
-- Snippets
|
||||
use 'L3MON4D3/LuaSnip' -- Snippet engine written in Lua!
|
||||
use 'saadparwaiz1/cmp_luasnip' -- Necessary plugin to load luasnips into nvim-cmp
|
||||
use 'rafamadriz/friendly-snippets' -- Snippets!
|
||||
|
||||
-- Theming
|
||||
use {
|
||||
'ellisonleao/gruvbox.nvim', -- Color Scheme
|
||||
config = function()
|
||||
require('gruvbox').setup({
|
||||
contrast = 'hard',
|
||||
})
|
||||
vim.cmd('colorscheme gruvbox')
|
||||
end
|
||||
}
|
||||
|
||||
use {
|
||||
'nvim-lualine/lualine.nvim', -- Very quick and useful statusline setup
|
||||
requires = {
|
||||
{ 'kyazdani42/nvim-web-devicons', opt = true }
|
||||
},
|
||||
}
|
||||
|
||||
-- Git
|
||||
use 'airblade/vim-gitgutter' -- Show git diffs in the symbol gutter
|
||||
use 'tpope/vim-fugitive' -- Git integration
|
||||
|
||||
-- Utility
|
||||
use 'voldikss/vim-floaterm' -- Floating terminal enabling working in the cli without adjusting window layout
|
||||
use 'renerocksai/telekasten.nvim' -- Note taking helper with daily/weekly notes
|
||||
|
||||
-- Experimental
|
||||
use {
|
||||
'habamax/vim-godot',
|
||||
ft = { 'gdscript' }
|
||||
}
|
||||
use 'mfussenegger/nvim-dap'
|
||||
use 'rcarriga/nvim-dap-ui'
|
||||
|
||||
-- Automatically set up your configuration after cloning packer.nvim
|
||||
if packer_need_bootstrap then
|
||||
require('packer').sync()
|
||||
end
|
||||
end)
|
||||
|
||||
-- Load plugin modules with a softfail option
|
||||
local cmp = softrequire('cmp')
|
||||
local comment = softrequire('Comment')
|
||||
local dap = softrequire('dap')
|
||||
local lualine = softrequire('lualine')
|
||||
local luasnip = softrequire('luasnip')
|
||||
local mason = softrequire('mason')
|
||||
local mason_lspconfig = softrequire('mason-lspconfig')
|
||||
local nvim_lsp = softrequire('lspconfig')
|
||||
local telekasten = softrequire('telekasten')
|
||||
local telescope = softrequire('telescope')
|
||||
local telescope_builtin = softrequire('telescope.builtin')
|
||||
local treesitter_configs = softrequire('nvim-treesitter.configs')
|
||||
|
||||
-- NEOVIM SETTINGS
|
||||
vim.opt.background = 'dark' -- Force a dark background for the colorscheme
|
||||
vim.opt.clipboard = "unnamed,unnamedplus" -- Use both the "*" and "+" registers for yanks and deletes (puts things in the system clipboard)
|
||||
vim.opt.colorcolumn = '121' -- Highlight column to show
|
||||
vim.opt.completeopt = 'menu,menuone,noinsert' -- Change how the completion menu is interacted with
|
||||
vim.opt.cursorline = true -- Highlight the line the cursor is on.
|
||||
vim.opt.expandtab = true -- Expand tabs into spaces
|
||||
vim.opt.fileformat = 'unix' -- Explicitly state that files should use the unix style EOL characters.
|
||||
vim.opt.fillchars = 'fold: ' -- Sets the character that fills in a fold line
|
||||
vim.opt.foldexpr = 'nvim_treesitter#foldexpr()' -- Uses Treesitter to determine where code folding should occur
|
||||
vim.opt.foldlevel = 10 -- Sets the initial level at which folds will be closed
|
||||
vim.opt.foldmethod = 'expr' -- Attempt to use the syntax of a file to set folds.
|
||||
vim.opt.formatoptions = 'cqrto' -- Allow auto insertion of comment lines when using o or O on a comment.
|
||||
vim.opt.list = true -- Show the listchars
|
||||
vim.opt.listchars = 'tab:|·,trail:¬,extends:>,precedes:<,nbsp:+' -- Characters to display when showing whitespace
|
||||
vim.opt.mouse = 'a' -- Enable mouse mode
|
||||
vim.opt.number = true -- Show the line number in the gutter.
|
||||
vim.opt.relativenumber = true -- Relative line number
|
||||
vim.opt.shiftround = true -- Round indentation to shiftwidth
|
||||
vim.opt.shiftwidth = 4 -- Number of spaces a tab counts for when converting tabs to spaces
|
||||
vim.opt.shortmess = 'at' -- Abbreviations and truncation of cmd messages
|
||||
vim.opt.showmatch = true -- Show matching bracket
|
||||
vim.opt.signcolumn = 'yes' -- Always show the gutter
|
||||
vim.opt.smartindent = true -- Attempt to insert indentation to fit traditional languages.
|
||||
vim.opt.softtabstop = 4 -- Number of spaces a tab counts for when converting tabs to spaces
|
||||
vim.opt.splitbelow = true -- Split windows below when horizontal splitting
|
||||
vim.opt.splitright = true -- Split windows right when vertical splitting
|
||||
vim.opt.swapfile = false -- Disable the creation of swap files for open files
|
||||
vim.opt.tabstop = 4 -- Setting the value of spaces per tab
|
||||
vim.opt.termguicolors = true -- Enable the truecolor GUI colors in a terminal
|
||||
vim.opt.undodir = os.getenv('HOME') .. '/.config/nvim/undodir' -- Set a specific undo file directory
|
||||
vim.opt.undofile = true -- Enable undo files
|
||||
vim.opt.updatetime = 50 -- Update time in milliseconds
|
||||
vim.opt.wrap = false -- Do _not_ wrap lines
|
||||
|
||||
-- KEYBOARD SHORTCUTS
|
||||
vim.g.mapleader = ','
|
||||
|
||||
local keymap = vim.keymap.set
|
||||
|
||||
-- Standard keybinding options
|
||||
local options = { noremap = true }
|
||||
|
||||
-- Block tab/untab without leaving visual mode
|
||||
keymap('v', '<', '<gv', options)
|
||||
keymap('v', '>', '>gv', options)
|
||||
|
||||
-- Visual selection can be moved up and down
|
||||
keymap('v', 'J', ':m \'>+1<CR>gv=gv')
|
||||
keymap('v', 'K', ':m \'<-2<CR>gv=gv')
|
||||
|
||||
-- Sort selected lines alphabetically, descending
|
||||
keymap('v', '<leader>s', ':sort<CR>', options)
|
||||
|
||||
-- Move between panes in Neovim
|
||||
keymap('n', '<C-j>', '<C-w>j', options)
|
||||
keymap('n', '<C-k>', '<C-w>k', options)
|
||||
keymap('n', '<C-h>', '<C-w>h', options)
|
||||
keymap('n', '<C-l>', '<C-w>l', options)
|
||||
|
||||
-- Don't move the cursor when appending the following line to the current
|
||||
keymap('n', 'J', 'mzJ`z')
|
||||
|
||||
-- Switch or close buffers in the window
|
||||
keymap('n', '<leader>n', ':bn<CR>', options)
|
||||
keymap('n', '<leader>p', ':bp<CR>', options)
|
||||
keymap('n', '<leader>d', ':bp|bd #<CR>', options)
|
||||
|
||||
-- Reload the nvim config
|
||||
keymap('n', '<leader><leader>r', ":source % | PackerCompile<CR>", options)
|
||||
|
||||
-- Toggle spellcheck
|
||||
keymap('n', '<leader>s', ':set spell!<CR>', options)
|
||||
|
||||
-- Quick exit from Insert mode
|
||||
keymap('i', 'jk', '<ESC>', options)
|
||||
|
||||
-- Toggle display of whitespace chars
|
||||
keymap('n', '<leader>w', ':set list!<CR>', options)
|
||||
|
||||
-- Floating terminal
|
||||
keymap('n', 't', ':FloatermToggle myfloat<CR>')
|
||||
keymap('t', '<ESC>', '<C-\\><C-n>:q<CR>')
|
||||
|
||||
-- Folding the section under the cursor
|
||||
keymap('n', '<space>', 'za')
|
||||
|
||||
-- Keymaps for custom functions
|
||||
keymap('n', '<leader>et', function() execute('test') end)
|
||||
keymap('n', '<leader>er', function() execute('run') end)
|
||||
keymap('n', '<leader>eb', function() execute('benchmark') end)
|
||||
|
||||
-- Vim-Fugitive
|
||||
keymap('n', '<leader>gis', vim.cmd.Git)
|
||||
keymap('n', '<leader>gid', vim.cmd.Gdiff)
|
||||
|
||||
keymap('n', '<leader>eo', ':Lexplore<CR>', options)
|
||||
|
||||
keymap('n', '<a-c>', ':noh<CR>', options)
|
||||
|
||||
keymap('n', '<leader>rn', ':%s///g<<', options)
|
||||
|
||||
-- Auto-recompile and load on init.lua file changes
|
||||
vim.api.nvim_create_autocmd({ 'BufWritePost' }, {
|
||||
pattern = { 'init.lua' },
|
||||
group = vim.api.nvim_create_augroup('nvim_reload', { clear = true }),
|
||||
command = "source % | PackerCompile"
|
||||
})
|
||||
|
||||
-- Fix for treesitter folds, as folds are not recalculated upon buffer changes (especially when pasting text)
|
||||
vim.api.nvim_create_autocmd({ 'BufEnter', 'BufNew', 'BufWinEnter' }, {
|
||||
pattern = '*',
|
||||
group = vim.api.nvim_create_augroup('telescope_fold_workaround', { clear = true }),
|
||||
command = 'set foldexpr=nvim_treesitter#foldexpr()',
|
||||
})
|
||||
|
||||
-- Create a new copy of capabilities and enable the snippetSupport
|
||||
local capabilities = vim.lsp.protocol.make_client_capabilities()
|
||||
capabilities.textDocument.completion.completionItem.snippetSupport = true
|
||||
|
||||
if luasnip then
|
||||
require('luasnip.loaders.from_vscode').lazy_load() -- Attempt to load VSCode based snippets
|
||||
end
|
||||
|
||||
-- All functions and keymappings contained here are universal to LSPs
|
||||
local on_attach = function(client, bufnr)
|
||||
vim.api.nvim_buf_set_option(bufnr, 'omnifunc', 'v:lua.vim.lsp.omnifunc')
|
||||
|
||||
-- Keyboard Mappings
|
||||
local bufopts = { noremap = true, silent = true, buffer = bufnr }
|
||||
keymap('n', '<c-[>', vim.diagnostic.goto_prev, bufopts)
|
||||
keymap('n', '<c-]>', vim.diagnostic.goto_next, bufopts)
|
||||
-- keymap('n', 'gl', vim.diagnostic.open_float, bufopts)
|
||||
keymap('n', 'ga', vim.lsp.buf.code_action, bufopts)
|
||||
keymap('n', 'gD', vim.lsp.buf.declaration, bufopts)
|
||||
keymap('n', 'gd', vim.lsp.buf.definition, bufopts)
|
||||
keymap('n', 'K', vim.lsp.buf.hover, bufopts)
|
||||
keymap('n', 'gi', vim.lsp.buf.implementation, bufopts)
|
||||
keymap('n', 'gs', vim.lsp.buf.signature_help, bufopts)
|
||||
keymap('n', '<leader>D', vim.lsp.buf.type_definition, bufopts)
|
||||
-- keymap('n', '<leader>rn', vim.lsp.buf.rename, bufopts)
|
||||
keymap('n', 'gr', vim.lsp.buf.references, bufopts)
|
||||
keymap('n', '<leader><leader>f', function() vim.lsp.buf.format { async = true } end, bufopts)
|
||||
|
||||
-- DAP debug
|
||||
if dap then
|
||||
keymap('n', '<F5>', function() dap.continue() end, bufopts)
|
||||
keymap('n', '<F10>', function() dap.step_over() end, bufopts)
|
||||
keymap('n', '<F11>', function() dap.step_into() end, bufopts)
|
||||
keymap('n', '<F12>', function() dap.step_out() end, bufopts)
|
||||
keymap('n', '<leader>b', function() dap.toggle_breakpoint() end, bufopts)
|
||||
end
|
||||
end
|
||||
|
||||
-- Module loading
|
||||
if mason and mason_lspconfig and nvim_lsp then
|
||||
mason.setup {}
|
||||
|
||||
mason_lspconfig.setup {
|
||||
automatic_installation = true,
|
||||
}
|
||||
|
||||
mason_lspconfig.setup_handlers {
|
||||
-- Default LSP handler
|
||||
function(server_name)
|
||||
nvim_lsp[server_name].setup {
|
||||
capabilities = capabilities,
|
||||
on_attach = on_attach
|
||||
}
|
||||
end,
|
||||
|
||||
['rust_analyzer'] = function()
|
||||
nvim_lsp.rust_analyzer.setup {
|
||||
capabilities = capabilities,
|
||||
on_attach = on_attach,
|
||||
settings = {
|
||||
['rust-analyzer'] = {
|
||||
checkOnSave = true,
|
||||
check = {
|
||||
command = 'clippy',
|
||||
extraArgs = { '--', '-Dclippy::all', '-Wclippy::pedantic' },
|
||||
},
|
||||
diagnostics = {
|
||||
enable = true,
|
||||
experimental = {
|
||||
enable = true,
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
end,
|
||||
|
||||
['lua_ls'] = function()
|
||||
nvim_lsp.lua_ls.setup {
|
||||
capabilities = capabilities,
|
||||
on_attach = on_attach,
|
||||
settings = {
|
||||
Lua = {
|
||||
diagnostics = {
|
||||
globals = { 'vim' }
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
end,
|
||||
}
|
||||
|
||||
-- Manually adding gdscript as Mason doesn't handle this anymore
|
||||
-- nvim_lsp.gdscript.setup {}
|
||||
end
|
||||
|
||||
if telescope and telescope_builtin then
|
||||
local actions = require('telescope.actions')
|
||||
|
||||
telescope.setup {
|
||||
defaults = {
|
||||
file_ignore_patterns = {
|
||||
'.png$',
|
||||
'.jpg$',
|
||||
'.jpeg$',
|
||||
'.ico$',
|
||||
'.icns$',
|
||||
'.webp$',
|
||||
'.uproject$', -- Unreal Engine
|
||||
'-workspace$',
|
||||
},
|
||||
layout_strategy = 'vertical',
|
||||
layout_config = {
|
||||
height = 0.8
|
||||
},
|
||||
results_title = false,
|
||||
prompt_prefix = ' ',
|
||||
selection_caret = '➤ ',
|
||||
mappings = {
|
||||
i = {
|
||||
["<ESC>"] = actions.close
|
||||
},
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
keymap('n', '<leader>ff', telescope_builtin.find_files, options)
|
||||
keymap('n', '<leader>fg', telescope_builtin.git_commits, options)
|
||||
keymap('n', '<leader>fh', telescope_builtin.help_tags, options)
|
||||
keymap('n', '<leader>fr', telescope_builtin.live_grep, options)
|
||||
keymap('n', '<leader>fm', telescope_builtin.marks, options)
|
||||
keymap('n', '<leader>fb', telescope_builtin.buffers, options)
|
||||
keymap('n', '<leader>fd', telescope_builtin.diagnostics, options)
|
||||
end
|
||||
|
||||
if treesitter_configs then
|
||||
treesitter_configs.setup {
|
||||
auto_install = true,
|
||||
ensure_installed = {
|
||||
'c',
|
||||
'c_sharp',
|
||||
'comment',
|
||||
'css',
|
||||
'html',
|
||||
'java',
|
||||
'javascript',
|
||||
'json',
|
||||
'lua',
|
||||
'python',
|
||||
'query',
|
||||
'rust',
|
||||
'toml',
|
||||
'tsx',
|
||||
'typescript',
|
||||
'yaml',
|
||||
},
|
||||
highlight = {
|
||||
enable = true,
|
||||
additional_vim_regex_highlighting = false,
|
||||
},
|
||||
incremental_selection = {
|
||||
enable = true,
|
||||
},
|
||||
indent = {
|
||||
enable = true,
|
||||
},
|
||||
rainbow = {
|
||||
enable = true,
|
||||
}
|
||||
}
|
||||
end
|
||||
|
||||
if comment then
|
||||
comment.setup {
|
||||
ignore = '^$',
|
||||
toggler = {
|
||||
line = 'gc',
|
||||
block = '<nop>',
|
||||
},
|
||||
}
|
||||
|
||||
keymap('n', '<leader>c', ':norm gcc<CR>', options)
|
||||
keymap('v', '<leader>c', ':norm gc<CR>', options)
|
||||
end
|
||||
|
||||
if lualine then
|
||||
lualine.setup {
|
||||
-- See :h lualine-Default-Configuration for defaults and options
|
||||
tabline = {
|
||||
-- Set the contents of the top left tabline
|
||||
lualine_a = {
|
||||
'tabs',
|
||||
},
|
||||
lualine_z = {
|
||||
'buffers',
|
||||
}
|
||||
}
|
||||
}
|
||||
end
|
||||
|
||||
if telekasten then
|
||||
local home = vim.fn.expand('~/.zettelkasten')
|
||||
telekasten.setup({
|
||||
home = home,
|
||||
dailies = home .. '/' .. 'daily',
|
||||
weeklies = home .. '/' .. 'weeklies',
|
||||
templates = home .. '/' .. 'templates',
|
||||
template_new_note = home .. '/' .. 'templates/new_note.md',
|
||||
template_new_daily = home .. '/' .. 'templates/daily.md',
|
||||
template_new_weekly = home .. '/' .. 'templates/weekly.md',
|
||||
command_palette_theme = 'ivy',
|
||||
show_tags_theme = 'get_cursor',
|
||||
plug_into_calendar = false,
|
||||
})
|
||||
|
||||
-- Color for telekasten syntax
|
||||
vim.api.nvim_set_hl(0, 'tkLink',
|
||||
{ ctermfg = 72, cterm = { bold = true, underdouble = true }, fg = '#689d6a', bold = true, underdouble = true })
|
||||
vim.api.nvim_set_hl(0, 'tkBrackets', { ctermfg = 'gray', fg = 'gray' })
|
||||
vim.api.nvim_set_hl(0, 'tkTag', { ctermfg = 'gray', fg = 'gray' })
|
||||
|
||||
keymap('n', '<leader>zp', telekasten.panel, options)
|
||||
keymap('n', '<leader>zn', telekasten.find_notes, options)
|
||||
keymap('n', '<leader>zt', telekasten.show_tags, options)
|
||||
end
|
||||
|
||||
-- nvim-cmp config
|
||||
if cmp then
|
||||
cmp.setup {
|
||||
snippet = {
|
||||
-- REQUIRED, the plugin will NOT work without a snippet engine enabled
|
||||
expand = function(args)
|
||||
-- Enable luasnips
|
||||
if luasnip then
|
||||
luasnip.lsp_expand(args.body)
|
||||
end
|
||||
end
|
||||
},
|
||||
completion = {
|
||||
completeopt = 'menu,menuone,noinsert'
|
||||
},
|
||||
experimental = {
|
||||
ghost_text = true,
|
||||
},
|
||||
mapping = {
|
||||
-- Key mappings based off of the standard autocomplete keybindings from VIM
|
||||
['<c-n>'] = cmp.mapping.select_next_item(),
|
||||
['<c-p>'] = cmp.mapping.select_prev_item(),
|
||||
['<c-j>'] = cmp.mapping.scroll_docs(-4),
|
||||
['<c-k>'] = cmp.mapping.scroll_docs(4),
|
||||
['<c-space>'] = cmp.mapping.complete(),
|
||||
['<c-y>'] = cmp.mapping.confirm({
|
||||
behavior = cmp.ConfirmBehavior.Insert,
|
||||
select = true,
|
||||
}),
|
||||
},
|
||||
formatting = {
|
||||
format = function(entry, vim_item)
|
||||
-- vim_item.kind = string.format('%s', vim_item.kind)
|
||||
vim_item.menu = ({
|
||||
buffer = '[Buf]',
|
||||
luasnip = '[Snips]',
|
||||
nvim_lsp = '[LSP]',
|
||||
nvim_lua = '[Lua]'
|
||||
})[entry.source.name]
|
||||
return vim_item
|
||||
end,
|
||||
fields = { 'abbr', 'kind', 'menu' }
|
||||
},
|
||||
sources = cmp.config.sources({
|
||||
-- NOTE: the order of sources determines their loading priority in the autocomplete menu
|
||||
{ name = 'nvim_lsp' },
|
||||
{ name = 'luasnip' },
|
||||
{ name = 'path' },
|
||||
}, {
|
||||
{ name = 'buffer' },
|
||||
})
|
||||
}
|
||||
|
||||
cmp.setup.cmdline(':', {
|
||||
mapping = cmp.mapping.preset.cmdline(),
|
||||
sources = cmp.config.sources({
|
||||
{ name = 'path' },
|
||||
{ name = 'buffer' }
|
||||
}, {
|
||||
{ name = 'cmdline' }
|
||||
})
|
||||
})
|
||||
|
||||
cmp.setup.cmdline('/', {
|
||||
mapping = cmp.mapping.preset.cmdline(),
|
||||
sources = {
|
||||
{ name = 'buffer' }
|
||||
}
|
||||
})
|
||||
end
|
||||
|
||||
vim.lsp.handlers["textDocument/publishDiagnostics"] = vim.lsp.with(
|
||||
vim.lsp.diagnostic.on_publish_diagnostics, {
|
||||
underline = true,
|
||||
virtual_text = true,
|
||||
signs = true,
|
||||
update_in_insert = true,
|
||||
}
|
||||
)
|
||||
require('custom_functions')
|
||||
require('keymappings')
|
||||
require('settings')
|
||||
require('autocmds')
|
||||
require('lsp')
|
||||
require('plugins')
|
||||
|
||||
6
lua/autocmds.lua
Normal file
6
lua/autocmds.lua
Normal file
@ -0,0 +1,6 @@
|
||||
-- Fix for treesitter folds, as folds are not recalculated upon buffer changes (especially when pasting text)
|
||||
vim.api.nvim_create_autocmd({ 'BufEnter', 'BufNew', 'BufWinEnter' }, {
|
||||
pattern = '*',
|
||||
group = vim.api.nvim_create_augroup('telescope_fold_workaround', { clear = true }),
|
||||
command = 'set foldexpr=nvim_treesitter#foldexpr()',
|
||||
})
|
||||
31
lua/custom_functions.lua
Normal file
31
lua/custom_functions.lua
Normal file
@ -0,0 +1,31 @@
|
||||
-- 'softrequire' provides a wrapper around the builtin require. If the require has failed in a `local mod = softrequire('m') call, a quick check of
|
||||
-- 'if mod then' can wrap code dependent upon the require, and fails gracefully
|
||||
local function softrequire(m)
|
||||
local ok, err = pcall(require, m)
|
||||
if not ok then return nil, err end
|
||||
return err
|
||||
end
|
||||
|
||||
local function execute(type)
|
||||
local command_table = {
|
||||
run = {
|
||||
java = "java %",
|
||||
python = "python %",
|
||||
rust = "cargo run",
|
||||
},
|
||||
test = {
|
||||
python = "python test",
|
||||
rust = "cargo test",
|
||||
},
|
||||
benchmark = {
|
||||
rust = "cargo bench",
|
||||
},
|
||||
}
|
||||
vim.api.nvim_command('write')
|
||||
local command = command_table[type][vim.bo.filetype]
|
||||
|
||||
if command ~= nil then
|
||||
vim.cmd('FloatermNew --autoclose=0 ' .. command)
|
||||
end
|
||||
end
|
||||
|
||||
52
lua/keymappings.lua
Normal file
52
lua/keymappings.lua
Normal file
@ -0,0 +1,52 @@
|
||||
local cf = require('custom_functions')
|
||||
|
||||
vim.g.mapleader = ','
|
||||
|
||||
-- Standard keybinding options
|
||||
local options = { noremap = true }
|
||||
|
||||
-- Block tab/untab without leaving visual mode
|
||||
vim.keymap.set('v', '<', '<gv', options)
|
||||
vim.keymap.set('v', '>', '>gv', options)
|
||||
|
||||
-- Visual selection can be moved up and down
|
||||
vim.keymap.set('v', 'J', ':m \'>+1<CR>gv=gv')
|
||||
vim.keymap.set('v', 'K', ':m \'<-2<CR>gv=gv')
|
||||
|
||||
-- Sort selected lines alphabetically, descending
|
||||
vim.keymap.set('v', '<leader>s', ':sort<CR>', options)
|
||||
|
||||
-- Move between panes in Neovim
|
||||
vim.keymap.set('n', '<C-j>', '<C-w>j', options)
|
||||
vim.keymap.set('n', '<C-k>', '<C-w>k', options)
|
||||
vim.keymap.set('n', '<C-h>', '<C-w>h', options)
|
||||
vim.keymap.set('n', '<C-l>', '<C-w>l', options)
|
||||
|
||||
-- Don't move the cursor when appending the following line to the current
|
||||
vim.keymap.set('n', 'J', 'mzJ`z')
|
||||
|
||||
-- Switch or close buffers in the window
|
||||
vim.keymap.set('n', '<leader>n', ':bn<CR>', options)
|
||||
vim.keymap.set('n', '<leader>p', ':bp<CR>', options)
|
||||
vim.keymap.set('n', '<leader>d', ':bp|bd #<CR>', options)
|
||||
|
||||
-- Toggle spellcheck
|
||||
vim.keymap.set('n', '<leader>s', ':set spell!<CR>', options)
|
||||
|
||||
-- Quick exit from Insert mode
|
||||
vim.keymap.set('i', 'jk', '<ESC>', options)
|
||||
|
||||
-- Toggle display of whitespace chars
|
||||
vim.keymap.set('n', '<leader>w', ':set list!<CR>', options)
|
||||
|
||||
-- Folding the section under the cursor
|
||||
vim.keymap.set('n', '<space>', 'za')
|
||||
|
||||
-- Keymaps for custom functions
|
||||
vim.keymap.set('n', '<leader>et', function() cf.execute('test') end)
|
||||
vim.keymap.set('n', '<leader>er', function() cf.execute('run') end)
|
||||
vim.keymap.set('n', '<leader>eb', function() cf.execute('benchmark') end)
|
||||
|
||||
vim.keymap.set('n', '<leader>eo', ':Lexplore<CR>', options)
|
||||
|
||||
vim.keymap.set('n', '<leader>rn', ':%s/<c-r><c-w>//g<Left><Left>', options)
|
||||
8
lua/lsp.lua
Normal file
8
lua/lsp.lua
Normal file
@ -0,0 +1,8 @@
|
||||
vim.lsp.handlers["textDocument/publishDiagnostics"] = vim.lsp.with(
|
||||
vim.lsp.diagnostic.on_publish_diagnostics, {
|
||||
underline = true,
|
||||
virtual_text = true,
|
||||
signs = true,
|
||||
update_in_insert = true,
|
||||
}
|
||||
)
|
||||
35
lua/plugins.lua
Normal file
35
lua/plugins.lua
Normal file
@ -0,0 +1,35 @@
|
||||
-- use 'tpope/vim-fugitive' -- Git integration
|
||||
--
|
||||
-- -- Experimental
|
||||
-- use 'mfussenegger/nvim-dap'
|
||||
-- use 'rcarriga/nvim-dap-ui'
|
||||
|
||||
local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim"
|
||||
if not vim.loop.fs_stat(lazypath) then
|
||||
vim.fn.system({
|
||||
"git",
|
||||
"clone",
|
||||
"--filter=blob:none",
|
||||
"https://github.com/folke/lazy.nvim.git",
|
||||
"--branch=stable",
|
||||
lazypath,
|
||||
})
|
||||
end
|
||||
vim.opt.rtp:prepend(lazypath)
|
||||
|
||||
require('lazy').setup({
|
||||
require('plugins/lspconfig'),
|
||||
require('plugins/mason'),
|
||||
require('plugins/gruvbox'),
|
||||
require('plugins/comment'),
|
||||
require('plugins/treesitter'),
|
||||
require('plugins/vim-gitgutter'),
|
||||
require('plugins/luasnip'),
|
||||
require('plugins/nvim-cmp'),
|
||||
require('plugins/lualine'),
|
||||
require('plugins/telekasten'),
|
||||
require('plugins/telescope'),
|
||||
'tpope/vim-surround',
|
||||
require('plugins/floaterm'),
|
||||
require('plugins/vim-godot'),
|
||||
})
|
||||
16
lua/plugins/comment.lua
Normal file
16
lua/plugins/comment.lua
Normal file
@ -0,0 +1,16 @@
|
||||
return {
|
||||
'numToStr/Comment.nvim',
|
||||
config = function()
|
||||
require('Comment').setup {
|
||||
ignore = '^$',
|
||||
toggler = {
|
||||
line = 'gc',
|
||||
block = '<nop>',
|
||||
},
|
||||
}
|
||||
end,
|
||||
keys = {
|
||||
{ '<leader>c', ':norm gcc<CR>' },
|
||||
{ '<leader>c', ':norm gc<CR>', mode = 'v' },
|
||||
}
|
||||
}
|
||||
7
lua/plugins/floaterm.lua
Normal file
7
lua/plugins/floaterm.lua
Normal file
@ -0,0 +1,7 @@
|
||||
return {
|
||||
'voldikss/vim-floaterm',
|
||||
keys = {
|
||||
{ 't', ':FloatermToggle myfloat<CR>' },
|
||||
{ '<ESC>', '<C-\\><C-n>:q<CR>', mode = 't' },
|
||||
},
|
||||
}
|
||||
11
lua/plugins/gruvbox.lua
Normal file
11
lua/plugins/gruvbox.lua
Normal file
@ -0,0 +1,11 @@
|
||||
return {
|
||||
'ellisonleao/gruvbox.nvim',
|
||||
config = function()
|
||||
require('gruvbox').setup({
|
||||
contrast = 'hard',
|
||||
})
|
||||
vim.cmd([[colorscheme gruvbox]])
|
||||
end,
|
||||
lazy = false,
|
||||
priority = 1000,
|
||||
}
|
||||
4
lua/plugins/lspconfig.lua
Normal file
4
lua/plugins/lspconfig.lua
Normal file
@ -0,0 +1,4 @@
|
||||
return {
|
||||
'neovim/nvim-lspconfig',
|
||||
lazy = false,
|
||||
}
|
||||
18
lua/plugins/lualine.lua
Normal file
18
lua/plugins/lualine.lua
Normal file
@ -0,0 +1,18 @@
|
||||
return {
|
||||
'nvim-lualine/lualine.nvim',
|
||||
config = function()
|
||||
require('lualine').setup {
|
||||
tabline = {
|
||||
lualine_a = {
|
||||
'tabs',
|
||||
},
|
||||
lualine_z = {
|
||||
'buffers',
|
||||
}
|
||||
}
|
||||
}
|
||||
end,
|
||||
dependencies = {
|
||||
'kyazdani42/nvim-web-devicons'
|
||||
},
|
||||
}
|
||||
10
lua/plugins/luasnip.lua
Normal file
10
lua/plugins/luasnip.lua
Normal file
@ -0,0 +1,10 @@
|
||||
return {
|
||||
'L3MON4D3/LuaSnip',
|
||||
config = function()
|
||||
require('luasnip.loaders.from_vscode').lazy_load()
|
||||
end,
|
||||
dependencies = {
|
||||
'saadparwaiz1/cmp_luasnip', -- Wrapper to load snippets in nvim-cmp
|
||||
'rafamadriz/friendly-snippets',
|
||||
},
|
||||
}
|
||||
95
lua/plugins/mason.lua
Normal file
95
lua/plugins/mason.lua
Normal file
@ -0,0 +1,95 @@
|
||||
return {
|
||||
'williamboman/mason.nvim',
|
||||
config = function()
|
||||
require('mason').setup()
|
||||
|
||||
local mason_lspconfig = require('mason-lspconfig')
|
||||
|
||||
local capabilities = vim.lsp.protocol.make_client_capabilities()
|
||||
capabilities.textDocument.completion.completionItem.snippetSupport = true
|
||||
|
||||
-- All functions and keymaps contained here are universal to LSPs
|
||||
local on_attach = function(client, bufnr)
|
||||
vim.api.nvim_buf_set_option(bufnr, 'omnifunc', 'v:lua.vim.lsp.omnifunc')
|
||||
|
||||
-- Keyboard Mappings
|
||||
local bufopts = { noremap = true, silent = true, buffer = bufnr }
|
||||
vim.keymap.set('n', '<c-[>', vim.diagnostic.goto_prev, bufopts)
|
||||
vim.keymap.set('n', '<c-]>', vim.diagnostic.goto_next, bufopts)
|
||||
-- vim.keymap.set('n', 'gl', vim.diagnostic.open_float, bufopts)
|
||||
vim.keymap.set('n', 'ga', vim.lsp.buf.code_action, bufopts)
|
||||
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', 'gs', vim.lsp.buf.signature_help, bufopts)
|
||||
vim.keymap.set('n', '<leader>D', vim.lsp.buf.type_definition, bufopts)
|
||||
-- vim.keymap.set('n', '<leader>rn', vim.lsp.buf.rename, bufopts)
|
||||
vim.keymap.set('n', 'gr', vim.lsp.buf.references, bufopts)
|
||||
vim.keymap.set('n', '<leader><leader>f', function() vim.lsp.buf.format { async = true } end, bufopts)
|
||||
|
||||
-- DAP debug
|
||||
-- if dap then
|
||||
-- vim.keymap.set('n', '<F5>', function() dap.continue() end, bufopts)
|
||||
-- vim.keymap.set('n', '<F10>', function() dap.step_over() end, bufopts)
|
||||
-- vim.keymap.set('n', '<F11>', function() dap.step_into() end, bufopts)
|
||||
-- vim.keymap.set('n', '<F12>', function() dap.step_out() end, bufopts)
|
||||
-- vim.keymap.set('n', '<leader>b', function() dap.toggle_breakpoint() end, bufopts)
|
||||
-- end
|
||||
end
|
||||
|
||||
mason_lspconfig.setup {
|
||||
automatic_installation = true,
|
||||
}
|
||||
|
||||
local lspconfig = require('lspconfig')
|
||||
|
||||
mason_lspconfig.setup_handlers {
|
||||
function(server_name)
|
||||
lspconfig[server_name].setup {
|
||||
capabilities = capabilities,
|
||||
on_attach = on_attach
|
||||
}
|
||||
end,
|
||||
|
||||
['rust_analyzer'] = function()
|
||||
lspconfig.rust_analyzer.setup {
|
||||
capabilities = capabilities,
|
||||
on_attach = on_attach,
|
||||
settings = {
|
||||
['rust-analyzer'] = {
|
||||
checkOnSave = true,
|
||||
check = {
|
||||
command = 'clippy',
|
||||
extraArgs = { '--', '-Dclippy::all', '-Wclippy::pedantic' },
|
||||
},
|
||||
diagnostics = {
|
||||
enable = true,
|
||||
experimental = {
|
||||
enable = true,
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
end,
|
||||
|
||||
['lua_ls'] = function()
|
||||
lspconfig.lua_ls.setup {
|
||||
capabilities = capabilities,
|
||||
on_attach = on_attach,
|
||||
settings = {
|
||||
Lua = {
|
||||
diagnostics = {
|
||||
globals = { 'vim' }
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
end,
|
||||
}
|
||||
end,
|
||||
dependencies = {
|
||||
'williamboman/mason-lspconfig.nvim'
|
||||
},
|
||||
}
|
||||
90
lua/plugins/nvim-cmp.lua
Normal file
90
lua/plugins/nvim-cmp.lua
Normal file
@ -0,0 +1,90 @@
|
||||
return {
|
||||
'hrsh7th/nvim-cmp',
|
||||
config = function()
|
||||
local cmp = require('cmp')
|
||||
cmp.setup {
|
||||
snippet = {
|
||||
expand = function(args)
|
||||
require('luasnip').lsp_expand(args.body)
|
||||
end,
|
||||
},
|
||||
completion = {
|
||||
completeopt = 'menu,menuone,noinsert',
|
||||
},
|
||||
experimental = {
|
||||
ghost_text = true,
|
||||
},
|
||||
mapping = {
|
||||
['<c-n>'] = cmp.mapping.select_next_item(),
|
||||
['<c-p>'] = cmp.mapping.select_prev_item(),
|
||||
['<c-j>'] = cmp.mapping.scroll_docs(-4),
|
||||
['<c-k>'] = cmp.mapping.scroll_docs(4),
|
||||
['<c-space>'] = cmp.mapping.complete(),
|
||||
['<c-y>'] = cmp.mapping.confirm({
|
||||
behavior = cmp.ConfirmBehavior.Insert,
|
||||
select = true,
|
||||
}),
|
||||
},
|
||||
formatting = {
|
||||
format = function(entry, vim_item)
|
||||
vim_item.menu = ({
|
||||
buffer = '[Buf]',
|
||||
luasnip = '[Snips]',
|
||||
nvim_lsp = '[LSP]',
|
||||
nvim_lua = '[Lua]',
|
||||
})[entry.source.name]
|
||||
return vim_item
|
||||
end,
|
||||
field = { 'abbr', 'kind', 'menu' }
|
||||
},
|
||||
sources = cmp.config.sources({
|
||||
{ name = 'nvim_lsp' },
|
||||
{ name = 'luasnip' },
|
||||
{ name = 'path' },
|
||||
}, {
|
||||
{ name = 'buffer' },
|
||||
})
|
||||
}
|
||||
|
||||
cmp.setup.cmdline(':', {
|
||||
mapping = cmp.mapping.preset.cmdline(),
|
||||
sources = cmp.config.sources({
|
||||
{ name = 'path' },
|
||||
{ name = 'buffer' },
|
||||
}, {
|
||||
{ name = 'cmdline' },
|
||||
})
|
||||
})
|
||||
|
||||
cmp.setup.cmdline({ '/', '?' }, {
|
||||
mapping = cmp.mapping.preset.cmdline(),
|
||||
sources = {
|
||||
{ name = 'buffer' }
|
||||
}
|
||||
})
|
||||
end,
|
||||
dependencies = {
|
||||
{
|
||||
'hrsh7th/cmp-nvim-lsp',
|
||||
lazy = false,
|
||||
},
|
||||
{
|
||||
'hrsh7th/cmp-buffer',
|
||||
lazy = false,
|
||||
},
|
||||
{
|
||||
'hrsh7th/cmp-path',
|
||||
lazy = false,
|
||||
},
|
||||
{
|
||||
'hrsh7th/cmp-cmdline',
|
||||
lazy = false,
|
||||
},
|
||||
{
|
||||
'L3MON4D3/LuaSnip',
|
||||
lazy = false,
|
||||
},
|
||||
},
|
||||
event = "InsertEnter",
|
||||
lazy = false,
|
||||
}
|
||||
30
lua/plugins/telekasten.lua
Normal file
30
lua/plugins/telekasten.lua
Normal file
@ -0,0 +1,30 @@
|
||||
return {
|
||||
'renerocksai/telekasten.nvim',
|
||||
config = function()
|
||||
local home = vim.fn.expand('~/.zettelkasten')
|
||||
require('telekasten').setup({
|
||||
home = home,
|
||||
dailies = home .. '/' .. 'daily',
|
||||
weeklies = home .. '/' .. 'weeklies',
|
||||
templates = home .. '/' .. 'templates',
|
||||
template_new_note = home .. '/' .. 'templates/new_note.md',
|
||||
template_new_daily = home .. '/' .. 'templates/daily.md',
|
||||
template_new_weekly = home .. '/' .. 'templates/weekly.md',
|
||||
command_palette_theme = 'ivy',
|
||||
show_tags_theme = 'get_cursor',
|
||||
plug_into_calendar = false,
|
||||
|
||||
})
|
||||
|
||||
-- Color for telekasten syntax
|
||||
vim.api.nvim_set_hl(0, 'tkLink', { ctermfg = 72, cterm = { bold = true, underdouble = true }, fg = '#689d6a', bold = true, underdouble = true })
|
||||
vim.api.nvim_set_hl(0, 'tkBrackets', { ctermfg = 'gray', fg = 'gray' })
|
||||
vim.api.nvim_set_hl(0, 'tkTag', { ctermfg = 'gray', fg = 'gray' })
|
||||
end,
|
||||
keys = {
|
||||
{ '<leader>zp', ':Telekasten panel<CR>' },
|
||||
{ '<leader>zn', ':Telekasten find_notes<CR>' },
|
||||
{ '<leader>zt', ':Telekasten show_tags<CR>' },
|
||||
},
|
||||
-- lazy = false
|
||||
}
|
||||
44
lua/plugins/telescope.lua
Normal file
44
lua/plugins/telescope.lua
Normal file
@ -0,0 +1,44 @@
|
||||
return {
|
||||
'nvim-telescope/telescope.nvim',
|
||||
config = function()
|
||||
local actions = require('telescope.actions')
|
||||
require('telescope').setup {
|
||||
defaults = {
|
||||
file_ignore_patterns = {
|
||||
'.png$',
|
||||
'.jpg$',
|
||||
'.jpeg$',
|
||||
'.ico$',
|
||||
'.icns$',
|
||||
'.webp$',
|
||||
'.uproject$',
|
||||
'-workspace$',
|
||||
},
|
||||
-- layout_strategy = 'vertical',
|
||||
-- layout_config = {
|
||||
-- height = 0.0
|
||||
-- },
|
||||
results_title = false,
|
||||
prompt_prefix = ' ',
|
||||
selection_caret = '➤ ',
|
||||
mappings = {
|
||||
i = {
|
||||
["<ESC>"] = actions.close
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
end,
|
||||
dependencies = {
|
||||
'nvim-lua/plenary.nvim'
|
||||
},
|
||||
keys = {
|
||||
{ '<leader>ff', ":Telescope find_files<CR>" },
|
||||
{ '<leader>fg', ":Telescope git_commits<CR>" },
|
||||
{ '<leader>fh', ":Telescope help_tags<CR>" },
|
||||
{ '<leader>fr', ":Telescope live_grep<CR>" },
|
||||
{ '<leader>fm', ":Telescope marks<CR>" },
|
||||
{ '<leader>fb', ":Telescope buffers<CR>" },
|
||||
{ '<leader>fd', ":Telescope diagnostics<CR>" },
|
||||
},
|
||||
}
|
||||
42
lua/plugins/treesitter.lua
Normal file
42
lua/plugins/treesitter.lua
Normal file
@ -0,0 +1,42 @@
|
||||
return {
|
||||
'nvim-treesitter/nvim-treesitter',
|
||||
config = function()
|
||||
require('nvim-treesitter.configs').setup {
|
||||
auto_install = true,
|
||||
ensure_installed = {
|
||||
'c',
|
||||
'c_sharp',
|
||||
'comment',
|
||||
'css',
|
||||
'html',
|
||||
'java',
|
||||
'javascript',
|
||||
'json',
|
||||
'lua',
|
||||
'python',
|
||||
'query',
|
||||
'rust',
|
||||
'toml',
|
||||
'tsx',
|
||||
'typescript',
|
||||
'yaml',
|
||||
},
|
||||
highlight = {
|
||||
enable = true,
|
||||
additional_vim_regex_highlighting = false,
|
||||
},
|
||||
incremental_selection = {
|
||||
enable = true,
|
||||
},
|
||||
indent = {
|
||||
enable = true,
|
||||
},
|
||||
rainbow = {
|
||||
enable = true,
|
||||
}
|
||||
}
|
||||
-- require('nvim-treesitter.install').prefer_git = true
|
||||
-- TSUpdate
|
||||
end,
|
||||
lazy = false,
|
||||
}
|
||||
3
lua/plugins/vim-gitgutter.lua
Normal file
3
lua/plugins/vim-gitgutter.lua
Normal file
@ -0,0 +1,3 @@
|
||||
return {
|
||||
'airblade/vim-gitgutter'
|
||||
}
|
||||
4
lua/plugins/vim-godot.lua
Normal file
4
lua/plugins/vim-godot.lua
Normal file
@ -0,0 +1,4 @@
|
||||
return {
|
||||
'habamax/vim-godot',
|
||||
ft = 'gdscript',
|
||||
}
|
||||
33
lua/settings.lua
Normal file
33
lua/settings.lua
Normal file
@ -0,0 +1,33 @@
|
||||
vim.opt.background = 'dark' -- Force a dark background for the colorscheme
|
||||
vim.opt.clipboard = "unnamed,unnamedplus" -- Use both the "*" and "+" registers for yanks and deletes (puts things in the system clipboard)
|
||||
vim.opt.colorcolumn = '121' -- Highlight column to show
|
||||
vim.opt.completeopt = 'menu,menuone,noinsert' -- Change how the completion menu is interacted with
|
||||
vim.opt.cursorline = true -- Highlight the line the cursor is on.
|
||||
vim.opt.expandtab = true -- Expand tabs into spaces
|
||||
vim.opt.fileformat = 'unix' -- Explicitly state that files should use the unix style EOL characters.
|
||||
vim.opt.fillchars = 'fold: ' -- Sets the character that fills in a fold line
|
||||
vim.opt.foldexpr = 'nvim_treesitter#foldexpr()' -- Uses Treesitter to determine where code folding should occur
|
||||
vim.opt.foldlevel = 10 -- Sets the initial level at which folds will be closed
|
||||
vim.opt.foldmethod = 'expr' -- Attempt to use the syntax of a file to set folds.
|
||||
vim.opt.formatoptions = 'cqrto' -- Allow auto insertion of comment lines when using o or O on a comment.
|
||||
vim.opt.list = true -- Show the listchars
|
||||
vim.opt.listchars = 'tab:|·,trail:¬,extends:>,precedes:<,nbsp:+' -- Characters to display when showing whitespace
|
||||
vim.opt.mouse = 'a' -- Enable mouse mode
|
||||
vim.opt.number = true -- Show the line number in the gutter.
|
||||
vim.opt.relativenumber = true -- Relative line number
|
||||
vim.opt.shiftround = true -- Round indentation to shiftwidth
|
||||
vim.opt.shiftwidth = 4 -- Number of spaces a tab counts for when converting tabs to spaces
|
||||
vim.opt.shortmess = 'at' -- Abbreviations and truncation of cmd messages
|
||||
vim.opt.showmatch = true -- Show matching bracket
|
||||
vim.opt.signcolumn = 'yes' -- Always show the gutter
|
||||
vim.opt.smartindent = true -- Attempt to insert indentation to fit traditional languages.
|
||||
vim.opt.softtabstop = 4 -- Number of spaces a tab counts for when converting tabs to spaces
|
||||
vim.opt.splitbelow = true -- Split windows below when horizontal splitting
|
||||
vim.opt.splitright = true -- Split windows right when vertical splitting
|
||||
vim.opt.swapfile = false -- Disable the creation of swap files for open files
|
||||
vim.opt.tabstop = 4 -- Setting the value of spaces per tab
|
||||
vim.opt.termguicolors = true -- Enable the truecolor GUI colors in a terminal
|
||||
vim.opt.undodir = os.getenv('HOME') .. '/.config/nvim/undodir' -- Set a specific undo file directory
|
||||
vim.opt.undofile = true -- Enable undo files
|
||||
vim.opt.updatetime = 50 -- Update time in milliseconds
|
||||
vim.opt.wrap = false -- Do _not_ wrap lines
|
||||
Loading…
x
Reference in New Issue
Block a user