dotfiles/nvim/init.vim

146 lines
3.7 KiB
VimL

" vim-plug
call plug#begin()
Plug 'nvim-telescope/telescope-fzf-native.nvim', { 'do': 'cmake -S. -Bbuild -DCMAKE_BUILD_TYPE=Release && cmake --build build --config Release && cmake --install build --prefix build' }
Plug 'nvim-lua/plenary.nvim'
Plug 'nvim-telescope/telescope.nvim'
Plug 'williamboman/nvim-lsp-installer'
Plug 'prabirshrestha/vim-lsp'
Plug 'prabirshrestha/asyncomplete-lsp.vim'
Plug 'ConradIrwin/vim-bracketed-paste'
Plug 'christoomey/vim-tmux-navigator'
Plug 'cohama/lexima.vim'
Plug 'editorconfig/editorconfig-vim'
Plug 'kristijanhusak/vim-hybrid-material'
Plug 'lervag/vimtex'
Plug 'octol/vim-cpp-enhanced-highlight'
Plug 'pangloss/vim-javascript'
Plug 'posva/vim-vue'
Plug 'ervandew/supertab'
Plug 'tmux-plugins/vim-tmux'
Plug 'tmux-plugins/vim-tmux-focus-events'
Plug 'tomtom/tcomment_vim'
Plug 'vim-airline/vim-airline'
Plug 'vim-airline/vim-airline-themes'
Plug 'vimwiki/vimwiki'
Plug 'neovim/nvim-lspconfig'
Plug 'hrsh7th/cmp-nvim-lsp'
Plug 'hrsh7th/cmp-buffer'
Plug 'hrsh7th/cmp-path'
Plug 'hrsh7th/cmp-cmdline'
Plug 'hrsh7th/nvim-cmp'
Plug 'hrsh7th/cmp-vsnip'
Plug 'hrsh7th/vim-vsnip'
call plug#end()
:lua require('lsp_config')
:lua require('telescope-config')
let python_highlight_all=1
let g:solarized_termcolors=256
let g:airline_powerline_fonts = 1
let mapleader=","
set autoindent
set background=dark
set backspace=indent,eol,start
set completeopt-=preview
set encoding=utf-8
set expandtab
set guifont=Ubuntu\ Mono\ derivative\ Powerline\ 13
set hidden
set hlsearch
set ignorecase
set incsearch
set laststatus=2
set lbr
set modelines=0
set mouse=a
set nocompatible
set nomodeline
set number
set numberwidth=4
set scrolloff=5
set shiftwidth=4
set sidescrolloff=10
set smartcase
set softtabstop=4
set splitbelow
set splitright
set t_Co=256
set tabstop=4
set ttimeoutlen=50
set undofile
set undolevels=1000
set undoreload=10000
set wildmenu
set wildmode=longest,list
:command W w
:command Q q
:command WQ wq
:command Wq wq
nnoremap j gj
nnoremap k gk
vnoremap u y
nnoremap <C-U> <C-O>
nnoremap <C-E> <C-U>
nnoremap <leader><space> :noh<CR>
nnoremap <C-o> <cmd>Telescope buffers<cr>
nnoremap <leader>/ <cmd>lua require('telescope.builtin').live_grep{ cwd = vim.fn.systemlist("git rev-parse --show-toplevel")[1] }<cr>
colorscheme hybrid_material
syntax enable
filetype plugin indent on
autocmd FileType make set tabstop=8 shiftwidth=8 softtabstop=0 noexpandtab
" VimWiki
let g:vimwiki_key_mappings = { 'table_mappings': 0 }
let g:vimwiki_markdown_link_ext = 1
autocmd FileType vimwiki setlocal shiftwidth=2 softtabstop=2 expandtab
" Allow xterm-key usage inside tmux
execute "set <xUp>=\e[1;*A"
execute "set <xDown>=\e[1;*B"
execute "set <xRight>=\e[1;*C"
execute "set <xLeft>=\e[1;*D"
" Airline
let g:airline_theme="solarized"
let g:airline_solarized_bg="dark"
" Vimtex
let g:tex_flavor = 'latex'
" Commenting
nnoremap <silent> <leader>c :TComment<CR>
nnoremap <silent> <leader>C :TCommentBlock<CR>
vnoremap <silent> <leader>c :TCommentInline<CR>
vnoremap <silent> <leader>C :TCommentBlock<CR>
" Automatically remove trailing spaces
let blacklist = ['vimwiki']
autocmd BufWritePre * if index(blacklist, &ft) < 0 | :%s/\s\+$//e
" Disable shift+k for manual lookup
map <S-k> <Nop>
" Prolog: set filetype for .pl
autocmd BufRead,BufNewFile *.pl set filetype=prolog
" Tab for completion
let g:SuperTabContextDefaultCompletionType = "<c-n>"
let g:SuperTabDefaultCompletionType = "<c-n>"
" Lanuage server
nnoremap <silent> <buffer> gd :lua vim.lsp.buf.definition()<CR>
set updatetime=300
set signcolumn=number
nmap <silent> <leader>n :lua vim.lsp.diagnostic.goto_next()<CR>
nmap <silent> <leader>p :lua vim.lsp.diagnostic.goto_prev()<CR>
nmap <silent> <leader>f :lua vim.lsp.buf.code_action()<CR>