dotfiles/neovim/.config/nvim/init.vim

221 lines
5.7 KiB
VimL
Raw Normal View History

syntax on
filetype indent on
2019-11-04 14:50:38 +01:00
let mapleader="½"
2019-11-04 15:53:33 +01:00
set encoding=utf-8
2022-04-08 09:17:28 +02:00
" set clipboard=unnamed
" set clipboard+=unnamedplus
set smartindent
set shiftwidth=2
set tabstop=2
set expandtab
set autoread
2018-09-21 08:51:56 +02:00
set hidden
2019-09-20 14:04:16 +02:00
set termguicolors
2019-10-23 08:45:38 +02:00
set background=dark
set rtp^=/usr/share/vim/vimfiles/
2019-03-29 10:32:11 +01:00
set undodir=~/.local/share/nvim/undodir
set undofile
2019-08-02 11:47:53 +02:00
set colorcolumn=80
2020-10-23 12:55:37 +02:00
set foldmethod=indent
2019-08-02 11:47:53 +02:00
set foldlevelstart=20
2019-11-04 15:53:33 +01:00
set number
2019-09-20 14:04:16 +02:00
set relativenumber
2022-04-08 09:17:28 +02:00
let g:ale_disable_lsp = 1
"Plugins
call plug#begin('~/.local/share/nvim/plugged')
2019-10-23 08:45:38 +02:00
2019-09-20 14:04:16 +02:00
" Colorschemes
Plug 'arcticicestudio/nord-vim'
2019-08-02 11:47:53 +02:00
2019-04-03 11:51:53 +02:00
" Pretty Status Lines
Plug 'vim-airline/vim-airline'
Plug 'vim-airline/vim-airline-themes'
2019-08-02 11:47:53 +02:00
2019-04-03 11:51:53 +02:00
" Completion
Plug 'SirVer/ultisnips'
2020-10-23 12:55:37 +02:00
Plug 'mlaursen/vim-react-snippets'
Plug 'epilande/vim-es2015-snippets'
Plug 'honza/vim-snippets'
2019-09-20 14:04:16 +02:00
Plug 'neoclide/coc.nvim', {'branch': 'release'}
2020-10-23 12:55:37 +02:00
let g:coc_global_extensioons = [
\ 'coc-tsserver',
\ 'coc-json',
2022-04-08 09:17:28 +02:00
\ 'coc-pyright',
2020-10-23 12:55:37 +02:00
\ 'coc-snippets',
\ 'coc-prettier',
\ 'coc-eslint'
\]
2019-08-02 11:47:53 +02:00
2019-04-03 11:51:53 +02:00
" File handling
2020-10-23 12:55:37 +02:00
Plug 'preservim/nerdtree'
2022-04-08 09:17:28 +02:00
Plug 'mcchrish/nnn.vim'
2019-04-03 11:51:53 +02:00
Plug 'junegunn/fzf', { 'dir': '~/.fzf', 'do': './install --all' }
Plug 'junegunn/fzf.vim'
2019-08-02 11:47:53 +02:00
2019-04-03 11:51:53 +02:00
" Python
Plug 'w0rp/ale'
2022-04-08 09:17:28 +02:00
Plug 'mfussenegger/nvim-dap-python'
Plug 'nvim-treesitter/nvim-treesitter', {'do': ':TSUpdate'}
2019-08-02 11:47:53 +02:00
2019-04-03 11:51:53 +02:00
" HTML
Plug 'jonsmithers/vim-html-template-literals'
Plug 'MaxMEllon/vim-jsx-pretty'
Plug 'pangloss/vim-javascript'
2020-10-23 12:55:37 +02:00
Plug 'leafgarland/typescript-vim'
Plug 'peitalin/vim-jsx-typescript'
2019-08-02 11:47:53 +02:00
" Markdown
Plug 'plasticboy/vim-markdown'
Plug 'iamcco/markdown-preview.nvim', { 'do': 'cd app && yarn install' }
2019-08-02 11:47:53 +02:00
" Testing
Plug 'janko/vim-test'
2019-10-23 08:45:38 +02:00
2022-04-08 09:17:28 +02:00
" Debugging
Plug 'mfussenegger/nvim-dap'
Plug 'rcarriga/nvim-dap-ui'
2019-10-23 08:45:38 +02:00
" Editing
Plug 'tpope/vim-surround'
2020-10-23 12:55:37 +02:00
Plug 'pseewald/vim-anyfold'
2019-11-04 13:46:01 +01:00
" Git
Plug 'airblade/vim-gitgutter'
2022-04-08 09:17:28 +02:00
Plug 'tpope/vim-fugitive'
call plug#end()
2019-09-20 14:04:16 +02:00
" Colorscheme and Theming
2019-01-08 13:57:59 +01:00
colorscheme nord
"Airline
2019-08-02 11:47:53 +02:00
if !exists('g:airline_symbols')
let g:airline_symbols = {}
endif
let g:airline#extensions#tabline#enabled = 0
2019-01-08 13:57:59 +01:00
let g:airline_theme='nord'
2019-08-02 11:47:53 +02:00
let g:airline_symbols.maxlinenr = ''
2022-04-08 09:17:28 +02:00
let g:airline_symbols.branch = '⎇'
2019-08-02 11:47:53 +02:00
" CoC
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)
inoremap <silent><expr> <c-space> coc#refresh()
2022-04-08 09:17:28 +02:00
"DAP
lua require('dap-python').setup('~/.venvs/debugpy/bin/python')
lua require('dap-python').test_runner = 'pytest'
"lua require("dapui").setup()
lua << EOF
require("dapui").setup({
icons = { expanded = "▾", collapsed = "▸" },
mappings = {
-- Use a table to apply multiple mappings
expand = { "<CR>", "<2-LeftMouse>" },
open = "o",
remove = "d",
edit = "e",
repl = "r",
toggle = "t",
},
sidebar = {
-- You can change the order of elements in the sidebar
elements = {
-- Provide as ID strings or tables with "id" and "size" keys
{
id = "scopes",
size = 0.25, -- Can be float or integer > 1
},
{ id = "breakpoints", size = 0.25 },
{ id = "stacks", size = 0.25 },
{ id = "watches", size = 00.25 },
},
size = 40,
position = "right", -- Can be "left", "right", "top", "bottom"
},
tray = {
elements = { "repl" },
size = 10,
position = "bottom", -- Can be "left", "right", "top", "bottom"
},
floating = {
max_height = nil, -- These can be integers or a float between 0 and 1.
max_width = nil, -- Floats will be treated as percentage of your screen.
border = "single", -- Border style. Can be "single", "double" or "rounded"
mappings = {
close = { "q", "<Esc>" },
},
},
windows = { indent = 1 },
})
local dap, dapui = require("dap"), require("dapui")
dap.listeners.after.event_initialized["dapui_config"] = function()
dapui.open()
end
dap.listeners.before.event_terminated["dapui_config"] = function()
dapui.close()
end
dap.listeners.before.event_exited["dapui_config"] = function()
dapui.close()
end
EOF
nnoremap <silent> <F9> :lua require'dap'.continue()<CR>
nnoremap <silent> <F21> :lua require('dap-python').test_method()<CR>
nnoremap <silent> <F8> :lua require'dap'.step_over()<CR>
nnoremap <silent> <F20> :lua require'dap'.step_into()<CR>
nnoremap <silent> <F32> :lua require'dap'.step_out()<CR>
nnoremap <silent> <leader>b :lua require'dap'.toggle_breakpoint()<CR>
" UltiSnips
let g:UltiSnipsExpandTrigger="<c-e>"
2022-04-08 09:17:28 +02:00
" Testing
let test#python#runner = 'pytest'
nmap <silent> <F34> :TestNearest<CR>
nmap <silent> <F22> :TestFile<CR>
"
" HTML
let g:closetag_filenames = '*.html,*.js'
let g:html_indent_style1 = "inc"
2022-04-08 09:17:28 +02:00
" MARKDOWN
let g:mkdp_browser = 'firefox'
2019-04-03 11:51:53 +02:00
" FZF
let $FZF_DEFAULT_COMMAND = 'ag --ignore .git -g ""'
2019-04-03 11:51:53 +02:00
command! -bang -nargs=? -complete=dir HFiles
\ call fzf#vim#files(<q-args>, {'source': 'ag --hidden --ignore .git -g ""'}, <bang>0)
2022-04-08 09:17:28 +02:00
" map <M-1> :NERDTreeToggle<CR>
map <M-1> :NnnPicker<CR>
2019-11-04 15:53:33 +01:00
map <M-2> :HFiles<CR>
map <M-3> :Buffers<CR>
2019-04-03 11:51:53 +02:00
2019-11-05 13:20:12 +01:00
" GitGutter
let g:gitgutter_terminal_reports_focus = 0
2019-11-04 14:50:38 +01:00
" Mappings
2019-08-02 11:47:53 +02:00
:vmap r "_dP
:nmap <c-s> :w<CR>
:imap <c-s> <Esc>:w<CR>a
2019-10-23 08:45:38 +02:00
:nmap <silent> <C-F4> :bd<CR>
nnoremap <C-J> <C-W><C-J>
nnoremap <C-K> <C-W><C-K>
nnoremap <C-L> <C-W><C-L>
nnoremap <C-H> <C-W><C-H>
2019-11-04 15:53:33 +01:00
nmap <Leader>gs :GFiles?<CR>
2019-11-04 14:50:38 +01:00
nmap <Leader>gn <Plug>(GitGutterNextHunk) " git next
nmap <Leader>gp <Plug>(GitGutterPrevHunk) " git previous
nmap <Leader>ga <Plug>(GitGutterStageHunk) " git add (chunk)
nmap <Leader>gu <Plug>(GitGutterUndoHunk) " git undo (chunk)
"AutoCommands
au FileType json setlocal equalprg=jq\ .
au FileType xml setlocal equalprg=xmllint\ --format\ --recover\ -\ 2>/dev/null
2018-10-17 21:06:18 +02:00
autocmd FileType python setlocal completeopt-=preview
2020-10-23 12:55:37 +02:00
autocmd BufEnter *.{js,jsx,ts,tsx} :syntax sync fromstart
autocmd BufLeave *.{js,jsx,ts,tsx} :syntax sync clear