Compare commits
21 Commits
a8818ea92a
...
master
Author | SHA1 | Date | |
---|---|---|---|
|
15d27dc96a | ||
e777391307 | |||
|
9f6b6776c2 | ||
|
8c82f7cab4 | ||
|
4da8e11ada | ||
|
ac2447ac6e | ||
|
fd5401c9d7 | ||
|
1d2cd23307 | ||
|
40303719a2 | ||
|
b2f02b5c13 | ||
|
afcce108f7 | ||
|
46edb66356 | ||
|
cc9fc11a62 | ||
|
a4e6919899 | ||
4fc013a680 | |||
|
aa72c826c0 | ||
|
717c7f09e5 | ||
|
6a51019731 | ||
|
7cffe20d81 | ||
|
966adc7817 | ||
|
fe9da6af57 |
19
.luarc.json
Normal file
19
.luarc.json
Normal file
@@ -0,0 +1,19 @@
|
||||
{
|
||||
"workspace.library": [
|
||||
"/Users/fschmidt/.config/nvim",
|
||||
"/Users/fschmidt/.local/share/nvim/lazy/lazy.nvim",
|
||||
"/Users/fschmidt/.local/share/nvim/lazy/cmp-nvim-lsp",
|
||||
"/Users/fschmidt/.local/share/nvim/lazy/nvim-lspconfig",
|
||||
"/Users/fschmidt/.local/share/nvim/lazy/mason.nvim",
|
||||
"/Users/fschmidt/.local/share/nvim/lazy/mason-lspconfig.nvim",
|
||||
"/Users/fschmidt/.local/share/nvim/lazy/nvim-web-devicons",
|
||||
"/Users/fschmidt/.local/share/nvim/lazy/nvim-tree.lua",
|
||||
"/Users/fschmidt/.local/share/nvim/lazy/null-ls.nvim",
|
||||
"/Users/fschmidt/.local/share/nvim/lazy/lualine.nvim",
|
||||
"/usr/local/Cellar/neovim/0.8.3/share/nvim/runtime",
|
||||
"/usr/local/Cellar/neovim/0.8.3/lib/nvim",
|
||||
"/Users/fschmidt/.local/state/nvim/lazy/readme",
|
||||
"/Users/fschmidt/.local/share/nvim/lazy/cmp-nvim-lsp/after",
|
||||
"${3rd}/luassert/library"
|
||||
]
|
||||
}
|
47
init.lua
47
init.lua
@@ -1,6 +1,45 @@
|
||||
-- init.lua
|
||||
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", -- latest stable release
|
||||
lazypath,
|
||||
})
|
||||
end
|
||||
vim.opt.rtp:prepend(lazypath)
|
||||
vim.g.mapleader = " "
|
||||
require("lazy").setup("plugins")
|
||||
require("maps").init()
|
||||
require("commands")
|
||||
|
||||
require'plugins'
|
||||
require'settings'.init()
|
||||
require'maps'.init()
|
||||
require'commands'
|
||||
vim.opt.backup = false
|
||||
vim.opt.undodir = os.getenv("HOME") .. '/.cache/nvim/undodir'
|
||||
vim.opt.swapfile = false
|
||||
vim.opt.undofile = true
|
||||
vim.opt.smartcase = true
|
||||
vim.opt.ignorecase = true
|
||||
vim.opt.laststatus = 2
|
||||
vim.opt.hidden = true
|
||||
vim.opt.hlsearch = false
|
||||
vim.opt.incsearch = true
|
||||
vim.opt.scrolloff = 12
|
||||
vim.opt.sidescrolloff = 8
|
||||
vim.opt.mouse = 'a'
|
||||
vim.opt.autochdir = true
|
||||
vim.opt.clipboard = 'unnamed,unnamedplus'
|
||||
vim.opt.number = true
|
||||
vim.opt.wrap = false
|
||||
vim.opt.signcolumn = 'yes:2'
|
||||
vim.opt.list = true
|
||||
vim.opt.listchars = 'tab:▸ ,trail:·'
|
||||
vim.opt.shiftwidth = 4
|
||||
vim.opt.tabstop = 4
|
||||
vim.opt.softtabstop = 4
|
||||
vim.opt.expandtab = false
|
||||
vim.opt.autoindent = true
|
||||
vim.opt.smartindent = true
|
||||
vim.opt.completeopt = { "menu", "menuone", "noselect" }
|
||||
|
37
lazy-lock.json
Normal file
37
lazy-lock.json
Normal file
@@ -0,0 +1,37 @@
|
||||
{
|
||||
"LuaSnip": { "branch": "master", "commit": "03c8e67eb7293c404845b3982db895d59c0d1538" },
|
||||
"bufferline.nvim": { "branch": "main", "commit": "5c528bee3dd797d5bd6bae5f229411939b25b203" },
|
||||
"cmp-buffer": { "branch": "main", "commit": "3022dbc9166796b644a841a02de8dd1cc1d311fa" },
|
||||
"cmp-cmdline": { "branch": "main", "commit": "d250c63aa13ead745e3a40f61fdd3470efde3923" },
|
||||
"cmp-nvim-lsp": { "branch": "main", "commit": "39e2eda76828d88b773cc27a3f61d2ad782c922d" },
|
||||
"cmp-nvim-lsp-signature-help": { "branch": "main", "commit": "031e6ba70b0ad5eee49fd2120ff7a2e325b17fa7" },
|
||||
"cmp-nvim-lua": { "branch": "main", "commit": "f12408bdb54c39c23e67cab726264c10db33ada8" },
|
||||
"cmp-path": { "branch": "main", "commit": "91ff86cd9c29299a64f968ebb45846c485725f23" },
|
||||
"cmp_luasnip": { "branch": "master", "commit": "05a9ab28b53f71d1aece421ef32fee2cb857a843" },
|
||||
"dashboard-nvim": { "branch": "master", "commit": "d2c5a4d1341f5ca1ed2ecb4ecfcff2bc8ea18b14" },
|
||||
"fidget.nvim": { "branch": "main", "commit": "e2a175c2abe2d4f65357da1c98c59a5cfb2b543f" },
|
||||
"gitsigns.nvim": { "branch": "main", "commit": "7c27a30450130cd59c4994a6755e3c5d74d83e76" },
|
||||
"kanagawa.nvim": { "branch": "master", "commit": "f491b0fe68fffbece7030181073dfe51f45cda81" },
|
||||
"lazy.nvim": { "branch": "main", "commit": "cf8ecc2c5e4332760431a33534240b0cbc6680ab" },
|
||||
"lspkind-nvim": { "branch": "master", "commit": "a700f1436d4a938b1a1a93c9962dc796afbaef4d" },
|
||||
"lualine.nvim": { "branch": "master", "commit": "b431d228b7bbcdaea818bdc3e25b8cdbe861f056" },
|
||||
"lunar.nvim": { "branch": "master", "commit": "08bbc93b96ad698d22fc2aa01805786bcedc34b9" },
|
||||
"mason-lspconfig.nvim": { "branch": "main", "commit": "4d0e5b49363cac187326998b96aa6a2884e0e89b" },
|
||||
"mason.nvim": { "branch": "main", "commit": "e2f7f9044ec30067bc11800a9e266664b88cda22" },
|
||||
"nvim-autopairs": { "branch": "master", "commit": "ee297f215e95a60b01fde33275cc3c820eddeebe" },
|
||||
"nvim-cmp": { "branch": "main", "commit": "29fb4854573355792df9e156cb779f0d31308796" },
|
||||
"nvim-dap": { "branch": "master", "commit": "7ff6936010b7222fea2caea0f67ed77f1b7c60dd" },
|
||||
"nvim-dap-ui": { "branch": "master", "commit": "ffa89839f97bad360e78428d5c740fdad9a0ff02" },
|
||||
"nvim-dap-virtual-text": { "branch": "master", "commit": "52638640ae309cacdaff785fdbb854437bd1ee5c" },
|
||||
"nvim-lspconfig": { "branch": "master", "commit": "54617a18f4cf46f0c2f6d024fa6feb7515fe036d" },
|
||||
"nvim-nio": { "branch": "master", "commit": "a428f309119086dc78dd4b19306d2d67be884eee" },
|
||||
"nvim-tree.lua": { "branch": "master", "commit": "120ba58254835d412bbc91cffe847e9be835fadd" },
|
||||
"nvim-treesitter": { "branch": "master", "commit": "f9e9370a6f710148f4a3f3f4f23d5349c85c2888" },
|
||||
"nvim-web-devicons": { "branch": "master", "commit": "19d257cf889f79f4022163c3fbb5e08639077bd8" },
|
||||
"playground": { "branch": "master", "commit": "ba48c6a62a280eefb7c85725b0915e021a1a0749" },
|
||||
"plenary.nvim": { "branch": "master", "commit": "2d9b06177a975543726ce5c73fca176cedbffe9d" },
|
||||
"rustaceanvim": { "branch": "master", "commit": "bc8c4b8f7606d5b7c067cd8369e25c1a7ff77bd0" },
|
||||
"telescope.nvim": { "branch": "master", "commit": "a0bbec21143c7bc5f8bb02e0005fa0b982edc026" },
|
||||
"trouble.nvim": { "branch": "main", "commit": "2f3b537f2207ce32f4459f9d56746ee013b5e01b" },
|
||||
"vimwiki": { "branch": "dev", "commit": "72792615e739d0eb54a9c8f7e0a46a6e2407c9e8" }
|
||||
}
|
@@ -5,6 +5,8 @@ vim.cmd 'autocmd! User GoyoLeave Limelight!'
|
||||
|
||||
vim.cmd 'autocmd BufRead,BufNewFile *.wiki,*.md,*.tex set wrap'
|
||||
|
||||
vim.cmd 'au BufRead,BufNewFile *.kdl set filetype=kdl'
|
||||
|
||||
vim.cmd [[autocmd BufWritePre * lua vim.lsp.buf.format()]]
|
||||
|
||||
vim.cmd 'command W :execute \':silent w !sudo tee % > /dev/null\' | :edit!'
|
||||
|
29
lua/maps.lua
29
lua/maps.lua
@@ -3,18 +3,18 @@
|
||||
local maps = {}
|
||||
|
||||
local function map(mode, lhs, rhs, opts)
|
||||
local options = {noremap = true}
|
||||
local options = { noremap = true }
|
||||
if opts then options = vim.tbl_extend('force', options, opts) end
|
||||
vim.api.nvim_set_keymap(mode, lhs, rhs, options)
|
||||
end
|
||||
|
||||
function maps.toggleGoyo()
|
||||
map('n', '<C-g>', ':Goyo<Enter>', {noremap = false})
|
||||
map('n', '<C-g>', ':Goyo<Enter>', { noremap = false })
|
||||
end
|
||||
|
||||
function maps.term()
|
||||
-- Open and move to resized terminal
|
||||
map('n', '<leader>t', '<C-w>s<C-w>j :terminal<CR>:res 5<CR>i', {noremap = false})
|
||||
map('n', '<leader>t', '<C-w>s<C-w>j :terminal<CR>:res 5<CR>i', { noremap = false })
|
||||
-- Enter normal mode in terminal
|
||||
map('t', 'ß<C-N>', '<C-\\><C-N>')
|
||||
end
|
||||
@@ -33,8 +33,8 @@ end
|
||||
|
||||
function maps.moveByRow()
|
||||
-- When text is wrapped, move by terminal rows, not lines, unles a count is provided
|
||||
map('n', 'j', 'v:count == 0 ? \'gj\' : \'j\'', {silent = true, expr = true})
|
||||
map('n', 'k', 'v:count == 0 ? \'gk\' : \'k\'', {silent = true, expr = true})
|
||||
map('n', 'j', 'v:count == 0 ? \'gj\' : \'j\'', { silent = true, expr = true })
|
||||
map('n', 'k', 'v:count == 0 ? \'gk\' : \'k\'', { silent = true, expr = true })
|
||||
end
|
||||
|
||||
function maps.centeredSearch()
|
||||
@@ -42,31 +42,18 @@ function maps.centeredSearch()
|
||||
map('n', 'N', 'Nzzzv')
|
||||
end
|
||||
|
||||
function maps.moveToWindow()
|
||||
map('t', 'ª', '<C-\\><C-N><C-w>h')
|
||||
map('t', 'º', '<C-\\><C-N><C-w>j')
|
||||
map('t', '∆', '<C-\\><C-N><C-w>k')
|
||||
map('t', '@', '<C-\\><C-N><C-w>l')
|
||||
map('i', 'ª', '<C-\\><C-N><C-w>h')
|
||||
map('i', 'º', '<C-\\><C-N><C-w>j')
|
||||
map('i', '∆', '<C-\\><C-N><C-w>k')
|
||||
map('i', '@', '<C-\\><C-N><C-w>l')
|
||||
map('n', 'ª', '<C-w>h')
|
||||
map('n', 'º', '<C-w>j')
|
||||
map('n', '∆', '<C-w>k')
|
||||
map('n', '@', '<C-w>l')
|
||||
end
|
||||
|
||||
function maps.init()
|
||||
vim.g.mapleader = " "
|
||||
|
||||
map('n', '<leader>b', '<cmd>NvimTreeToggle<CR>')
|
||||
map('n', '<leader>cc', '<cmd>Telescope colorscheme<CR>')
|
||||
|
||||
maps.toggleGoyo()
|
||||
maps.term()
|
||||
maps.telescope()
|
||||
maps.fixIndent()
|
||||
maps.moveByRow()
|
||||
maps.centeredSearch()
|
||||
-- maps.moveToWindow()
|
||||
end
|
||||
|
||||
return maps
|
||||
|
@@ -1,59 +0,0 @@
|
||||
-- plugin.lua
|
||||
|
||||
|
||||
require "paq" {
|
||||
-- Handle itself
|
||||
'savq/paq-nvim';
|
||||
|
||||
-- Theme
|
||||
'kyazdani42/nvim-web-devicons';
|
||||
'rktjmp/lush.nvim';
|
||||
'briones-gabriel/darcula-solid.nvim';
|
||||
|
||||
-- treesitter
|
||||
'nvim-treesitter/nvim-treesitter';
|
||||
'nvim-treesitter/playground';
|
||||
|
||||
-- Utils
|
||||
'akinsho/nvim-bufferline.lua';
|
||||
'hoob3rt/lualine.nvim';
|
||||
'j-hui/fidget.nvim';
|
||||
'airblade/vim-gitgutter';
|
||||
'nvim-lua/popup.nvim';
|
||||
'nvim-lua/plenary.nvim';
|
||||
|
||||
-- File Navigation
|
||||
'kyazdani42/nvim-tree.lua';
|
||||
'nvim-telescope/telescope.nvim';
|
||||
|
||||
-- lsp
|
||||
'williamboman/mason.nvim';
|
||||
'williamboman/mason-lspconfig.nvim';
|
||||
'neovim/nvim-lspconfig';
|
||||
'onsails/lspkind-nvim'; -- pictograms
|
||||
'simrat39/rust-tools.nvim';
|
||||
|
||||
-- completion
|
||||
'hrsh7th/cmp-nvim-lsp';
|
||||
'hrsh7th/cmp-nvim-lsp-signature-help';
|
||||
'hrsh7th/cmp-buffer';
|
||||
'hrsh7th/cmp-path';
|
||||
'hrsh7th/cmp-nvim-lua';
|
||||
'hrsh7th/cmp-cmdline';
|
||||
'hrsh7th/nvim-cmp';
|
||||
|
||||
-- snippets needed for cmp
|
||||
'L3MON4D3/LuaSnip';
|
||||
'saadparwaiz1/cmp_luasnip';
|
||||
|
||||
-- autopair
|
||||
'windwp/nvim-autopairs';
|
||||
|
||||
-- Linting & formtatting
|
||||
'jose-elias-alvarez/null-ls.nvim';
|
||||
|
||||
-- writing
|
||||
'vimwiki/vimwiki';
|
||||
'junegunn/goyo.vim';
|
||||
'junegunn/limelight.vim';
|
||||
}
|
17
lua/plugins/dap.lua
Normal file
17
lua/plugins/dap.lua
Normal file
@@ -0,0 +1,17 @@
|
||||
return {
|
||||
{
|
||||
'mfussenegger/nvim-dap',
|
||||
dependencies = { 'nvim-lua/plenary.nvim' }
|
||||
},
|
||||
{
|
||||
'rcarriga/nvim-dap-ui',
|
||||
config = function()
|
||||
require("dapui").setup()
|
||||
end,
|
||||
dependencies = { 'mfussenegger/nvim-dap', 'nvim-neotest/nvim-nio' }
|
||||
},
|
||||
{
|
||||
'theHamsta/nvim-dap-virtual-text',
|
||||
config = true
|
||||
}
|
||||
}
|
261
lua/plugins/lsp.lua
Normal file
261
lua/plugins/lsp.lua
Normal file
@@ -0,0 +1,261 @@
|
||||
local opts = { noremap = true, silent = true }
|
||||
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)
|
||||
|
||||
local lsp_attach = function(client, buf)
|
||||
vim.api.nvim_buf_set_option(buf, "formatexpr", "v:lua.vim.lsp.formatexpr()")
|
||||
vim.api.nvim_buf_set_option(buf, "omnifunc", "v:lua.vim.lsp.omnifunc")
|
||||
vim.api.nvim_buf_set_option(buf, "tagfunc", "v:lua.vim.lsp.tagfunc")
|
||||
|
||||
vim.lsp.inlay_hint.enable(buf, true)
|
||||
|
||||
local bufopts = { noremap = true, silent = true, buffer = buf }
|
||||
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>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)
|
||||
end
|
||||
|
||||
local mason_path = vim.fn.glob(vim.fn.stdpath "data" .. "/mason/packages/codelldb/extension/")
|
||||
local codelldb_path = mason_path .. "adapter/codelldb"
|
||||
local liblldb_path = mason_path .. "lldb/lib/liblldb.so"
|
||||
|
||||
if vim.fn.has "mac" == 1 then
|
||||
liblldb_path = mason_path .. "lldb/lib/liblldb.dylib"
|
||||
end
|
||||
|
||||
return {
|
||||
-- lsp
|
||||
{
|
||||
'williamboman/mason.nvim',
|
||||
config = true
|
||||
},
|
||||
{
|
||||
'williamboman/mason-lspconfig.nvim',
|
||||
config = true
|
||||
},
|
||||
{
|
||||
'neovim/nvim-lspconfig',
|
||||
config = function()
|
||||
local capabilities = require('cmp_nvim_lsp').default_capabilities()
|
||||
local lspconfig = require('lspconfig')
|
||||
|
||||
lspconfig.lua_ls.setup {
|
||||
capabilities = capabilities,
|
||||
root_dir = lspconfig.util.root_pattern('.git'),
|
||||
settings = {
|
||||
Lua = {
|
||||
runtime = {
|
||||
-- Tell the language server which version of Lua you're using (most likely LuaJIT in the case of Neovim)
|
||||
version = 'LuaJIT',
|
||||
},
|
||||
diagnostics = {
|
||||
-- Get the language server to recognize the `vim` global
|
||||
globals = { 'vim' }
|
||||
},
|
||||
workspace = {
|
||||
-- Make the server aware of Neovim runtime files
|
||||
library = vim.api.nvim_get_runtime_file("", true),
|
||||
checkThirdParty = false,
|
||||
},
|
||||
}
|
||||
},
|
||||
on_attach = lsp_attach
|
||||
}
|
||||
lspconfig.ts_ls.setup {
|
||||
capabilities = capabilities,
|
||||
on_attach = lsp_attach
|
||||
}
|
||||
lspconfig.gopls.setup {
|
||||
capabilities = capabilities,
|
||||
on_attach = lsp_attach
|
||||
}
|
||||
--lspconfig.rust_analyzer.setup {
|
||||
-- capabilities = capabilities,
|
||||
-- on_attach = lsp_attach
|
||||
--}
|
||||
lspconfig.bashls.setup {
|
||||
capabilities = capabilities,
|
||||
on_attach = lsp_attach
|
||||
}
|
||||
lspconfig.sqlls.setup({
|
||||
capabilities = capabilities,
|
||||
on_attach = lsp_attach
|
||||
})
|
||||
lspconfig.html.setup({
|
||||
capabilities = capabilities,
|
||||
on_attach = lsp_attach
|
||||
})
|
||||
lspconfig.cssls.setup({
|
||||
capabilities = capabilities,
|
||||
on_attach = lsp_attach
|
||||
})
|
||||
lspconfig.tailwindcss.setup({
|
||||
capabilities = capabilities,
|
||||
on_attach = lsp_attach
|
||||
})
|
||||
lspconfig.phpactor.setup({
|
||||
capabilities = capabilities,
|
||||
on_attach = lsp_attach
|
||||
})
|
||||
capabilities.textDocument.completion.completionItem.snippetSupport = true
|
||||
lspconfig.emmet_ls.setup({
|
||||
capabilities = capabilities,
|
||||
on_attach = lsp_attach
|
||||
})
|
||||
end
|
||||
},
|
||||
{
|
||||
'mrcjkb/rustaceanvim',
|
||||
version = "^3",
|
||||
ft = { "rust" },
|
||||
config = function()
|
||||
vim.g.rustaceanvim = {
|
||||
server = {
|
||||
on_attach = lsp_attach,
|
||||
settings = {
|
||||
-- rust-analyzer language server configuration
|
||||
["rust-analyzer"] = {
|
||||
rustfmt = {
|
||||
extraArgs = { "+nightly" },
|
||||
},
|
||||
cargo = {
|
||||
allFeatures = true,
|
||||
loadOutDirsFromCheck = true,
|
||||
runBuildScripts = true,
|
||||
},
|
||||
-- Add clippy lints for Rust.
|
||||
checkOnSave = {
|
||||
allFeatures = true,
|
||||
command = "clippy",
|
||||
extraArgs = { "--no-deps" },
|
||||
},
|
||||
-- TODO this breaks diagnostics, look into what can be done
|
||||
-- procMacro = {
|
||||
-- enable = true,
|
||||
-- ignored = {
|
||||
-- ["async-trait"] = { "async_trait" },
|
||||
-- ["napi-derive"] = { "napi" },
|
||||
-- ["async-recursion"] = { "async_recursion" },
|
||||
-- },
|
||||
-- },
|
||||
},
|
||||
},
|
||||
}
|
||||
}
|
||||
end
|
||||
},
|
||||
{ 'onsails/lspkind-nvim' }, -- pictograms replace (?) with lspsaga
|
||||
{
|
||||
'j-hui/fidget.nvim',
|
||||
config = true
|
||||
}, -- show lsp status
|
||||
-- completion
|
||||
{
|
||||
'hrsh7th/nvim-cmp',
|
||||
config = function()
|
||||
local cmp = require('cmp')
|
||||
local lspkind = require('lspkind')
|
||||
|
||||
vim.opt.shortmess:append 'c'
|
||||
|
||||
cmp.setup({
|
||||
snippet = {
|
||||
expand = function(args)
|
||||
require('luasnip').lsp_expand(args.body)
|
||||
end,
|
||||
},
|
||||
mapping = cmp.mapping.preset.insert({
|
||||
["<C-n>"] = cmp.mapping.select_next_item { behavior = cmp.SelectBehavior.Insert },
|
||||
["<C-p>"] = cmp.mapping.select_prev_item { behavior = cmp.SelectBehavior.Insert },
|
||||
['<C-b>'] = cmp.mapping(cmp.mapping.scroll_docs(-4), { 'i', 'c' }),
|
||||
['<C-f>'] = cmp.mapping(cmp.mapping.scroll_docs(4), { 'i', 'c' }),
|
||||
['<C-s>'] = cmp.mapping(cmp.mapping.complete(), { 'i', 'c' }),
|
||||
['<C-y>'] = cmp.mapping.confirm({
|
||||
behavior = cmp.ConfirmBehavior.Insert,
|
||||
select = true
|
||||
}),
|
||||
['<C-e>'] = cmp.mapping({
|
||||
i = cmp.mapping.abort(),
|
||||
c = cmp.mapping.close(),
|
||||
}),
|
||||
['<CR>'] = cmp.mapping.confirm({ select = true }),
|
||||
}),
|
||||
sources = cmp.config.sources({
|
||||
{ name = 'nvim_lua' },
|
||||
{ name = 'nvim_lsp' },
|
||||
{ name = 'path' },
|
||||
{ name = 'luasnip' },
|
||||
{ name = 'nvim_lsp_signature_help' },
|
||||
}, {
|
||||
{ name = 'buffer', keyword_length = 5 },
|
||||
}),
|
||||
formatting = {
|
||||
format = lspkind.cmp_format {
|
||||
with_text = true,
|
||||
menu = {
|
||||
buffer = "[buf]",
|
||||
nvim_lsp = "[LSP]",
|
||||
nvim_lua = "[api]",
|
||||
path = "[path]",
|
||||
luasnip = "[snip]",
|
||||
}
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
-- Use buffer source for `/` (basically search words in buffer)
|
||||
cmp.setup.cmdline('/', {
|
||||
sources = {
|
||||
{ name = 'buffer' }
|
||||
}
|
||||
})
|
||||
|
||||
-- Use cmdline & path source for ':'
|
||||
cmp.setup.cmdline(':', {
|
||||
sources = cmp.config.sources({
|
||||
{ name = 'path' }
|
||||
}, {
|
||||
{ name = 'cmdline' }
|
||||
})
|
||||
})
|
||||
end,
|
||||
event = 'InsertEnter',
|
||||
dependencies = {
|
||||
'hrsh7th/cmp-nvim-lsp',
|
||||
'hrsh7th/cmp-nvim-lsp-signature-help',
|
||||
'hrsh7th/cmp-buffer',
|
||||
'hrsh7th/cmp-path',
|
||||
'hrsh7th/cmp-nvim-lua',
|
||||
'hrsh7th/cmp-cmdline',
|
||||
'saadparwaiz1/cmp_luasnip',
|
||||
}
|
||||
},
|
||||
{
|
||||
'L3MON4D3/LuaSnip',
|
||||
version = "v2.*",
|
||||
build = "make install_jsregexp",
|
||||
config = function()
|
||||
require("luasnip.loaders.from_lua").load({ paths = "~/.config/nvim/snippets/" })
|
||||
end
|
||||
},
|
||||
{
|
||||
'windwp/nvim-autopairs',
|
||||
config = true
|
||||
},
|
||||
{
|
||||
"folke/trouble.nvim",
|
||||
dependencies = { "nvim-tree/nvim-web-devicons" },
|
||||
opts = {
|
||||
-- your configuration comes here
|
||||
-- or leave it empty to use the default settings
|
||||
-- refer to the configuration section below
|
||||
},
|
||||
},
|
||||
}
|
19
lua/plugins/navigation.lua
Normal file
19
lua/plugins/navigation.lua
Normal file
@@ -0,0 +1,19 @@
|
||||
return {
|
||||
{
|
||||
'nvim-telescope/telescope.nvim',
|
||||
version = '0.1.*',
|
||||
dependencies = { 'nvim-lua/plenary.nvim' },
|
||||
},
|
||||
{
|
||||
'nvim-tree/nvim-tree.lua',
|
||||
config = function()
|
||||
require('nvim-tree').setup {
|
||||
view = {
|
||||
width = 30,
|
||||
side = 'left',
|
||||
},
|
||||
}
|
||||
end,
|
||||
dependencies = { 'nvim-tree/nvim-web-devicons' }
|
||||
}
|
||||
}
|
55
lua/plugins/style.lua
Normal file
55
lua/plugins/style.lua
Normal file
@@ -0,0 +1,55 @@
|
||||
return {
|
||||
{
|
||||
'rebelot/kanagawa.nvim',
|
||||
config = function()
|
||||
vim.opt.guifont = 'Source Code Pro for Powerline'
|
||||
vim.cmd('colorscheme kanagawa')
|
||||
vim.cmd('set termguicolors')
|
||||
vim.opt.syntax = 'on'
|
||||
end
|
||||
},
|
||||
{ 'lunarvim/lunar.nvim' },
|
||||
{
|
||||
'nvim-treesitter/nvim-treesitter',
|
||||
build = ':TSUpdate',
|
||||
config = function()
|
||||
require('nvim-treesitter.configs').setup {
|
||||
highlight = {
|
||||
enable = true,
|
||||
additional_vim_regex_highlighting = false,
|
||||
},
|
||||
indent = {
|
||||
enable = true,
|
||||
disable = { "html" }
|
||||
}
|
||||
}
|
||||
end,
|
||||
dependencies = { 'nvim-treesitter/playground' }
|
||||
},
|
||||
{
|
||||
'akinsho/bufferline.nvim',
|
||||
version = "*",
|
||||
config = true,
|
||||
dependencies = { 'nvim-tree/nvim-web-devicons' }
|
||||
},
|
||||
{
|
||||
'hoob3rt/lualine.nvim',
|
||||
config = function()
|
||||
require('lualine').setup {
|
||||
options = {
|
||||
theme = 'kanagawa'
|
||||
}
|
||||
}
|
||||
end
|
||||
},
|
||||
{
|
||||
'lewis6991/gitsigns.nvim',
|
||||
config = true
|
||||
},
|
||||
{
|
||||
'glepnir/dashboard-nvim',
|
||||
event = 'VimEnter',
|
||||
config = true,
|
||||
dependencies = { 'nvim-tree/nvim-web-devicons' }
|
||||
},
|
||||
}
|
12
lua/plugins/writing.lua
Normal file
12
lua/plugins/writing.lua
Normal file
@@ -0,0 +1,12 @@
|
||||
return {
|
||||
-- writing
|
||||
{
|
||||
'vimwiki/vimwiki',
|
||||
ft = { 'md', 'wiki', 'tex' },
|
||||
config = function()
|
||||
vim.g.vimwiki_list = { { path = '~/Documents/Buch/wiki', syntax = 'markdown', ext = '.md' } }
|
||||
end
|
||||
},
|
||||
--{ 'junegunn/goyo.vim' }, -- try replacing these 2 at some point because they don't work that well anymore
|
||||
--{ 'junegunn/limelight.vim' },
|
||||
}
|
@@ -1,73 +0,0 @@
|
||||
-- Completion
|
||||
|
||||
local completion = {}
|
||||
local cmp = require'cmp'
|
||||
local lspkind = require'lspkind'
|
||||
|
||||
vim.opt.shortmess:append 'c'
|
||||
|
||||
cmp.setup({
|
||||
snippet = {
|
||||
expand = function(args)
|
||||
require('luasnip').lsp_expand(args.body)
|
||||
end,
|
||||
},
|
||||
mapping = cmp.mapping.preset.insert({
|
||||
["<C-n>"] = cmp.mapping.select_next_item { behavior = cmp.SelectBehavior.Insert },
|
||||
["<C-p>"] = cmp.mapping.select_prev_item { behavior = cmp.SelectBehavior.Insert },
|
||||
['<C-b>'] = cmp.mapping(cmp.mapping.scroll_docs(-4), { 'i', 'c' }),
|
||||
['<C-f>'] = cmp.mapping(cmp.mapping.scroll_docs(4), { 'i', 'c' }),
|
||||
['<C-s>'] = cmp.mapping(cmp.mapping.complete(), { 'i', 'c' }),
|
||||
['<C-y>'] = cmp.mapping.confirm({
|
||||
behavior = cmp.ConfirmBehavior.Insert,
|
||||
select = true
|
||||
}),
|
||||
['<C-e>'] = cmp.mapping({
|
||||
i = cmp.mapping.abort(),
|
||||
c = cmp.mapping.close(),
|
||||
}),
|
||||
['<CR>'] = cmp.mapping.confirm({ select = true }),
|
||||
}),
|
||||
sources = cmp.config.sources({
|
||||
{ name = 'nvim_lua' },
|
||||
{ name = 'nvim_lsp' },
|
||||
{ name = 'path' },
|
||||
{ name = 'luasnip' },
|
||||
{ name = 'nvim_lsp_signature_help' },
|
||||
}, {
|
||||
{ name = 'buffer', keyword_length = 5 },
|
||||
}),
|
||||
formatting = {
|
||||
format = lspkind.cmp_format {
|
||||
with_text = true,
|
||||
menu = {
|
||||
buffer = "[buf]",
|
||||
nvim_lsp = "[LSP]",
|
||||
nvim_lua = "[api]",
|
||||
path = "[path]",
|
||||
luasnip = "[snip]",
|
||||
}
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
-- Use buffer source for `/` (basically search words in buffer)
|
||||
cmp.setup.cmdline('/', {
|
||||
sources = {
|
||||
{ name = 'buffer' }
|
||||
}
|
||||
})
|
||||
|
||||
-- Use cmdline & path source for ':'
|
||||
cmp.setup.cmdline(':', {
|
||||
sources = cmp.config.sources({
|
||||
{ name = 'path' }
|
||||
}, {
|
||||
{ name = 'cmdline' }
|
||||
})
|
||||
})
|
||||
|
||||
-- autopair
|
||||
require('nvim-autopairs').setup {}
|
||||
|
||||
return completion
|
@@ -1,47 +0,0 @@
|
||||
-- settings.lua
|
||||
|
||||
local settings = {}
|
||||
|
||||
function settings.initMisc()
|
||||
vim.opt.backup = false
|
||||
vim.opt.undodir = '/Users/fschmidt/.cache/nvim/undodir'
|
||||
vim.opt.swapfile = false
|
||||
vim.opt.undofile = true
|
||||
vim.opt.smartcase = true
|
||||
vim.opt.ignorecase = true
|
||||
vim.opt.laststatus = 2
|
||||
vim.opt.hidden = true
|
||||
vim.opt.hlsearch = false
|
||||
vim.opt.incsearch = true
|
||||
vim.opt.scrolloff = 12
|
||||
vim.opt.sidescrolloff = 8
|
||||
vim.opt.mouse = 'a'
|
||||
vim.opt.autochdir = true
|
||||
vim.opt.clipboard = 'unnamed,unnamedplus'
|
||||
vim.opt.number = true
|
||||
vim.opt.wrap = false
|
||||
vim.opt.signcolumn = 'yes:2'
|
||||
vim.opt.list = true
|
||||
vim.opt.listchars = 'tab:▸ ,trail:·'
|
||||
vim.opt.shiftwidth = 4
|
||||
vim.opt.tabstop = 4
|
||||
vim.opt.softtabstop = 4
|
||||
vim.opt.expandtab = false
|
||||
vim.opt.autoindent = true
|
||||
vim.opt.completeopt = { "menu", "menuone", "noselect" }
|
||||
end
|
||||
|
||||
function settings.initVimWiki()
|
||||
vim.g.vimwiki_list = {{path = '~/Documents/Buch/wiki', syntax = 'markdown', ext = '.md'}}
|
||||
end
|
||||
|
||||
function settings.init()
|
||||
settings.initMisc()
|
||||
settings.initVimWiki()
|
||||
require'settings.theme'.init()
|
||||
require'settings.lsp'.init()
|
||||
require'settings.completion'
|
||||
require'settings.tree'
|
||||
end
|
||||
|
||||
return settings
|
@@ -1,61 +0,0 @@
|
||||
-- LSP Config
|
||||
|
||||
local lsp = {}
|
||||
|
||||
local lsp_attach = function(client, buf)
|
||||
vim.api.nvim_buf_set_option(buf, "formatexpr", "v:lua.vim.lsp.formatexpr()")
|
||||
vim.api.nvim_buf_set_option(buf, "omnifunc", "v:lua.vim.lsp.omnifunc")
|
||||
vim.api.nvim_buf_set_option(buf, "tagfunc", "v:lua.vim.lsp.tagfunc")
|
||||
|
||||
local bufopts = { noremap=true, silent=true, buffer=buf }
|
||||
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>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)
|
||||
end
|
||||
|
||||
function lsp.init()
|
||||
require'mason'.setup()
|
||||
require'mason-lspconfig'.setup()
|
||||
|
||||
local capabilities = require('cmp_nvim_lsp').update_capabilities(vim.lsp.protocol.make_client_capabilities())
|
||||
local lspconfig = require'lspconfig'
|
||||
|
||||
lspconfig.sumneko_lua.setup {
|
||||
capabilities = capabilities,
|
||||
settings = {
|
||||
Lua = {
|
||||
diagnostics = {
|
||||
globals = { 'vim' }
|
||||
}
|
||||
}
|
||||
},
|
||||
on_attach = lsp_attach
|
||||
}
|
||||
lspconfig.tsserver.setup {
|
||||
capabilities = capabilities,
|
||||
on_attach = lsp_attach
|
||||
}
|
||||
lspconfig.gopls.setup {
|
||||
capabilities = capabilities,
|
||||
on_attach = lsp_attach
|
||||
}
|
||||
--lspconfig.rust_analyzer.setup {
|
||||
-- capabilities = capabilities,
|
||||
-- on_attach = lsp_attach
|
||||
--}
|
||||
require("rust-tools").setup({
|
||||
server = {
|
||||
capabilities = capabilities,
|
||||
on_attach = lsp_attach,
|
||||
standalone = false
|
||||
}
|
||||
})
|
||||
end
|
||||
|
||||
return lsp
|
@@ -1,41 +0,0 @@
|
||||
-- Theming
|
||||
|
||||
local theme = {}
|
||||
|
||||
function theme.initFont()
|
||||
vim.opt.guifont = 'Source Code Pro for Powerline'
|
||||
end
|
||||
|
||||
function theme.lsp_status()
|
||||
require'fidget'.setup {}
|
||||
end
|
||||
|
||||
function theme.initStatusline()
|
||||
require'lualine'.setup {
|
||||
options = {
|
||||
theme = 'onedark'
|
||||
}
|
||||
}
|
||||
end
|
||||
|
||||
function theme.initBufferline()
|
||||
local bufferline = require'bufferline'
|
||||
bufferline.setup()
|
||||
end
|
||||
|
||||
function theme.initColorscheme()
|
||||
vim.g.limelight_conceal_ctermfg = 'gray'
|
||||
vim.cmd'colorscheme darcula-solid'
|
||||
vim.cmd'set termguicolors'
|
||||
vim.opt.syntax = 'on'
|
||||
end
|
||||
|
||||
function theme.init()
|
||||
theme.initFont()
|
||||
theme.lsp_status()
|
||||
theme.initStatusline()
|
||||
theme.initBufferline()
|
||||
theme.initColorscheme()
|
||||
end
|
||||
|
||||
return theme
|
@@ -1,60 +0,0 @@
|
||||
-- Tree
|
||||
|
||||
local tree = {}
|
||||
|
||||
require'nvim-tree'.setup {
|
||||
disable_netrw = true,
|
||||
hijack_netrw = true,
|
||||
open_on_setup = false,
|
||||
ignore_ft_on_setup = {},
|
||||
open_on_tab = false,
|
||||
hijack_cursor = false,
|
||||
update_cwd = false,
|
||||
hijack_directories = {
|
||||
enable = true,
|
||||
auto_open = true,
|
||||
},
|
||||
diagnostics = {
|
||||
enable = false,
|
||||
icons = {
|
||||
hint = "",
|
||||
info = "",
|
||||
warning = "",
|
||||
error = "",
|
||||
}
|
||||
},
|
||||
update_focused_file = {
|
||||
enable = false,
|
||||
update_cwd = false,
|
||||
ignore_list = {}
|
||||
},
|
||||
system_open = {
|
||||
cmd = nil,
|
||||
args = {}
|
||||
},
|
||||
filters = {
|
||||
dotfiles = false,
|
||||
custom = {}
|
||||
},
|
||||
git = {
|
||||
enable = true,
|
||||
ignore = true,
|
||||
timeout = 500,
|
||||
},
|
||||
view = {
|
||||
width = 30,
|
||||
hide_root_folder = false,
|
||||
side = 'left',
|
||||
mappings = {
|
||||
custom_only = false,
|
||||
list = {}
|
||||
}
|
||||
},
|
||||
actions = {
|
||||
open_file = {
|
||||
resize_window = false
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return tree
|
25
snippets/go.lua
Normal file
25
snippets/go.lua
Normal file
@@ -0,0 +1,25 @@
|
||||
local ls = require("luasnip")
|
||||
local s = ls.s
|
||||
local i = ls.i
|
||||
local t = ls.t
|
||||
|
||||
local d = ls.dynamic_node
|
||||
local c = ls.choice_node
|
||||
local f = ls.function_node
|
||||
local sn = ls.snippet_node
|
||||
|
||||
local fmt = require("luasnip.extras.fmt").fmt
|
||||
local rep = require("luasnip.extras").rep
|
||||
|
||||
local snippets, autosnippets = {}, {}
|
||||
|
||||
local errorSnippet = s("error", fmt([[
|
||||
if err != nil {{
|
||||
{}
|
||||
}}
|
||||
]], {
|
||||
i(1, "return nil, err")
|
||||
}))
|
||||
table.insert(snippets, errorSnippet)
|
||||
|
||||
return snippets, autosnippets
|
Reference in New Issue
Block a user