234 lines
5.5 KiB
Lua
234 lines
5.5 KiB
Lua
-- init.lua - Neovim configuration converted from init.vim
|
|
|
|
-- Plugin setup using vim-plug
|
|
local Plug = vim.fn['plug#']
|
|
|
|
vim.call('plug#begin', '~/.vim/plugged')
|
|
|
|
-- UI related
|
|
Plug('chriskempson/base16-vim')
|
|
Plug('vim-airline/vim-airline')
|
|
Plug('vim-airline/vim-airline-themes')
|
|
|
|
-- Better Visual Guide
|
|
Plug('Yggdroot/indentLine')
|
|
|
|
-- Syntax check
|
|
Plug('w0rp/ale')
|
|
|
|
-- Autocomplete
|
|
Plug('ncm2/ncm2')
|
|
Plug('roxma/nvim-yarp')
|
|
Plug('ncm2/ncm2-bufword')
|
|
Plug('ncm2/ncm2-path')
|
|
Plug('ncm2/ncm2-jedi')
|
|
|
|
-- Formatter
|
|
Plug('Chiel92/vim-autoformat')
|
|
|
|
-- Themes
|
|
Plug('pineapplegiant/spaceduck', { branch = 'main' })
|
|
Plug('folke/tokyonight.nvim')
|
|
Plug('EdenEast/nightfox.nvim')
|
|
Plug('bluz71/vim-moonfly-colors')
|
|
Plug('NLKNguyen/papercolor-theme')
|
|
|
|
-- Python Plugins
|
|
Plug('Valloric/YouCompleteMe')
|
|
Plug('vim-syntastic/syntastic')
|
|
Plug('nvie/vim-flake8')
|
|
Plug('python-mode/python-mode')
|
|
Plug('airblade/vim-gitgutter')
|
|
|
|
-- General development plugins
|
|
Plug('scrooloose/nerdtree')
|
|
Plug('flazz/vim-colorschemes')
|
|
Plug('davidhalter/jedi-vim')
|
|
Plug('ervandew/supertab')
|
|
Plug('ryanoasis/vim-webdevicons')
|
|
Plug('direnv/direnv.vim')
|
|
Plug('sheerun/vim-polyglot')
|
|
Plug('tpope/vim-fugitive')
|
|
Plug('junegunn/fzf.vim')
|
|
Plug('navarasu/onedark.nvim')
|
|
Plug('stevearc/conform.nvim')
|
|
|
|
-- Bind zonefile
|
|
Plug('seveas/bind.vim')
|
|
|
|
-- Extended RST functionality
|
|
Plug('drmikehenry/vim-extline')
|
|
Plug('brookhong/DBGPavim')
|
|
Plug('dhruvasagar/vim-table-mode')
|
|
Plug('godlygeek/tabular')
|
|
Plug('plasticboy/vim-markdown')
|
|
|
|
-- Additional languages
|
|
Plug('nathanielc/vim-tickscript')
|
|
Plug('fatih/vim-go')
|
|
Plug('dbeniamine/cheat.sh-vim')
|
|
Plug('jacqueswww/vim-vyper')
|
|
Plug('tomlion/vim-solidity')
|
|
|
|
-- AI assistance
|
|
Plug('Exafunction/windsurf.vim', { branch = 'main' })
|
|
Plug('glacambre/firenvim', { ['do'] = function() vim.fn['firenvim#install'](0) end })
|
|
|
|
vim.call('plug#end')
|
|
|
|
-- Basic settings
|
|
vim.opt.compatible = false
|
|
vim.opt.splitright = true
|
|
vim.opt.number = true
|
|
vim.opt.relativenumber = true
|
|
vim.opt.incsearch = true
|
|
vim.opt.encoding = 'utf-8'
|
|
vim.opt.wrap = true
|
|
vim.opt.linebreak = true
|
|
vim.opt.list = false
|
|
vim.opt.mouse = 'a'
|
|
vim.opt.laststatus = 2
|
|
vim.opt.cursorline = true
|
|
|
|
-- Tab settings
|
|
vim.opt.tabstop = 4
|
|
vim.opt.shiftwidth = 4
|
|
vim.opt.smarttab = true
|
|
vim.opt.softtabstop = 4
|
|
vim.opt.autoindent = true
|
|
vim.opt.expandtab = true
|
|
|
|
-- Terminal colors
|
|
if vim.fn.exists('+termguicolors') == 1 then
|
|
vim.opt.termguicolors = true
|
|
vim.cmd([[let &t_8f = "\<Esc>[38;2;%lu;%lu;%lum"]])
|
|
vim.cmd([[let &t_8b = "\<Esc>[48;2;%lu;%lu;%lum"]])
|
|
end
|
|
|
|
-- Colorscheme
|
|
vim.cmd('colorscheme tokyonight-night')
|
|
|
|
-- Airline theme
|
|
vim.g.airline_theme = 'spaceduck'
|
|
vim.g.airline_powerline_fonts = 1
|
|
vim.g.Powerline_symbols = 'fancy'
|
|
|
|
-- Font settings
|
|
vim.opt.guifont = 'Sauce Code Powerline Plus Nerd File Types 9'
|
|
|
|
-- Filetype settings
|
|
vim.cmd('filetype plugin indent on')
|
|
|
|
-- Python syntax highlighting
|
|
vim.g.python_highlight_all = 1
|
|
vim.cmd('syntax on')
|
|
|
|
-- Python attempt fix
|
|
if not vim.fn.has('patch-8.1.201') then
|
|
pcall(function() vim.cmd('silent! python3 1') end)
|
|
end
|
|
|
|
-- Command mappings
|
|
vim.cmd([[cmap w!! w !sudo tee > /dev/null %]])
|
|
|
|
-- Key mappings
|
|
vim.keymap.set('n', '<F2>', ':NERDTreeToggle<CR>', { noremap = true })
|
|
vim.keymap.set('n', '<space>', 'za', { noremap = true })
|
|
vim.keymap.set('i', '<C-L>', function()
|
|
return vim.fn['copilot#Accept']("\r")
|
|
end, { silent = true, script = true, expr = true })
|
|
|
|
-- Python-mode settings
|
|
vim.g.pymode_rope = 0
|
|
vim.g.pymode_doc = 1
|
|
vim.g.pymode_doc_key = 'K'
|
|
vim.g.pymode_lint = 1
|
|
vim.g.pymode_lint_checker = 'flake8,pep8'
|
|
vim.g.pymode_lint_write = 1
|
|
vim.g.pymode_virtualenv = 1
|
|
vim.g.pymode_breakpoint = 1
|
|
vim.g.pymode_breakpoint_key = '<leader>b'
|
|
vim.g.pymode_syntax = 1
|
|
vim.g.pymode_syntax_all = 1
|
|
vim.g.pymode_syntax_indent_errors = vim.g.pymode_syntax_all
|
|
vim.g.pymode_syntax_space_errors = vim.g.pymode_syntax_all
|
|
vim.g.pymode_folding = 0
|
|
vim.g.pymode_python = 'python3'
|
|
|
|
-- RIV settings
|
|
vim.g.riv_fold_level = 0
|
|
vim.g.riv_fold_auto_update = 0
|
|
|
|
-- DBGPavim settings
|
|
vim.g.dbgPavimPort = 9000
|
|
vim.g.dbgPavimBreakAtEntry = 0
|
|
vim.g.dbgPavimOnce = 1
|
|
|
|
-- Table mode settings
|
|
vim.g.table_mode_corner_corner = '+'
|
|
vim.g.table_mode_header_fillchar = '='
|
|
|
|
-- Webdevicons settings
|
|
vim.g.webdevicons_enable = 1
|
|
vim.g.webdevicons_enable_nerdtree = 1
|
|
|
|
-- FZF layout
|
|
vim.g.fzf_layout = { window = { width = 0.8, height = 0.5, highlight = 'Comment' } }
|
|
|
|
-- IndentLine settings
|
|
vim.g.indentLine_fileTypeExclude = { 'markdown' }
|
|
|
|
-- Copilot settings
|
|
vim.g.copilot_no_tab_map = true
|
|
|
|
-- Autocommands
|
|
local augroup = vim.api.nvim_create_augroup('vimrc_autocmds', { clear = true })
|
|
|
|
vim.api.nvim_create_autocmd('FileType', {
|
|
group = augroup,
|
|
pattern = 'python',
|
|
callback = function()
|
|
vim.cmd('highlight Excess ctermbg=DarkGrey guibg=Black')
|
|
vim.fn.matchadd('Excess', [[\%80v.*]])
|
|
vim.opt_local.wrap = false
|
|
end
|
|
})
|
|
|
|
vim.api.nvim_create_autocmd('FileType', {
|
|
group = augroup,
|
|
pattern = 'markdown',
|
|
callback = function()
|
|
vim.opt_local.textwidth = 80
|
|
end
|
|
})
|
|
|
|
vim.api.nvim_create_autocmd('FileType', {
|
|
pattern = 'yaml',
|
|
callback = function()
|
|
vim.opt_local.tabstop = 2
|
|
vim.opt_local.softtabstop = 2
|
|
vim.opt_local.shiftwidth = 2
|
|
vim.opt_local.expandtab = true
|
|
end
|
|
})
|
|
|
|
vim.api.nvim_create_autocmd('FileType', {
|
|
pattern = 'gitcommit',
|
|
callback = function()
|
|
vim.fn.setpos('.', {0, 1, 1, 0})
|
|
end
|
|
})
|
|
|
|
require('conform').setup({
|
|
formatters_by_ft = {
|
|
python = { 'black' },
|
|
},
|
|
})
|
|
|
|
vim.api.nvim_create_autocmd("BufWritePre", {
|
|
pattern = "*.py",
|
|
callback = function(args)
|
|
require("conform").format({ bufnr = args.buf })
|
|
end,
|
|
})
|
|
|