nvim/init.vim

208 lines
6.9 KiB
VimL
Raw Normal View History

2022-10-05 19:22:26 +00:00
call plug#begin()
2022-10-06 12:01:05 +00:00
" NERDTree stuff
2022-10-21 08:53:31 +00:00
Plug 'nvim-tree/nvim-web-devicons' " optional, for file icons
Plug 'nvim-tree/nvim-tree.lua'
2022-10-05 19:22:26 +00:00
2022-10-21 08:53:31 +00:00
" neovim lsp plugins and depencencies
2022-10-15 11:50:50 +00:00
Plug 'neovim/nvim-lspconfig'
Plug 'williamboman/mason.nvim'
Plug 'williamboman/mason-lspconfig.nvim'
Plug 'jose-elias-alvarez/null-ls.nvim'
2022-10-19 13:11:04 +00:00
" various plugins
2022-10-23 18:58:08 +00:00
Plug 'akinsho/bufferline.nvim', { 'tag': 'v3.*' }
Plug 'gorbit99/codewindow.nvim'
2022-10-10 17:35:17 +00:00
Plug 'vim-perl/vim-perl', { 'for': 'perl', 'do': 'make clean carp dancer highlight-all-pragmas moose test-more try-tiny' }
2022-10-05 19:22:26 +00:00
Plug 'neoclide/coc.nvim', {'branch': 'release'}
Plug 'preservim/nerdcommenter'
Plug 'mhinz/vim-startify'
Plug 'rmagatti/auto-session'
2022-10-06 12:01:05 +00:00
Plug 'tpope/vim-fugitive'
Plug 'Glench/Vim-Jinja2-Syntax'
Plug 'vmware-archive/salt-vim'
Plug 'vim-airline/vim-airline'
Plug 'vim-airline/vim-airline-themes'
Plug 'honza/vim-snippets'
Plug 'itchyny/vim-cursorword'
Plug 'sheerun/vim-polyglot'
2022-10-10 17:35:17 +00:00
" themes
Plug 'navarasu/onedark.nvim'
Plug 'ellisonleao/gruvbox.nvim'
Plug 'dracula/vim'
Plug 'vigoux/oak'
Plug 'NLKNguyen/papercolor-theme'
Plug 'bluz71/vim-moonfly-colors'
2022-10-05 19:22:26 +00:00
"Fuzzy search by Telescope and its dependencies:
Plug 'nvim-lua/plenary.nvim'
Plug 'nvim-telescope/telescope.nvim', { 'branch': '0.1.x' }
2022-10-05 19:22:26 +00:00
Plug 'BurntSushi/ripgrep'
Plug 'nvim-treesitter/nvim-treesitter', {'do': ':TSUpdate'}
2022-10-05 19:22:26 +00:00
call plug#end()
2022-10-21 08:53:31 +00:00
" set termguicolors before lua config,
" as it can contain some theme stuff that
" checks for termguicolors
set termguicolors
2022-10-09 15:35:20 +00:00
" load main lua file with additional configs
2022-10-05 19:22:26 +00:00
lua require("general")
2022-10-19 13:11:04 +00:00
" highlight all .conf files as apache config (:])
2022-10-14 07:03:27 +00:00
autocmd BufEnter *.conf :setlocal filetype=apache
2022-10-06 12:01:05 +00:00
"nerdtree bindings
nnoremap <leader>n :NvimTreeFocus<CR>
nnoremap <C-t> :NvimTreeToggle<CR>
2022-10-05 19:22:26 +00:00
" nerdcommenter custom bindings
nmap <C-_> <plug>NERDCommenterToggle
vmap <C-_> <plug>NERDCommenterToggle
2022-10-10 17:35:17 +00:00
" saving with Ctrl+s
"nnoremap <silent><C-s> :update<cr>
"inoremap <silent><C-s> <c-o>:update<cr>
"vnoremap <silent><c-s> <c-c>:update<cr>gv " gv to preserve visual selection
2022-10-19 13:11:04 +00:00
" show uncommited git changes in current part of the code
2022-10-10 17:35:17 +00:00
nnoremap <C-g> :CocCommand git.chunkInfo<CR>
"theme configuration
2022-10-05 19:22:26 +00:00
syntax enable
let g:onedark_config = {
\ 'style': 'darker',
\}
let g:PaperColor_Theme_Options = {
\ 'language': {
\ 'python': {
\ 'highlight_builtins' : 1
\ },
\ 'cpp': {
\ 'highlight_standard_library': 1
\ },
\ 'c': {
\ 'highlight_builtins' : 1
\ }
\ }
\ }
colorscheme moonfly
let g:airline_theme='dark'
2022-10-05 19:22:26 +00:00
set splitright
set splitbelow
" indent/unindent with tab/shift-tab
nmap <Tab> >>
nmap <S-tab> <<
imap <S-Tab> <Esc><<i
vmap <Tab> >gv
vmap <S-Tab> <gv
" Remap <C-f> and <C-b> for scroll float windows/popups.
if has('nvim-0.4.0') || has('patch-8.2.0750')
nnoremap <silent><nowait><expr> <C-f> coc#float#has_scroll() ? coc#float#scroll(1) : "\<C-f>"
nnoremap <silent><nowait><expr> <C-b> coc#float#has_scroll() ? coc#float#scroll(0) : "\<C-b>"
inoremap <silent><nowait><expr> <C-f> coc#float#has_scroll() ? "\<c-r>=coc#float#scroll(1)\<cr>" : "\<Right>"
inoremap <silent><nowait><expr> <C-b> coc#float#has_scroll() ? "\<c-r>=coc#float#scroll(0)\<cr>" : "\<Left>"
vnoremap <silent><nowait><expr> <C-f> coc#float#has_scroll() ? coc#float#scroll(1) : "\<C-f>"
vnoremap <silent><nowait><expr> <C-b> coc#float#has_scroll() ? coc#float#scroll(0) : "\<C-b>"
endif
" Find files using Telescope command-line sugar.
nnoremap <leader>ff <cmd>Telescope find_files<cr>
nnoremap <leader>fg <cmd>Telescope live_grep<cr>
nnoremap <leader>fb <cmd>Telescope buffers<cr>
nnoremap <leader>fh <cmd>Telescope help_tags<cr>
2022-10-19 13:11:04 +00:00
""""""""""""""""""""""""""""
2022-10-07 08:12:37 +00:00
" config for coc#pum#visible
2022-10-19 13:11:04 +00:00
""""""""""""""""""""""""""""
2022-10-07 08:12:37 +00:00
" Some servers have issues with backup files, see #649.
set nobackup
set nowritebackup
" Having longer updatetime (default is 4000 ms = 4 s) leads to noticeable
" delays and poor user experience.
set updatetime=300
" Always show the signcolumn, otherwise it would shift the text each time
" diagnostics appear/become resolved.
set signcolumn=yes
" Symbol renaming.
nmap <leader>rn <Plug>(coc-rename)
" Formatting selected code.
2022-10-08 13:16:41 +00:00
xmap <leader>ft <Plug>(coc-format-selected)
nmap <leader>ft <Plug>(coc-format-selected)
2022-10-07 08:12:37 +00:00
" GoTo code navigation.
nmap <silent> gd <Plug>(coc-definition)
nmap <silent> gy <Plug>(coc-type-definition)
nmap <silent> gi <Plug>(coc-implementation)
nmap <silent> gr <Plug>(coc-references)
2022-10-05 19:22:26 +00:00
" Use tab for trigger completion with characters ahead and navigate.
" NOTE: There's always complete item selected by default, you may want to enable
" no select by `"suggest.noselect": true` in your configuration file.
" NOTE: Use command ':verbose imap <tab>' to make sure tab is not mapped by
" other plugin before putting this into your config.
inoremap <silent><expr> <TAB>
\ coc#pum#visible() ? coc#pum#next(1) :
\ CheckBackspace() ? "\<Tab>" :
\ coc#refresh()
inoremap <expr><S-TAB> coc#pum#visible() ? coc#pum#prev(1) : "\<C-h>"
" Make <CR> to accept selected completion item or notify coc.nvim to format
" <C-g>u breaks current undo, please make your own choice.
inoremap <silent><expr> <CR> coc#pum#visible() ? coc#pum#confirm()
\: "\<C-g>u\<CR>\<c-r>=coc#on_enter()\<CR>"
function! CheckBackspace() abort
let col = col('.') - 1
return !col || getline('.')[col - 1] =~# '\s'
endfunction
" Use <c-space> to trigger completion.
if has('nvim')
inoremap <silent><expr> <c-space> coc#refresh()
else
inoremap <silent><expr> <c-@> coc#refresh()
endif
2022-10-19 13:11:04 +00:00
2022-10-05 19:22:26 +00:00
" general configs
set modeline
let g:sls_use_jinja_syntax = 1
2022-10-06 12:01:05 +00:00
set encoding=UTF-8
2022-10-21 08:53:31 +00:00
set showmatch " show matching
set ignorecase " case insensitive
set mouse=v " middle-click paste with
set hlsearch " highlight search
2022-10-05 19:22:26 +00:00
set incsearch " incremental search
2022-10-21 08:53:31 +00:00
set tabstop=4 " number of columns occupied by a tab
2022-10-05 19:22:26 +00:00
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 " add relative line numbers
2022-10-05 19:22:26 +00:00
set wildmode=longest,list " get bash-like tab completions
2022-10-10 05:23:47 +00:00
set cc=80 " set an 80 column border for good coding style
2022-10-05 19:22:26 +00:00
filetype plugin indent on "allow auto-indenting depending on file type
syntax on " syntax highlighting
2022-10-10 05:23:47 +00:00
"set mouse=a " enable mouse click
set clipboard+=unnamedplus " using system clipboard
2022-10-05 19:22:26 +00:00
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)
2022-10-10 05:23:47 +00:00
set noswapfile " disable creating swap file
2022-10-05 19:22:26 +00:00
" set backupdir=~/.cache/vim " Directory to store backup files.