dotfiles/config/nvim/init.vim

156 lines
3.1 KiB
VimL
Raw Normal View History

2024-02-01 19:34:22 -08:00
" (Neo)vim Configuration
" By Flying_Stitchman
" 4 Jan 2022
" Basic Configuration
syntax on
set spell
set hlsearch
set ignorecase
set number relativenumber
set noswapfile
inoremap jk <ESC>
xnoremap gy "+y
let mapleader = "`"
" Good indents "
set tabstop=2
set shiftwidth=2
set expandtab
" Make Lines Wrap Properly
set linebreak
set wrap
" True Color Support
if has('nvim')
set t_8f=[38;2;%lu;%lu;%lum
set t_8b=[48;2;%lu;%lu;%lum
set termguicolors
endif
"colorscheme cwcolors
" Highlight Trailing Spaces
let c_space_errors=1
set noincsearch
" Plugs
"call plug#begin()
"Plug 'neovim/nvim-lspconfig'
"Plug 'jackguo380/vim-lsp-cxx-highlight'
"Plug 'folke/tokyonight.nvim', { 'branch': 'main' }
"Plug 'tribela/vim-transparent'
"Plug 'hrsh7th/nvim-cmp'
"Plug 'hrsh7th/cmp-nvim-lsp'
"Plug 'saadparwaiz1/cmp_luasnip'
"Plug 'L3MON4D3/LuaSnip'
"call plug#end()
let g:airline#extensions#wordcount#filetypes = '\vasciidoc|help|mail|markdown|markdown.pandoc|org|rst|tex|text'
set laststatus=2 " enables vim-airline.
" C Syntax highlighting
lua << EOF
require'lspconfig'.rust_analyzer.setup{}
require'lspconfig'.texlab.setup{}
require'lspconfig'.svls.setup{}
require'lspconfig'.pylsp.setup{
settings = {
pylsp = {
plugins = {
pycodestyle = {
ignore = {'W391'},
maxLineLength = 100
},
pylint = {
enabled = false
},
pyflakes = {
enabled = true
}
}
}
}
}
require'lspconfig'.ccls.setup{
init_options = {
highlight = {
lsRanges = true;
}
}
}
-- Add additional capabilities supported by nvim-cmp
local capabilities = require("cmp_nvim_lsp").default_capabilities()
local lspconfig = require('lspconfig')
-- Enable some language servers with the additional completion capabilities offered by nvim-cmp
local servers = { 'clangd', 'rust_analyzer', 'tsserver' }
for _, lsp in ipairs(servers) do
lspconfig[lsp].setup {
-- on_attach = my_custom_on_attach,
capabilities = capabilities,
}
end
-- luasnip setup
local luasnip = require 'luasnip'
-- nvim-cmp setup
local cmp = require 'cmp'
cmp.setup {
snippet = {
expand = function(args)
luasnip.lsp_expand(args.body)
end,
},
mapping = cmp.mapping.preset.insert({
['<C-u>'] = cmp.mapping.scroll_docs(-4), -- Up
['<C-d>'] = cmp.mapping.scroll_docs(4), -- Down
-- C-b (back) C-f (forward) for snippet placeholder navigation.
['<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' },
},
}
EOF
" Color Themes
colorscheme tokyonight
hi Comment guifg=#e69dc5
hi Linenr guifg=#a672f3