diff --git a/home/.config/nvim/noplug.vim b/home/.config/nvim/common.vim similarity index 90% rename from home/.config/nvim/noplug.vim rename to home/.config/nvim/common.vim index 37349c5..52e1a73 100644 --- a/home/.config/nvim/noplug.vim +++ b/home/.config/nvim/common.vim @@ -1,3 +1,10 @@ +call plug#begin() + +Plug 'glacambre/firenvim', { 'do': { _ -> firenvim#install(0) } } +Plug 'jiangmiao/auto-pairs' +Plug 'EdenEast/nightfox.nvim' " Vim-Plug + +call plug#end() syntax on " syntax highlighting set nocompatible " disable compatibility to old-time vi @@ -63,35 +70,21 @@ vnoremap p pgvy " open terminal with F12 nnoremap :terminal -" automatically set closed braces aswell when making opened ones. -"inoremap " "" -"inoremap ' '' -"inoremap ( () -"inoremap [ [] -"inoremap { {} -"inoremap { {}O -"inoremap {; {};O - " vsplit with , then " map " :vsplit " split with , then %" map % :split +" enter normal mode from terminal-emulator with +inoremap +tnoremap + " automatically enter insert mode on new neovim terminals augroup terminal au TermOpen * startinsert augroup END -" enter normal mode from terminal-emulator with -inoremap -tnoremap - -" :W to write file as root" -command W :SudaWrite - -" :E to open file as root" -command E :SudaRead " Set completeopt to have a better completion experience" set completeopt=menuone,noinsert,noselect " debuging @@ -99,3 +92,4 @@ packadd termdebug " debuggin for rust command Rustdebug :let termdebugger="rust-gdb" | :Termdebug + diff --git a/home/.config/nvim/firenvim.vim b/home/.config/nvim/firenvim.vim new file mode 100644 index 0000000..7689b8e --- /dev/null +++ b/home/.config/nvim/firenvim.vim @@ -0,0 +1,11 @@ +set laststatus=0 "disable statusline +color carbonfox " set colors +set guifont=NotoMono:h9 " set font + +" get some plugins, including firenvim itself. +call plug#begin() +Plug 'glacambre/firenvim', { 'do': { _ -> firenvim#install(0) } } +Plug 'jiangmiao/auto-pairs' +Plug 'psliwka/vim-smoothie' " scorll with STRG + d or STRG + u +Plug 'EdenEast/nightfox.nvim' " Vim-Plug +call plug#end() diff --git a/home/.config/nvim/init.vim b/home/.config/nvim/init.vim index 7cf0d20..ef21677 100644 --- a/home/.config/nvim/init.vim +++ b/home/.config/nvim/init.vim @@ -1,271 +1,11 @@ -syntax on " syntax highlighting +" always load these. +runtime common.vim -set nocompatible " disable compatibility to old-time vi -set mouse=v " middle-click paste with -set number -set nocompatible -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 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 wildmode=longest,list " get bash-like tab completions -set cc=100 " set an 100 column border for good coding style -set mouse=a " enable mouse click -set cursorline " highlight current cursorline -set ttyfast " Speed up scrolling in Vim -set fdm=indent " foldingmethod syntax -set foldlevel=10 " only fold when a certain complexity is reached by default. This applies only at startup. -"set spell " enable spell check (may need to download language package) -set timeout timeoutlen=400 -set ttimeoutlen=0 - -" Avoid showing message extra message when using completion" -set shortmess+=c - -filetype plugin indent on "allow auto-indenting depending on file type -filetype plugin on - - -" let g:indentLine_setColors = 0 -let g:indentLine_char = '│' - -" set timeout to wait for shortcuts with a prefix -noremap oo o -noremap OO O - -" hit f3 to toggle search highlighting" -nnoremap :set hlsearch! - -nnoremap -let mapleader=" " -map t :echo "leader tested!" -map h :noh - -" copy to wayland clipboard when leader is used. (note, install gvim for this) -vnoremap wy y :call system("wl-copy", @") -nnoremap wY Y :call system("wl-copy", @") -nnoremap wy y :call system("wl-copy", @") -nnoremap wyy yy :call system("wl-copy", @") - -" copy to system clipboard when leader is used. (note, install gvim for this) -vnoremap y "+y -nnoremap Y "+Y -nnoremap y "+y -nnoremap yy "+yy - -" dont write the pastet upon stuff in visual mode into the register -vnoremap p pgvy - -" open terminal with F12 -nnoremap :terminal - -" vsplit with , then " -map " :vsplit - -" split with , then %" -map % :split - -" automatically enter insert mode on new neovim terminals -augroup terminal - au TermOpen * startinsert -augroup END - -" enter normal mode from terminal-emulator with -inoremap -tnoremap - -" :W to write file as root" -command W :SudaWrite - -" :E to open file as root" -command E :SudaRead - -" Set completeopt to have a better completion experience" -set completeopt=menuone,noinsert,noselect -call plug#begin() - -Plug 'lambdalisue/suda.vim' -"Plug 'preservim/nerdcommenter' -Plug 'mhinz/vim-startify' -Plug 'neoclide/coc.nvim', {'branch': 'release'} -Plug 'nvim-tree/nvim-tree.lua' -Plug 'psliwka/vim-smoothie' " scorll with STRG + d or STRG + u -Plug 'nvim-lualine/lualine.nvim' " nicer status line -"Plug 'neovim/nvim-lspconfig' " lsp config for easy setup of LSP -Plug 'romgrk/barbar.nvim' " tabs for buffers -Plug 'EdenEast/nightfox.nvim' " Vim-Plug -Plug 'numToStr/FTerm.nvim' " floating terminal, toggle with -Plug 'kdheepak/lazygit.nvim' -"Plug 'hrsh7th/cmp-nvim-lsp' -Plug 'goolord/alpha-nvim' -"Plug 'hrsh7th/cmp-buffer' -"Plug 'hrsh7th/cmp-path' -"Plug 'hrsh7th/cmp-cmdline' -"Plug 'hrsh7th/nvim-cmp' -Plug 'nvim-tree/nvim-web-devicons' -Plug 'junegunn/fzf', { 'do': { -> fzf#install() } } -Plug 'junegunn/fzf.vim' -Plug 'jiangmiao/auto-pairs' - -call plug#end() - -" Use and to navigate through popup menu" -inoremap pumvisible() ? "\" : "\" -inoremap pumvisible() ? "\" : "\" - -" Set completeopt to have a better completion experience" -set completeopt=menuone,noinsert,noselect - - -" Open NvimTree with f5" -nnoremap :NvimTreeToggle - -" Move to previous/next" -nnoremap BufferPrevious -nnoremap BufferNext -" Re-order to previous/next" -nnoremap BufferMovePrevious -nnoremap > BufferMoveNext -" Goto buffer in position..." -nnoremap BufferGoto 1 -nnoremap BufferGoto 2 -nnoremap BufferGoto 3 -nnoremap BufferGoto 4 -nnoremap BufferGoto 5 -nnoremap BufferGoto 6 -nnoremap BufferGoto 7 -nnoremap BufferGoto 8 -nnoremap BufferGoto 9 -nnoremap BufferLast -" Pin/unpin buffer" -nnoremap BufferPin -" Close buffer" -nnoremap BufferClose -" Wipeout buffer -" :BufferWipeout -" Close commands -" :BufferCloseAllButCurrent -" :BufferCloseAllButVisible -" :BufferCloseAllButPinned -" :BufferCloseAllButCurrentOrPinned -" :BufferCloseBuffersLeft -" :BufferCloseBuffersRight -" Magic buffer-picking mode -nnoremap BufferPick -" Sort automatically by..." -nnoremap bb BufferOrderByBufferNumber -nnoremap bd BufferOrderByDirectory -nnoremap bl BufferOrderByLanguage -nnoremap bw BufferOrderByWindowNumber - -" Other: -" :BarbarEnable - enables barbar (enabled by default) -" :BarbarDisable - very bad command, should never be used -" - -" debuging -packadd termdebug - -" debuggin for rust -command Rustdebug :let termdebugger="rust-gdb" | :Termdebug - -color terafox - -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 -let g:lazygit_floating_window_corner_chars = ['╭', '╮', '╰', '╯'] " customize lazygit popup window corner characters -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 gg :LazyGit - - -" coc language server configs -inoremap coc#pum#visible() ? coc#_select_confirm() : "\u\" -inoremap coc#pum#visible() ? coc#pum#next(1) : "\" -inoremap coc#pum#visible() ? coc#pum#prev(1) : "\" - -" 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 - -"------------------------------------------------------ -lua << END -require('alpha').setup(require('alpha.themes.startify').config) - --- 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 - --- empty setup using defaults -require("nvim-tree").setup() - -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, - }, -}) - --- Example keybindings -vim.keymap.set('n', '', 'lua require("FTerm").toggle()') -vim.keymap.set('t', '', 'lua require("FTerm").toggle()') - -END +" check if firenvim is accessing this, load it's specific configs if so. +lua << EOF +if vim.g.started_by_firenvim == true then + vim.cmd('runtime firenvim.vim') +else + vim.cmd('runtime main.vim') +end +EOF diff --git a/home/.config/nvim/main.vim b/home/.config/nvim/main.vim new file mode 100644 index 0000000..3630bf9 --- /dev/null +++ b/home/.config/nvim/main.vim @@ -0,0 +1,177 @@ +" :W to write file as root" +command W :SudaWrite + +" :E to open file as root" +command E :SudaRead + +" Set completeopt to have a better completion experience" +set completeopt=menuone,noinsert,noselect +call plug#begin() + +Plug 'lambdalisue/suda.vim' +Plug 'jiangmiao/auto-pairs' +Plug 'mhinz/vim-startify' +Plug 'neoclide/coc.nvim', {'branch': 'release'} +Plug 'nvim-tree/nvim-tree.lua' +Plug 'psliwka/vim-smoothie' " scorll with STRG + d or STRG + u +Plug 'romgrk/barbar.nvim' " tabs for buffers +Plug 'EdenEast/nightfox.nvim' " Vim-Plug +Plug 'numToStr/FTerm.nvim' " floating terminal, toggle with +Plug 'kdheepak/lazygit.nvim' +Plug 'nvim-lualine/lualine.nvim' " nicer status line +Plug 'goolord/alpha-nvim' +Plug 'nvim-tree/nvim-web-devicons' +Plug 'junegunn/fzf', { 'do': { -> fzf#install() } } +Plug 'junegunn/fzf.vim' + +call plug#end() + +" Use and to navigate through popup menu" +inoremap pumvisible() ? "\" : "\" +inoremap pumvisible() ? "\" : "\" + +" Set completeopt to have a better completion experience" +set completeopt=menuone,noinsert,noselect + + +" Open NvimTree with f5" +nnoremap :NvimTreeToggle + +" Move to previous/next" +nnoremap BufferPrevious +nnoremap BufferNext +" Re-order to previous/next" +nnoremap BufferMovePrevious +nnoremap > BufferMoveNext +" Goto buffer in position..." +nnoremap BufferGoto 1 +nnoremap BufferGoto 2 +nnoremap BufferGoto 3 +nnoremap BufferGoto 4 +nnoremap BufferGoto 5 +nnoremap BufferGoto 6 +nnoremap BufferGoto 7 +nnoremap BufferGoto 8 +nnoremap BufferGoto 9 +nnoremap BufferLast +" Pin/unpin buffer" +nnoremap BufferPin +" Close buffer" +nnoremap BufferClose +" Wipeout buffer +" :BufferWipeout +" Close commands +" :BufferCloseAllButCurrent +" :BufferCloseAllButVisible +" :BufferCloseAllButPinned +" :BufferCloseAllButCurrentOrPinned +" :BufferCloseBuffersLeft +" :BufferCloseBuffersRight +" Magic buffer-picking mode +nnoremap BufferPick +" Sort automatically by..." +nnoremap bb BufferOrderByBufferNumber +nnoremap bd BufferOrderByDirectory +nnoremap bl BufferOrderByLanguage +nnoremap bw BufferOrderByWindowNumber + +" Other: +" :BarbarEnable - enables barbar (enabled by default) +" :BarbarDisable - very bad command, should never be used +" +color terafox + +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 +let g:lazygit_floating_window_corner_chars = ['╭', '╮', '╰', '╯'] " customize lazygit popup window corner characters +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 gg :LazyGit + + +" coc language server configs +inoremap coc#pum#visible() ? coc#_select_confirm() : "\u\" +inoremap coc#pum#visible() ? coc#pum#next(1) : "\" +inoremap coc#pum#visible() ? coc#pum#prev(1) : "\" + +" 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 + +"------------------------------------------------------ +lua << END +require('alpha').setup(require('alpha.themes.startify').config) + +-- 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 + +-- empty setup using defaults +require("nvim-tree").setup() + +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, + }, +}) + +-- Example keybindings +vim.keymap.set('n', '', 'lua require("FTerm").toggle()') +vim.keymap.set('t', '', 'lua require("FTerm").toggle()') + +END