You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
288 lines
8.8 KiB
288 lines
8.8 KiB
set nocompatible " disable compatibility to old-time vi
|
|
set showmatch " show matching
|
|
set ignorecase " case insensitive
|
|
set hlsearch " highlight search
|
|
set incsearch " incremental search
|
|
set tabstop=4 " number of columns occupied by a tab
|
|
set softtabstop=4 " see multiple spaces as tabstops so <BS> does the right thing
|
|
set expandtab " converts tabs to white space
|
|
set shiftwidth=4 " width for autoindents
|
|
set autoindent " indent a new line the same amount as the line just typed
|
|
set number " add line numbers
|
|
|
|
set relativenumber " turn relative line numbers on
|
|
set rnu
|
|
|
|
set laststatus=2
|
|
|
|
set wildmode=longest,list " get bash-like tab completions
|
|
set cc=80 " set an 80 column border for good coding style
|
|
|
|
syntax on " syntax highlighting
|
|
set mouse=a " enable mouse click
|
|
set clipboard=unnamedplus " using system clipboard
|
|
filetype plugin on
|
|
set cursorline " highlight current cursorline
|
|
set ttyfast " Speed up scrolling in Vim
|
|
|
|
set spell " enable spell check (may need to download language package)
|
|
set spelllang=en,ru
|
|
set spellsuggest=best,9
|
|
|
|
" regenerate spell dicts on startup
|
|
for d in glob('~/.vim/spell/*.add', 1, 1)
|
|
if filereadable(d) && (!filereadable(d . '.spl') || getftime(d) > getftime(d . '.spl'))
|
|
exec 'mkspell! ' . fnameescape(d)
|
|
endif
|
|
endfor
|
|
nnoremap <silent> <F11> :set spell!<cr>
|
|
inoremap <silent> <F11> <C-O>:set spell!<cr>
|
|
|
|
set noswapfile " disable creating swap file
|
|
set backupdir=~/.cache/vim " Directory to store backup files.
|
|
|
|
filetype plugin indent on "allow auto-indenting depending on file type
|
|
|
|
nnoremap <C-N> :bnext<CR>
|
|
nnoremap <C-P> :bprev<CR>
|
|
|
|
let g:python3_host_prog = '/usr/bin/python3.10'
|
|
" let g:python3_host_prog = '/home/apr/work/tchk/venv/bin/python3.10'
|
|
" let g:python3_host_prog = '/home/apr/.virtualenvs/pyg/bin/python3'
|
|
|
|
" netrw magic
|
|
" enable mouse usage. makes it easier to browse multiple tabs
|
|
set mouse=a
|
|
" hide netrw top message
|
|
let g:netrw_banner=0
|
|
" tree listing by default
|
|
let g:netrw_liststyle=3
|
|
" hide vim swap files
|
|
let g:netrw_list_hide='.*\.swp$'
|
|
" open files in left window by default
|
|
let g:netrw_chgwin=1
|
|
" remap alt-enter to fire up the sidebar
|
|
nnoremap <silent> <A-CR> :rightbelow 20vs<CR>:e .<CR>
|
|
" " the same remap as above - may be necessary in some distros
|
|
" nnoremap <silent> <C-M> :rightbelow 20vs<CR>:e .<CR>
|
|
" remap control-enter to open files in new tab
|
|
nmap <silent> <C-CR> t :rightbelow 20vs<CR>:e .<CR>:wincmd h<CR>
|
|
" the same remap as above - may be necessary in some distros
|
|
nmap <silent> <NL> t :rightbelow 20vs<CR>:e .<CR>:wincmd h<CR>
|
|
|
|
call plug#begin("~/.vim/plugged")
|
|
" Plugin Section
|
|
|
|
" light theme
|
|
Plug 'sonph/onehalf', { 'rtp': 'vim' }
|
|
|
|
" autoquotes
|
|
Plug 'jiangmiao/auto-pairs'
|
|
|
|
" to show separate buffers as tabs
|
|
Plug 'ap/vim-buftabline'
|
|
|
|
" have no idea
|
|
Plug 'tpope/vim-vinegar'
|
|
|
|
" some icons
|
|
Plug 'ryanoasis/vim-devicons'
|
|
Plug 'SirVer/ultisnips'
|
|
|
|
Plug 'honza/vim-snippets'
|
|
Plug 'mhinz/vim-startify'
|
|
" Plug 'NLKNguyen/papercolor-theme'
|
|
Plug 'habamax/vim-asciidoctor'
|
|
|
|
" markdown shit
|
|
Plug 'godlygeek/tabular'
|
|
Plug 'plasticboy/vim-markdown'
|
|
|
|
" deoplete for whatever it is needed
|
|
Plug 'Shougo/deoplete.nvim', { 'do': ':UpdateRemotePlugins' }
|
|
|
|
Plug 'zchee/deoplete-jedi'
|
|
Plug 'roxma/nvim-yarp'
|
|
Plug 'roxma/vim-hug-neovim-rpc'
|
|
|
|
" Plugin for renaming python and not only
|
|
Plug 'davidhalter/jedi-vim'
|
|
|
|
Plug 'neomake/neomake'
|
|
" tree sitter at least for better highlighting
|
|
" as recommended updating the parsers on update
|
|
Plug 'nvim-treesitter/nvim-treesitter', {'do': ':TSUpdate'}
|
|
|
|
" bindings for shellcheck
|
|
Plug 'itspriddle/vim-shellcheck'
|
|
|
|
" Fuzzy finder
|
|
Plug 'junegunn/fzf', { 'do': { -> fzf#install() } }
|
|
|
|
" vim-plug
|
|
Plug 'LnL7/vim-nix'
|
|
|
|
" Collection of common configurations for the Nvim LSP client
|
|
Plug 'neovim/nvim-lspconfig'
|
|
|
|
" Completion framework
|
|
" Plug 'hrsh7th/nvim-cmp'
|
|
|
|
" LSP completion source for nvim-cmp
|
|
" Plug 'hrsh7th/cmp-nvim-lsp'
|
|
|
|
" Snippet completion source for nvim-cmp
|
|
" Plug 'hrsh7th/cmp-vsnip'
|
|
|
|
" Other usefull completion sources
|
|
" Plug 'hrsh7th/cmp-path'
|
|
" Plug 'hrsh7th/cmp-buffer'
|
|
" See hrsh7th's other plugins for more completion sources!
|
|
|
|
" To enable more of the features of rust-analyzer, such as inlay hints and more!
|
|
Plug 'simrat39/rust-tools.nvim'
|
|
" gitblame
|
|
Plug 'f-person/git-blame.nvim'
|
|
|
|
call plug#end()
|
|
|
|
set t_Co=256
|
|
set cursorline
|
|
set termguicolors
|
|
colorscheme summerfruit256
|
|
let g:airline_theme='onehalfdark'
|
|
|
|
" lightline
|
|
" let g:lightline = { 'colorscheme': 'onehalfdark' }
|
|
|
|
" vim-markdown disable folding
|
|
let g:vim_markdown_folding_disabled=1
|
|
|
|
let g:deoplete#enable_at_startup = 1
|
|
|
|
" disable autocompletion, because we use deoplete for completion
|
|
let g:jedi#completions_enabled = 0
|
|
|
|
" open the go-to function in split, not another buffer
|
|
let g:jedi#use_splits_not_buffers = "right"
|
|
|
|
" when to wtivate neomake
|
|
call neomake#configure#automake('nrwi', 50)
|
|
|
|
" enable linter
|
|
let g:neomake_python_enabled_makers = ['pylint']
|
|
|
|
" Set ultisnips triggers
|
|
let g:UltiSnipsExpandTrigger="<tab>"
|
|
let g:UltiSnipsJumpForwardTrigger="<tab>"
|
|
let g:UltiSnipsJumpBackwardTrigger="<s-tab>"
|
|
|
|
" buftabline configuration
|
|
let g:buftabline_numbers=1
|
|
let g:buftabline_indicators=1
|
|
|
|
let &fillchars ..= ',eob: '
|
|
|
|
" nnoremap <silent> <F11> :set spell!<cr>
|
|
nnoremap <silent> <F5> :FZF<CR>
|
|
|
|
" Rust setup
|
|
" Set completeopt to have a better completion experience
|
|
" :help completeopt
|
|
" menuone: popup even when there's only one match
|
|
" noinsert: Do not insert text until a selection is made
|
|
" noselect: Do not select, force user to select one from the menu
|
|
" set completeopt=menuone,noinsert,noselect
|
|
"
|
|
" " Avoid showing extra messages when using completion
|
|
" set shortmess+=c
|
|
"
|
|
" " Configure LSP through rust-tools.nvim plugin.
|
|
" " rust-tools will configure and enable certain LSP features for us.
|
|
" " See https://github.com/simrat39/rust-tools.nvim#configuration
|
|
" lua <<EOF
|
|
" local nvim_lsp = require'lspconfig'
|
|
"
|
|
" local opts = {
|
|
" tools = { -- rust-tools options
|
|
" autoSetHints = true,
|
|
" hover_with_actions = true,
|
|
" inlay_hints = {
|
|
" show_parameter_hints = false,
|
|
" parameter_hints_prefix = "",
|
|
" other_hints_prefix = "",
|
|
" },
|
|
" },
|
|
"
|
|
" -- all the opts to send to nvim-lspconfig
|
|
" -- these override the defaults set by rust-tools.nvim
|
|
" -- see https://github.com/neovim/nvim-lspconfig/blob/master/doc/server_configurations.md#rust_analyzer
|
|
" server = {
|
|
" -- on_attach is a callback called when the language server attachs to the buffer
|
|
" -- on_attach = on_attach,
|
|
" settings = {
|
|
" -- to enable rust-analyzer settings visit:
|
|
" -- https://github.com/rust-analyzer/rust-analyzer/blob/master/docs/user/generated_config.adoc
|
|
" ["rust-analyzer"] = {
|
|
" -- enable clippy on save
|
|
" checkOnSave = {
|
|
" command = "clippy"
|
|
" },
|
|
" }
|
|
" }
|
|
" },
|
|
" }
|
|
" require('rust-tools').setup(opts)
|
|
" EOF
|
|
"
|
|
" " Setup Completion
|
|
" " See https://github.com/hrsh7th/nvim-cmp#basic-configuration
|
|
"
|
|
" lua <<EOF
|
|
" local cmp = require'cmp'
|
|
" cmp.setup({
|
|
" -- Enable LSP snippets
|
|
" snippet = {
|
|
" expand = function(args)
|
|
" vim.fn["UltiSnips#Anon"](args.body)
|
|
" end,
|
|
" },
|
|
" mapping = {
|
|
" -- ['<C-p>'] = cmp.mapping.select_prev_item(),
|
|
" -- ['<C-n>'] = cmp.mapping.select_next_item(),
|
|
" -- Add tab support
|
|
" -- ['<S-Tab>'] = cmp.mapping.select_prev_item(),
|
|
" -- ['<Tab>'] = cmp.mapping.select_next_item(),
|
|
" ['<C-d>'] = cmp.mapping.scroll_docs(-4),
|
|
" ['<C-f>'] = cmp.mapping.scroll_docs(4),
|
|
" ['<Tab>'] = cmp.mapping.complete(),
|
|
" ['<C-e>'] = cmp.mapping.close(),
|
|
" ['<CR>'] = cmp.mapping.confirm({
|
|
" behavior = cmp.ConfirmBehavior.Insert,
|
|
" select = true,
|
|
" })
|
|
" },
|
|
"
|
|
" -- Installed sources
|
|
" sources = {
|
|
" { name = 'nvim_lsp' },
|
|
" { name = 'vsnip' },
|
|
" { name = 'path' },
|
|
" { name = 'buffer' },
|
|
" },
|
|
" })
|
|
" EOF
|
|
"
|
|
" " Set updatetime for CursorHold
|
|
" " 300ms of no cursor movement to trigger CursorHold
|
|
" set updatetime=300
|
|
" " Show diagnostic popup on cursor hold
|
|
" autocmd CursorHold * lua vim.diagnostic.open_float(nil, { focusable = false })
|
|
"
|
|
" " Goto previous/next diagnostic warning/error
|
|
" nnoremap <silent> g[ <cmd>lua vim.diagnostic.goto_prev()<CR>
|
|
" nnoremap <silent> g] <cmd>lua vim.diagnostic.goto_next()<CR>
|
|
"
|
|
" " have a fixed column for the diagnostics to appear in
|
|
" " this removes the jitter when warnings/errors flow in
|
|
" set signcolumn=yes
|
|
|