Fading Coder

One Final Commit for the Last Sprint

Home > Tech > Content

Configuring NOI Linux for Competitive Programming

Tech May 14 1

System Setup

Setting up a productive environment on NOI Linux requires several key modifications. First, configure language settings and update package sources. The system includes backup source lists, making it easy to switch repositories using sudo cp.

Install additional software packages including communication tools, development libraries, and creative applications. For packages with dependencies, use dpkg followed by apt-get -f install to resolve missing components automatically.

Customize the dock with essential applications like Firefox, file manager, Vim, calculator, VSCode, and development tools. Personalize desktop background and user avatar for better visual experience.

Vim Configuration

For competitive programming scenarios where external plugins aren't available, stick to native Vim features. Install clipboard support with sudo apt-get install vim-gtk and verify with vim --version | grep clipboard.

Configure .vimrc with essential settings:

so /usr/share/vim/vim81/indent.vim
se ts=3 sts=3 sw=3 et nu sc
colo slate

fu! OpenTerm()
   rightb vert term
   vert res 50
endf
com! Rterm cal OpenTerm()
nn <Leader>t :Rterm<CR>
au TerminalWinOpen * setl nonu nornu

fu! CppTemp()
   cal setline(1, [
            \ "/**",
            \ " * Year of red maple, creek beside reeds",
            \ " *",
            \ " * @file  ",
            \ " * @date  " . strftime("%Y-%m-%d %H:%M:%S"),
            \ " */"
            \ ])
   cal cursor(4, 10)
   star!
endf
au BufNewFile *.cpp cal CppTemp()

This setup enables three-space indentation, line numbering, command display, slate color scheme, integrated terminal with custom keybinding, and automatic C++ template generation.

VSCode Customization

Enhance VSCode for coding comfort with these adjustments:

  • Set code font size to 20px and terminal font to 16px
  • Configure three-space indentation
  • Disable bracket pair coloring
  • Turn off automatic closing of brackets and quotes
  • Enable smooth cursor animation with 5 lines visibility
  • Disable all sticky scroll features
  • Disable Enter key suggestion acceptance

Modify permissions for plugin compatibility: sudo chown -R username /usr/share/code. Install essential extansions including C/C++ support, blogging client, Vim emulation, Fira Code font, and background themes.

Shell Enhancement

Improve terminal appearance with Powerline and oh-my-bash:

sudo apt-get install fonts-powerline
git clone https://github.com/ohmybash/oh-my-bash.git .oh-my-bash
cp .bashrc .bashrc.bak
cp .oh-my-bash/templates/bashrc.osh-template .bashrc

In .bashrc, set OSH_THEME="powerline-icon" and reload configuration.

Vim Plugin Management

Install VimPlug for plugin management:

curl -fLo ~/.vim/autoload/plug.vim --create-dirs \
    https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim

Basic plugin structure:

call plug#begin('~/.vim/plugged')
call plug#end()

Airline Status Bar

Add to plugin section:

Plug 'vim-airline/vim-airline'
Plug 'vim-airline/vim-airline-themes'

Status bar configuration:

let g:airline_theme = "wombat"
let g:airline_powerline_fonts = 1
let g:airline#extensions#tabline#enabled = 1
let g:airline#extensions#tabline#formatter = 'unique_tail'
let g:airline#extensions#tabline#buffer_nr_show = 1
if !exists('g:airline_symbols')
    let g:airline_symbols = {}
endif
let g:airline_left_sep = ''
let g:airline_left_alt_sep = ''
let g:airline_right_sep = ''
let g:airline_right_alt_sep = ''
let g:airline_symbols.branch = ''
let g:airline_symbols.colnr = ' ℅:'
let g:airline_symbols.readonly = ''
let g:airline_symbols.linenr = ' :'
let g:airline_symbols.maxlinenr = '☰ '
let g:airline_symbols.dirty='⚡'

Rainbow Parentheses

Plugin declaration:

Plug 'luochen1990/rainbow'

Configuration:

let g:rainbow_active = 1
let g:rainbow_conf = {
   \  'ctermfgs': ['lightblue', 'lightyellow', 'lightgreen', 'lightcyan', 'lightmagenta'],
   \  'operators': '__',
   \  'parentheses': [['(', ')'], ['\[', '\]'], ['{', '}']],
   \  'separately': {'*': {}, 'nerdtree': 0, }
   \}

File Explorer

Plugin installation:

Plug 'preservim/nerdtree'

Settings:

let g:NERDTreeWinSize = 25
map <C-B> :NERDTreeMirror<CR>
map <C-B> :NERDTreeToggle<CR>
autocmd vimenter * NERDTree
autocmd vimenter * if !argc()|NERDTree|endif
autocmd bufenter * if (winnr("$") == 1 && exists("b:NERDTree") && b:NERDTree.isTabTree()) | q | endif
let g:NERDTreeDirArrowExpandable = '▸'
let g:NERDTreeDirArrowCollapsible = '▾'
let g:NERDTreeShowHidden = 1
let NERDTreeMinimalUI = 1
let NERDTreeDirArrows = 1

Smart Surrounding

Add text object surrounding capabilities:

Plug 'tpope/vim-surround'

Related Articles

Understanding Strong and Weak References in Java

Strong References Strong reference are the most prevalent type of object referencing in Java. When an object has a strong reference pointing to it, the garbage collector will not reclaim its memory. F...

Comprehensive Guide to SSTI Explained with Payload Bypass Techniques

Introduction Server-Side Template Injection (SSTI) is a vulnerability in web applications where user input is improper handled within the template engine and executed on the server. This exploit can r...

Implement Image Upload Functionality for Django Integrated TinyMCE Editor

Django’s Admin panel is highly user-friendly, and pairing it with TinyMCE, an effective rich text editor, simplifies content management significantly. Combining the two is particular useful for bloggi...

Leave a Comment

Anonymous

◎Feel free to join the discussion and share your thoughts.