130 lines
4.3 KiB
Lua
130 lines
4.3 KiB
Lua
|
local map = vim.api.nvim_set_keymap
|
||
|
|
||
|
vim.g.mapleader = " "
|
||
|
|
||
|
require("config.lazy")
|
||
|
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 = { "habamax" } },
|
||
|
-- automatically check for plugin updates
|
||
|
checker = { enabled = true },
|
||
|
})
|
||
|
|
||
|
vim.opt.compatible = false -- disable compatibility to old-time vi
|
||
|
vim.opt.showmatch = true -- show matching brackets.
|
||
|
vim.opt.ignorecase = true -- case insensitive matching
|
||
|
vim.opt.cursorline = true -- highlights the current line in the editor
|
||
|
vim.opt.hlsearch = true -- highlight search results
|
||
|
vim.opt.number = true -- add line numbers
|
||
|
vim.opt.relativenumber = true -- display relative line numbers
|
||
|
vim.opt.colorcolumn = '88' -- set colour columns for good coding style
|
||
|
vim.opt.tabstop = 4 -- number of columns occupied by a tab character
|
||
|
vim.opt.shiftwidth = 4 -- width for autoindents
|
||
|
vim.opt.softtabstop = 4 -- see multiple spaces as tabstops so <BS> does the right thing
|
||
|
|
||
|
vim.opt.listchars:append {
|
||
|
eol = "$",
|
||
|
space = "·",
|
||
|
tab = "▏ ",
|
||
|
trail = "_",
|
||
|
nbsp = "~",
|
||
|
extends = ">",
|
||
|
precedes = "<",
|
||
|
}
|
||
|
vim.opt.list = true
|
||
|
|
||
|
options = { noremap = true }
|
||
|
map('n', '<Leader>ff', ':Telescope find_files<Enter>', options)
|
||
|
map('n', '<Leader>fg', ':Telescope git_files<Enter>', options)
|
||
|
map('n', '<Leader>gc', ':Telescope git_commits<Enter>', options)
|
||
|
map('n', '<Leader><Space>', ':Telescope buffers<Enter>', options)
|
||
|
map('n', '<Leader>t', ':TagbarToggle<Enter>', options)
|
||
|
|
||
|
vim.cmd([[
|
||
|
"set mouse=v " middle-click paste with mouse
|
||
|
"set autoindent " indent a new line the same amount as the line just typed
|
||
|
"set wildmode=longest,list " get bash-like tab completions
|
||
|
"filetype plugin indent on " allows auto-indenting depending on file type
|
||
|
" set expandtab " convert tabs to white space
|
||
|
|
||
|
" specify directory for plugins
|
||
|
"call plug#begin('~/.config/nvim/plugged')
|
||
|
|
||
|
"Plug 'echasnovski/mini.icons'
|
||
|
"Plug 'nvim-tree/nvim-web-devicons'
|
||
|
"Plug 'preservim/tagbar'
|
||
|
|
||
|
"Plug 'rebelot/kanagawa.nvim'
|
||
|
|
||
|
" Conquer on Completion
|
||
|
" Use release branch (recommended)
|
||
|
"Plug 'neoclide/coc.nvim', {'branch': 'release'}
|
||
|
" initialize plugin system
|
||
|
"call plug#end()
|
||
|
|
||
|
"colorscheme kanagawa
|
||
|
|
||
|
" In your init.lua or init.vim
|
||
|
set termguicolors
|
||
|
"lua << EOF
|
||
|
"require("bufferline").setup{}
|
||
|
"EO
|
||
|
]])
|
||
|
|
||
|
----------------------------------------------------------------
|
||
|
-- LSP
|
||
|
----------------------------------------------------
|
||
|
-- Reserve a space in the gutter
|
||
|
-- This will avoid an annoying layout shift in the screen
|
||
|
vim.opt.signcolumn = 'yes'
|
||
|
|
||
|
-- Add cmp_nvim_lsp capabilities settings to lspconfig
|
||
|
-- This should be executed before you configure any language server
|
||
|
local lspconfig_defaults = require('lspconfig').util.default_config
|
||
|
lspconfig_defaults.capabilities = vim.tbl_deep_extend(
|
||
|
'force',
|
||
|
lspconfig_defaults.capabilities,
|
||
|
require('cmp_nvim_lsp').default_capabilities()
|
||
|
)
|
||
|
|
||
|
-- This is where you enable features that only work
|
||
|
-- if there is a language server active in the file
|
||
|
vim.api.nvim_create_autocmd('LspAttach', {
|
||
|
desc = 'LSP actions',
|
||
|
callback = function(event)
|
||
|
local opts = {buffer = event.buf}
|
||
|
|
||
|
vim.keymap.set('n', 'K', '<cmd>lua vim.lsp.buf.hover()<cr>', opts)
|
||
|
vim.keymap.set('n', 'gd', '<cmd>lua vim.lsp.buf.definition()<cr>', opts)
|
||
|
vim.keymap.set('n', 'gD', '<cmd>lua vim.lsp.buf.declaration()<cr>', opts)
|
||
|
vim.keymap.set('n', 'gi', '<cmd>lua vim.lsp.buf.implementation()<cr>', opts)
|
||
|
vim.keymap.set('n', 'go', '<cmd>lua vim.lsp.buf.type_definition()<cr>', opts)
|
||
|
vim.keymap.set('n', 'gr', '<cmd>lua vim.lsp.buf.references()<cr>', opts)
|
||
|
vim.keymap.set('n', 'gs', '<cmd>lua vim.lsp.buf.signature_help()<cr>', opts)
|
||
|
vim.keymap.set('n', '<F2>', '<cmd>lua vim.lsp.buf.rename()<cr>', opts)
|
||
|
vim.keymap.set({'n', 'x'}, '<F3>', '<cmd>lua vim.lsp.buf.format({async = true})<cr>', opts)
|
||
|
vim.keymap.set('n', '<F4>', '<cmd>lua vim.lsp.buf.code_action()<cr>', opts)
|
||
|
end,
|
||
|
})
|
||
|
|
||
|
require('lspconfig').clangd.setup({})
|
||
|
|
||
|
local cmp = require('cmp')
|
||
|
|
||
|
cmp.setup({
|
||
|
sources = {
|
||
|
{name = 'nvim_lsp'},
|
||
|
},
|
||
|
snippet = {
|
||
|
expand = function(args)
|
||
|
require('luasnip').lsp_expand(args.body)
|
||
|
end,
|
||
|
},
|
||
|
mapping = cmp.mapping.preset.insert({}),
|
||
|
})
|