From 952dac7cee99fc008972935b0ec58da6207c3005 Mon Sep 17 00:00:00 2001 From: Sage Vaillancourt Date: Sat, 20 Jan 2024 17:08:20 -0500 Subject: [PATCH] Add template files Remove lisp from template list Map to leader --- fake_home/.vim/templates/Makefile | 2 ++ fake_home/.vim/templates/skeleton.c | 7 +++++++ fake_home/.vim/templates/skeleton.cpp | 27 +++++++++++++++++++++++++++ fake_home/.vim/templates/skeleton.py | 13 +++++++++++++ fake_home/.vim/templates/skeleton.rb | 14 ++++++++++++++ fake_home/.vim/templates/skeleton.sh | 3 +++ fake_home/.vimrc | 5 ++--- 7 files changed, 68 insertions(+), 3 deletions(-) create mode 100644 fake_home/.vim/templates/Makefile create mode 100644 fake_home/.vim/templates/skeleton.c create mode 100644 fake_home/.vim/templates/skeleton.cpp create mode 100755 fake_home/.vim/templates/skeleton.py create mode 100755 fake_home/.vim/templates/skeleton.rb create mode 100755 fake_home/.vim/templates/skeleton.sh diff --git a/fake_home/.vim/templates/Makefile b/fake_home/.vim/templates/Makefile new file mode 100644 index 0000000..33a94c2 --- /dev/null +++ b/fake_home/.vim/templates/Makefile @@ -0,0 +1,2 @@ +all: + gcc main.c diff --git a/fake_home/.vim/templates/skeleton.c b/fake_home/.vim/templates/skeleton.c new file mode 100644 index 0000000..682b4ca --- /dev/null +++ b/fake_home/.vim/templates/skeleton.c @@ -0,0 +1,7 @@ +#include + +int main(int argc, char* argv[]) +{ + printf("Hello, world!\n"); + return 0; +} diff --git a/fake_home/.vim/templates/skeleton.cpp b/fake_home/.vim/templates/skeleton.cpp new file mode 100644 index 0000000..4f7a350 --- /dev/null +++ b/fake_home/.vim/templates/skeleton.cpp @@ -0,0 +1,27 @@ +#include + +class Person +{ + std::string name; + + public: + + Person(std::string name) + { + this->name = name; + } + + void greet() + { + std::cout << "Hello, my name is " << this->name << "!" << std::endl; + } +}; + +int main(int argc, char* argv[]) +{ + auto person = new Person("Madison"); + person->greet(); + delete person; + + return 0; +} diff --git a/fake_home/.vim/templates/skeleton.py b/fake_home/.vim/templates/skeleton.py new file mode 100755 index 0000000..1b7048c --- /dev/null +++ b/fake_home/.vim/templates/skeleton.py @@ -0,0 +1,13 @@ +#!/usr/bin/env python + +class Person: + def __init__(self, name, greeting = "Hello!"): + self.name = name + self.greeting = greeting + + def greet(self): + print(self.greeting) + print(f"My name is {self.name}") + +friend = Person("Willow") +friend.greet() diff --git a/fake_home/.vim/templates/skeleton.rb b/fake_home/.vim/templates/skeleton.rb new file mode 100755 index 0000000..5f8ddf6 --- /dev/null +++ b/fake_home/.vim/templates/skeleton.rb @@ -0,0 +1,14 @@ +#!/usr/bin/env ruby + +class Person + def initialize(name) + @name = name + end + + def greet + puts "Hello, my name is #{@name}!" + end +end + +friend = Person.new("Andrea") +friend.greet diff --git a/fake_home/.vim/templates/skeleton.sh b/fake_home/.vim/templates/skeleton.sh new file mode 100755 index 0000000..9f3f770 --- /dev/null +++ b/fake_home/.vim/templates/skeleton.sh @@ -0,0 +1,3 @@ +#!/bin/bash + +echo "Hello, world!" diff --git a/fake_home/.vimrc b/fake_home/.vimrc index 94c76b6..cfe3511 100644 --- a/fake_home/.vimrc +++ b/fake_home/.vimrc @@ -22,7 +22,7 @@ else colorscheme monokai endif -" let mapleader=" " +let mapleader=" " "nnoremap w yiwq:PIe `~/.shell_aliases ws "nnoremap w yiw:let srr_back = &srr set srr=>q:PIr! /home/sage/.shell_aliases wf " TODO Check if file needs saving @@ -161,10 +161,9 @@ if has ("autocmd") autocmd BufNewFile *.cpp 0r ~/.vim/templates/skeleton.cpp autocmd BufNewFile *.c 0r ~/.vim/templates/skeleton.c autocmd BufNewFile *.sh 0r ~/.vim/templates/skeleton.sh - autocmd BufNewFile *.lisp 0r ~/.vim/templates/skeleton.lisp autocmd BufNewFile *.py 0r ~/.vim/templates/skeleton.py autocmd BufNewFile *.rb 0r ~/.vim/templates/skeleton.rb - autocmd BufNewFile makefile 0r ~/.vim/templates/makefile + autocmd BufNewFile Makefile 0r ~/.vim/templates/Makefile augroup END endif