configs/home/.config/nvim/main.vim

199 lines
6.5 KiB
VimL
Raw Normal View History

2023-03-25 18:45:49 +01:00
" enter normal mode from terminal-emulator with <C-w>
inoremap <C-w> <Esc>
tnoremap <C-w> <C-\><C-n>
" automatically enter insert mode on new neovim terminals
augroup terminal
au TermOpen * startinsert
augroup END
" debuging
packadd termdebug
" debugging for rust
command Rustdebug :let termdebugger="rust-gdb" | :Termdebug
" Set completeopt to have a better completion experience"
set completeopt=menuone,noinsert,noselect
2023-03-20 22:53:00 +01:00
" Set completeopt to have a better completion experience"
set completeopt=menuone,noinsert,noselect
2023-06-29 10:25:44 +02:00
2023-07-04 15:42:14 +02:00
" load vim plugged stuff
runtime plugs.vim
2023-07-03 10:37:41 +02:00
" load plugins from extra files
2023-06-29 10:25:44 +02:00
runtime nvim-tree.vim
2023-07-04 15:42:14 +02:00
" plugin specific configs
2023-05-08 00:30:07 +02:00
runtime markdownpreview.vim
2023-03-20 22:53:00 +01:00
2023-07-03 10:37:41 +02:00
" load plugins from extra files
runtime nvim-table-mode.vim
2023-06-29 10:25:44 +02:00
2023-07-04 15:42:14 +02:00
" load tabbar
runtime tagbar.vim
2023-07-04 21:33:12 +02:00
" load suda
runtime suda.vim
2023-07-28 09:18:07 +02:00
" load vimtex
runtime vimtex.vim
2023-07-04 15:42:14 +02:00
" load ALE (another language server or something that works with COC)
2023-07-04 16:42:59 +02:00
"runtime ale.vim
2023-07-04 15:42:14 +02:00
2023-05-08 00:30:07 +02:00
" no default mappings for vim smoothie (fancy scrolling)
let g:smoothie_no_default_mappings = 1
" smooth scrolling with J and K instead of <S-Up> and <S-Down>
nnoremap <unique> J <cmd>call smoothie#do("\<C-D>") <CR>
vnoremap <unique> J <cmd>call smoothie#do("\<C-D>") <CR>
nnoremap <unique> K <cmd>call smoothie#do("\<C-U>") <CR>
vnoremap <unique> K <cmd>call smoothie#do("\<C-U>") <CR>
2023-03-20 22:53:00 +01:00
" Use <Tab> and <S-Tab> to navigate through popup menu"
inoremap <expr> <Tab> pumvisible() ? "\<C-n>" : "\<Tab>"
inoremap <expr> <S-Tab> pumvisible() ? "\<C-p>" : "\<S-Tab>"
" Set completeopt to have a better completion experience"
set completeopt=menuone,noinsert,noselect
" Move to previous/next"
nnoremap <silent> <A-,> <Cmd>BufferPrevious<CR>
nnoremap <silent> <A-.> <Cmd>BufferNext<CR>
" Re-order to previous/next"
nnoremap <silent> <A-<> <Cmd>BufferMovePrevious<CR>
nnoremap <silent> <A->> <Cmd>BufferMoveNext<CR>
" Goto buffer in position..."
nnoremap <silent> <A-1> <Cmd>BufferGoto 1<CR>
nnoremap <silent> <A-2> <Cmd>BufferGoto 2<CR>
nnoremap <silent> <A-3> <Cmd>BufferGoto 3<CR>
nnoremap <silent> <A-4> <Cmd>BufferGoto 4<CR>
nnoremap <silent> <A-5> <Cmd>BufferGoto 5<CR>
nnoremap <silent> <A-6> <Cmd>BufferGoto 6<CR>
nnoremap <silent> <A-7> <Cmd>BufferGoto 7<CR>
nnoremap <silent> <A-8> <Cmd>BufferGoto 8<CR>
nnoremap <silent> <A-9> <Cmd>BufferGoto 9<CR>
nnoremap <silent> <A-0> <Cmd>BufferLast<CR>
" Pin/unpin buffer"
nnoremap <silent> <A-p> <Cmd>BufferPin<CR>
" Close buffer"
nnoremap <silent> <A-c> <Cmd>BufferClose<CR>
" Wipeout buffer
" :BufferWipeout
" Close commands
" :BufferCloseAllButCurrent
" :BufferCloseAllButVisible
" :BufferCloseAllButPinned
" :BufferCloseAllButCurrentOrPinned
" :BufferCloseBuffersLeft
" :BufferCloseBuffersRight
" Magic buffer-picking mode
nnoremap <silent> <C-p> <Cmd>BufferPick<CR>
" Sort automatically by..."
2023-07-04 21:33:12 +02:00
nnoremap <silent> <leader>bb <Cmd>BufferOrderByBufferNumber<CR>
nnoremap <silent> <leader>bd <Cmd>BufferOrderByDirectory<CR>
nnoremap <silent> <leader>bl <Cmd>BufferOrderByLanguage<CR>
nnoremap <silent> <leader>bw <Cmd>BufferOrderByWindowNumber<CR>
2023-03-20 22:53:00 +01:00
" Other:
" :BarbarEnable - enables barbar (enabled by default)
" :BarbarDisable - very bad command, should never be used
"
2023-07-04 15:42:14 +02:00
color nightfox
2023-03-20 22:53:00 +01:00
let g:lazygit_floating_window_winblend = 0 " transparency of floating window
let g:lazygit_floating_window_scaling_factor = 0.9 " scaling factor for floating window
2023-06-18 15:37:54 +02:00
let g:lazygit_floating_window_border_chars = ['╭', '╮', '╰', '╯'] " customize lazygit popup window corner characters
2023-03-20 22:53:00 +01:00
let g:lazygit_floating_window_use_plenary = 0 " use plenary.nvim to manage floating window if available
let g:lazygit_use_neovim_remote = 1 " fallback to 0 if neovim-remote is not installed
let g:lazygit_use_custom_config_file_path = 0 " config file path is evaluated if this value is 1
let g:lazygit_config_file_path = '' " custom config file path
" setup mapping to call :LazyGit
nnoremap <silent> <leader>gg :LazyGit<CR>
" coc language server configs
2023-07-04 15:42:14 +02:00
runtime coc.vim
2023-03-20 22:53:00 +01:00
" do these commands manually, they dont like being scripted.
"CocInstall coc-clangd coc-cmake coc-css coc-floaterm coc-fzf-preview coc-git coc-html coc-json
"CocInstall coc-lists coc-lua coc-pyright coc-rust-analyzer coc-sh coc-snippets coc-sql
""""these may cause errors"""""CocInstall coc-symbol-line coc-toml coc-texlab coc-vimlsp coc-xml
2023-06-09 14:05:42 +02:00
" slime (sends stuff to other programs, like ipython)
let g:slime_target = "neovim"
2023-07-10 13:18:08 +02:00
nmap <C-c>a ggvG:SlimeSend<CR>
nmap <leader>cs :SlimeConfig<CR>
2023-06-09 14:05:42 +02:00
2023-03-20 22:53:00 +01:00
"------------------------------------------------------
2023-06-30 21:45:57 +02:00
lua << EOF
2023-03-20 22:53:00 +01:00
-- disable netrw at the very start of your init.lua (strongly advised)
vim.g.loaded_netrw = 1
vim.g.loaded_netrwPlugin = 1
-- set termguicolors to enable highlight groups
vim.opt.termguicolors = true
require('lualine').setup {
options = {
icons_enabled = true,
theme = 'auto',
component_separators = { left = '', right = ''},
section_separators = { left = '', right = ''},
disabled_filetypes = {
statusline = {},
winbar = {},
},
ignore_focus = {},
always_divide_middle = true,
globalstatus = false,
refresh = {
statusline = 1000,
tabline = 1000,
winbar = 1000,
}
},
sections = {
lualine_a = {'mode'},
lualine_b = {'branch', 'diff', 'diagnostics'},
lualine_c = {'filename'},
lualine_d = {'diagnostics'},
lualine_x = {'encoding', 'fileformat', 'filetype', 'filesize'},
lualine_y = {'progress'},
lualine_z = {'location'}
},
inactive_sections = {
lualine_a = {},
lualine_b = {},
lualine_c = {'filename'},
lualine_x = {'location'},
lualine_y = {},
lualine_z = {}
},
tabline = {},
winbar = {},
inactive_winbar = {},
extensions = {}
}
require'FTerm'.setup({
border = 'single',
dimensions = {
height = 0.9,
width = 0.9,
},
})
2023-06-02 22:18:59 +02:00
-- floaterm keys
2023-03-20 22:53:00 +01:00
vim.keymap.set('n', '<F12>', '<CMD>lua require("FTerm").toggle()<CR>')
vim.keymap.set('t', '<F12>', '<C-\\><C-n><CMD>lua require("FTerm").toggle()<CR>')
2023-06-09 14:05:42 +02:00
2023-06-30 21:45:57 +02:00
EOF