Skip to content

Commit

Permalink
Add some local changes to the repo
Browse files Browse the repository at this point in the history
  • Loading branch information
radoslav11 committed Aug 24, 2024
1 parent 5e4509c commit 2ebc133
Show file tree
Hide file tree
Showing 6 changed files with 36 additions and 20 deletions.
20 changes: 7 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# nvim-config
Neovim config requiring only Plug (and maybe copilot). You should clone this repo
Neovim config requires Plug (and maybe copilot). You should clone this repo
into `~/.config/nvim`, or the configuration directory for your nvim. Some of the plugins
do have additional dependencies, like `fzf`, `astyle` and `black`. Also, if you want a JetBarains-like
do have additional dependencies, like `fzf`, `clang-format` and `black`. Also, if you want a JetBarains-like
file search, you should install `ripgrep`.

# Installation
Expand All @@ -10,7 +10,7 @@ of the plugins, simply comment them out from `init.vim`.

# Fonts
Some of the plugins require a [Nerd Font](https://www.nerdfonts.com/font-downloads). I recommend
the Regular JetBrains Nerd font, as it's quite nice.
the Regular JetBrains Nerd font.

# Key Bindings
The additional key bindings are quite standard:
Expand All @@ -31,14 +31,8 @@ Follow the installation on https://github.com/github/copilot.vim, and add it ot
You will be prompted to login from a browser, or put a 6 digit code.

# Dependencies
After adding image and pdf support, I realised that it would be good to keep track of the
dependencies and useful packages. I'll probably create some installation script at some point.
The list is as follows:
- `poppler` for image / pdf tools.
- `ripgrep` for search.
- `fzf` for search.
- `astyle` for formatting C/C++/C#/Java.

Nowadays, the ones that I use are:
- `ripgrep` and `fzf` for search.
- `clang-format` for formatting C/C++/C#/Java.
- `black` for formatting python.
- `tlmgr` for installing LaTex packages.
- `chafa` for viewing image approximations in a terminal.
- `viu` like `chafa`, but it sends an actual image. Works with iTerm2.
5 changes: 5 additions & 0 deletions ai/roles.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
[grammar]
prompt = fix spelling and grammar

[cp]
prompt = You are a competitive programmer. Follow radoslav11's style from Coding-Library.
28 changes: 21 additions & 7 deletions init.vim
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ let g:python_host_prog="/opt/homebrew/bin/python"
let g:python3_host_prog="/opt/homebrew/bin/python"
set shell=/bin/zsh

" Enable bits/stdc++.h for C++
let $CPLUS_INCLUDE_PATH .= expand("~/Programming/Algorithms/Config/include")
" Additional includes
let $CPLUS_INCLUDE_PATH .= ":" . expand("~/.config/nvim/langs_symlinks/cpp")

call plug#begin()
Plug 'nvim-lualine/lualine.nvim'
Expand Down Expand Up @@ -44,6 +44,8 @@ Plug 'rust-lang/rust.vim'
Plug 'czheo/mojo.vim'

Plug 'christoomey/vim-tmux-navigator'

Plug 'madox2/vim-ai'
call plug#end()

set background=dark
Expand Down Expand Up @@ -101,6 +103,13 @@ nnoremap <leader>fg :Telescope live_grep<cr>
nnoremap <leader>fb :Telescope buffers<cr>
nnoremap <leader>fh :Telescope help_tags<cr>
let g:vim_ai_roles_config_file = expand("~/.config/nvim/ai/roles.ini")
" More leader operations, but for AI
xnoremap <leader>c :AIChat<CR>
nnoremap <leader>c :AIChat<CR>
xnoremap <leader>e :AIEdit
nnoremap <leader>e :AIEdit
map <F2> <ESC>:w <CR>
imap <F2> <ESC>:w <CR>
map <C-T> :tabnew <CR>
Expand Down Expand Up @@ -136,14 +145,14 @@ imap <C-`> <ESC>:NvimTreeToggle<CR>
nmap <C-`> <ESC>:NvimTreeToggle<CR>
tmap <C-`> <C-\><C-N>:NvimTreeToggle<CR>
set clipboard=unnamed

autocmd FileType c setlocal makeprg=gcc\ '%'\ -o\ '%:r'\ -std=gnu11
autocmd FileType cpp setlocal makeprg=g++\ '%'\ -o\ '%:r'\ -std=c++17\ -O3
autocmd FileType cpp setlocal makeprg=g++\ '%'\ -o\ '%:r'\ -std=c++17\ -O3\ -fsanitize=undefined,address
autocmd FileType haskell setlocal makeprg=ghc\ --make\ '%'
autocmd FileType java setlocal makeprg=javac\ '%'
autocmd FileType tex setlocal makeprg=xelatex\ -interaction\ nonstopmode\ -halt-on-error\ '%'

set clipboard=unnamedplus

" Terminal commands
set splitright
command! -nargs=* VertTerm vsplit | te <args>
Expand Down Expand Up @@ -195,22 +204,27 @@ autocmd FileType python imap <F9> <ESC>:w<CR>:call ExecuteFile()<CR>
autocmd FileType python set foldmethod=indent

" Formatting tab
setlocal expandtab
set expandtab

let g:autoformat_autoindent = 0
let clang_format_style = "\'{
\BasedOnStyle: Google,
\TabWidth: 4,
\IndentWidth: 4,
\InsertBraces: true,
\AccessModifierOffset: -2,
\AlignAfterOpenBracket: BlockIndent,
\AllowShortLoopsOnASingleLine: false,
\SpaceBeforeParens: Never,
\IncludeBlocks: Preserve,
\SpaceBeforeCaseColon: false,
\SpaceBeforeRangeBasedForLoopColon: false,
\UseTab: Never,
\PointerAlignment: Right,
\ReferenceAlignment: Right,
\DerivePointerAlignment: false,
\SpaceAfterTemplateKeyword: false,
\AlwaysBreakTemplateDeclarations: MultiLine
\AlwaysBreakTemplateDeclarations: Yes
\}'"

let g:formatdef_custom_clike = '"clang-format --style=' . clang_format_style . '"'
Expand Down
1 change: 1 addition & 0 deletions langs_symlinks/cpp/Eigen
1 change: 1 addition & 0 deletions langs_symlinks/cpp/bits
1 change: 1 addition & 0 deletions langs_symlinks/cpp/coding_library

0 comments on commit 2ebc133

Please sign in to comment.